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