You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Sandro Boehme <sa...@gmx.de> on 2015/07/15 12:57:25 UTC
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
Re: Errorpage for the SlingPostServlet
Posted by Sandro Boehme <sa...@gmx.de>.
Hi Jason,
thanks for keeping up on that!
My understanding is, that a path structure could be used by different
resource types and it sounds good to me to have to have error handling
per resource type. But I might be wrong on that.
As I didn't got an answer here and at the dev list I guess it's not
implemented yet and I have to go into the details to understand how it
really works and how it should be implemented.
But right now I have a other priority task that has a deadline that I
have to work on. So I have to pause the work on that for now.
Thanks,
Sandro
Am 20.07.15 um 19:04 schrieb Jason Bailey:
> 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.boehme@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.boehme@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
>>
>
RE: Errorpage for the SlingPostServlet
Posted by Jason Bailey <Ja...@sas.com>.
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.boehme@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.boehme@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
>
Re: Errorpage for the SlingPostServlet
Posted by Sandro Boehme <sa...@gmx.de>.
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.boehme@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
>
RE: Errorpage for the SlingPostServlet
Posted by Jason Bailey <Ja...@sas.com>.
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.boehme@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