This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
As defined here http://adobe-consulting-services.github.io/acs-aem-commons/features/errorpagehandler.html I am trying to confgure error pages for my application. Here is what I have done:
1) Created 404.jsp and default.jsp at /apps/sling/servlet/errorhandler as defined on the page.
2) Added below widget to the advanced tab:
<errorpages jcr:primaryType="cq:Widget" path="/apps/acs-commons/components/utilities/errorpagehandler/dialog/errorpages.infinity.json" xtype="cqinclude"/>
3) Created /apps/<myapp>/config/com.adobe.acs.commons.errorpagehandler.impl.ErrorPageHandlerImpl.xml
with the following properties:
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="sling:OsgiConfig" prop.enabled="{Boolean}true" prop.error-page.fallback-name="500" prop.error-page.system-path="/content/error" prop.error-page.extension="html" ttl="{Long}300"/>
4) Created /content/myapp/en/errors using a fresh template. The template has only a parsys. Inside the /content/myapp/en/errors, I have created page 404 and 500 using the same template. In the video it is shown that when the speaker opens the pages 404.html and 500.html created under geometrixx from siteadmin he is able to see appropriate error messages. What I am not able to understand is that if my template consists of only a parsys how will the 404 and 500 pages show the error messge. From where are those messages being generated ? Am I missing something here ? Do I have to create any component ?
5) In the Page Properties of the page /content/myapp/en , I have configured /content/myapp/en/errors as the Error Page. To generate a 404 error when I try to access the URL /content/myapp/ent.html instead of /content/myapp/en.html it throws a
No resource found Cannot serve request to /content/myapp/ent.html in /apps/sling/servlet/errorhandler/404.jsp
Not sure how do I get he nice looking pages as shown in the video.
5) How can I make the error messages authorable ?
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
In the video, his error pages show the appropriate message because of the template he used when he created the pages. The template had the title component already on it, so when the page loads it will display the page title. If you use the same page template that you are using for the rest of your site, it will keep the same design are those pages. These pages work the same as another page in your site, so you can add a text component to them, and type any error message that you want displayed.
The reason you are getting the no resource found, is because the error page configuration was configured at the /content/myapp/en level, so anything on that page level will not use the custom error page, only pages that are children of the en.html page. So, if you had a page here /content/myapp/en/example.html and you tried accessing /conent/myapp/en/exampletttt.html, then the custom error page should show up.
Views
Replies
Total Likes
In the video, his error pages show the appropriate message because of the template he used when he created the pages. The template had the title component already on it, so when the page loads it will display the page title. If you use the same page template that you are using for the rest of your site, it will keep the same design are those pages. These pages work the same as another page in your site, so you can add a text component to them, and type any error message that you want displayed.
The reason you are getting the no resource found, is because the error page configuration was configured at the /content/myapp/en level, so anything on that page level will not use the custom error page, only pages that are children of the en.html page. So, if you had a page here /content/myapp/en/example.html and you tried accessing /conent/myapp/en/exampletttt.html, then the custom error page should show up.
Views
Replies
Total Likes
Thanks for the response. So does it mean that to show errors at /content/myapp/en level, I need to create a separate set of error pages and for the errors at /content/myapp/en/example.html there will be a separate set of error pages ?
Also, to handle error codes like 500, 403 etc, I understand I will need to create cq:Pages. But do I need to create more JSPs like 500.jsp, 403.jsp under /apps/sling/servlet/errorhandler ?
And I may be naive in asking this, but what role are the JSPs under /apps/sling/servlet/errorhandler playing apart from overlaying the default error pages under /libs. Is it somehow related to the cq:Pages created for the different categories of errors ?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies