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.

14 comments:

  1. 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
  2. This comment has been removed by the author.

    ReplyDelete
  3. 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
  4. 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
  5. 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
  6. The following is a list of PROPERTY MANAGEMENT COMPANY in new York City rental property managers in our database.

    ReplyDelete
  7. 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
  8. 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
  9. 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
  10. it was exceptionally valuable for me.keep sharing such thoughts later on also. A debt of gratitude is in order for sharing the valuable data. phd dissertation help

    ReplyDelete