Wednesday, April 5, 2017

How to create custom renderer for a file type in AEM

Use Case:

Honestly use cases for this could be different based on what you want to change in response for a specific file type. We will take an example where we want to add some custom header for a PDF file based on what author has added in property of that file. For example here if author has added a canonical url and no index property, then we want to add these property in response header of all pdf file request.

Prerequisite:

Note that in order to make these property available for asset, you have to override asset editor as well. One example of adding extra property to asset editor is here http://www.wemblog.com/2013/01/how-to-associate-cug-with-dam-asset-in.html

Implementation:
Key here is OptingServlet https://sling.apache.org/apidocs/sling7/org/apache/sling/api/servlets/OptingServlet.html which get invoked on every request. Here is one example

Note: Let me know if you have any question about implementation.

26 comments:

  1. Excellent and nice post. It will beneficial for everyone. Thanks for sharing such a wonderful post. Avail No 1 custom essay writing help UK from certified PhD writers. It is extremely helpful for me. You can email us at info@ukdissertationhelp.co.uk or Phone Number - 020 8144 9988

    ReplyDelete
  2. My Assignment Services is one such Online Assignment Help provider which provides a helping hand to all your academic related queries. They have a lot of professional experts who are skilful in giving you guidance and providing you with cheap assignment help services. You are free to contact their experts by visiting their website and get your pending presentations completed on the time. Given below are some of the steps that they follow while drafting your assignments. Many students see that Assignment Help UK experts are proficient in writing your assignments but no one wonders the reason behind it. However, students pursuing IT need to understand the concepts of Java because it holds down the concept of object oriented programming. The programming concepts are complex to understand and brings a havoc to students, that is why, My Assignment Services bring you our online assignment help services. Taking out some time to consider and contrast about what options that you have that you can include by writing them on a piece of paper. You can also contact some real time Deakin Referencing Generator experts to assist you with the following topics.

    ReplyDelete
  3. Thanks a lot for sharing this blog. I was searching for this topic for a while. Glad that I came across your blog. Great effort. Do share more.
    Cloud Computing Training in Chennai
    DevOps Training in Chennai
    Cloud computing Training
    RPA Training in Chennai
    AWS Training in Chennai
    Cloud Computing Courses in Chennai

    ReplyDelete
  4. You can take the help of assignments from AbAssignmentHelp. They provide assignment help services in the UK for more than a decade for universities and colleges.

    ReplyDelete
  5. Thanks a lot for sharing this blog. I was searching for this topic for a while. Glad that I came across your blog. Great effort. Do share more.

    UX Training in Chennai
    Python Training in Chennai
    Java Training in Chennai
    DevOps Training in Chennai

    ReplyDelete
  6. Wow its great post. I searched online many times these types of post. I am happy to find this wonderful blog. Thank you very much for sharing this blog with us. I must share this with others. If you Do my Assignment.

    ReplyDelete
  7. Thank you for sharing this informative post.MyAssignmenthelp is giving assignment help to students.we are already trusted by thousands of students who struggle to write their academic papers and also by those students who simply want paper writing service
    to save their time and make life easy.

    ReplyDelete
  8. Awesome content! You have shared an informative blog post. I am an online paper writing services expert and this piece of information helps me a lot.

    ReplyDelete
  9. Wondering for the free instant essay typer online? Your search ends here as you can have your essays, assignments, articles etc instantly.
    At Essayassignmenthelp, the strength of 500+ experts, we guarantee to provide you impeccable college essays at very reasonable prices that any student can afford to. We never compromise with our quality while providing reasonable essay writing help. Our experienced essay writers understand what phrases and sentences the essay evaluators want to see in the content.

    ReplyDelete
  10. The following is a list of PROPERTY MANAGEMENT COMPANY in new York City rental property managers in our database.

    ReplyDelete
  11. We have some important evaluative essay topics which range from educational system to politics. The students can choose from these topics or they can also select a topic of their own.

    ReplyDelete
  12. This is an awesome post.Really very informative and creative contents.
    SEO company in Chennai

    ReplyDelete
  13. Nice to see this blog. Really this is an amazing blog and also informative and valuable. Visit for
    Programming Assignment Help
    My Assignment Help

    ReplyDelete
  14. Packers and Movers Hyderabad Give Certified and Verified Service Providers, Cheap and Best ###Office Relocation Charges, ***Home Shifting, ✔✔✔Goods Insurance worth Rs. 10,000, Assurance for Local and Domestic House Shifting. Safe and Reliable Household Shifting Services in Hyderabad with Reasonable Packers and Movers Price Quotation @ Packers And Movers Hyderabad

    ReplyDelete
  15. if you are searching for assignment help then i suggest you contact us. We provide the best assignment help online at affordable prices.
    Assignment Help Australia
    my assignment help

    free grammar check

    ReplyDelete