Sandro,

Have you had any luck with this? I wasn't aware that you could even use a 
component level error handling until I re-read the error handling page. I'm 
taking a look at the Resource Resolver code to try to get a better idea of the 
logic that was implemented.

This is one of the times that I feel a resource type structure isn't always 
sufficient. I would much rather have an error handling solution that would 
resolve the servlet based on a path structure then a resource type.

-Jason

-----Original Message-----
From: Sandro Boehme [mailto:sandro.boe...@gmx.de] 
Sent: Wednesday, July 15, 2015 5:26 PM
To: users@sling.apache.org
Subject: Re: Errorpage for the SlingPostServlet

Hi Jason,

I guess you mean general error handlers? In my case I would like to have an 
error handler for a specific resource type. This seem to work for a 500.jsp (as 
seen in the example) but I wonder if it's possible for a general error page as 
well.

Best,

Sandro

Am 15.07.15 um 21:49 schrieb Jason Bailey:
> Sandro,
>
> I guess I haven't been keeping up, I thought error handlers had to be under 
> /sling/servlet/errorhandler/ ???
>
> Was that changed?
>
> -Jason
>
> -----Original Message-----
> From: Sandro Boehme [mailto:sandro.boe...@gmx.de]
> Sent: Wednesday, July 15, 2015 6:57 AM
> To: users@sling.apache.org
> Subject: Errorpage for the SlingPostServlet
>
> Hello again,
>
> as my message seem to get lost in the big traffic of the dev list and as it 
> might not be a bug I'm posting it here again.
>
> I would like to have an error jsp that is shown on all errors of the Sling 
> post servlet and that displays the according error message.
>
> Based on an example of Bertrand I would like to show what I mean here 
> in
> detail:
>
> 1. Creating the container node for the resource type $ curl -u 
> admin:admin -Fsling:resourceType=posterror 
> http://localhost:8080/apps/posterror
>
>
> 2. Creating a simple html form
> $ echo '<html><body><form method="post">     <input type="hidden"
> name=":sendError" value="true"> <input type="text" name="aProperty"> 
> <input type="submit"> </form></body></html>' > /tmp/posterror.jsp
>
> $ curl -u admin:admin -T/tmp/posterror.jsp 
> http://localhost:8080/apps/posterror/posterror.jsp
>
>
> 3. The general error handler that I would like to show up because the 
> post of the HTML form in the step before is not authenticated.
> $ echo 'This is a general error handler' > /tmp/Throwable.jsp
>
> $ curl -u admin:admin -T /tmp/Throwable.jsp 
> http://localhost:8080/apps/posterror/Throwable.jsp
>
>
> 4. The form whose submit should lead to the rendering of the 
> Throwable.jsp. How can I make that happen? Is that a bug or is there 
> an other way to do that?
> $ curl http://localhost:8080/apps/posterror.html
>
>
> 5. If I create a 500.jsp like this it gets rendered instead of the 
> Throwable.jsp. Why is that the case as I would have expected it to be 
> a
> "401 Unauthorized" error?
>
> $ echo 'Error 500:
> <%=request.getAttribute("javax.servlet.error.message")%>, Exception:
> <%=request.getAttribute("javax.servlet.error.exception")%>' > 
> /tmp/500.jsp $ curl -u admin:admin -T /tmp/500.jsp 
> http://localhost:8080/apps/posterror/500.jsp
>
>
> 6. Deleting the 500.jsp for debugging reasons $ curl -u admin:admin 
> -F":operation=delete"
> http://localhost:8080/apps/posterror/500.jsp
>
>
> Help is much appreciated!
>
> Thanks,
>
> Sandro
>

Reply via email to