We would like to customize the POST servlet response in case of the invalid servlet response, how can we customize this? OOTB response for the invalid servlet (/bin/testpost/rest) is like
How can we customize invalid POST servlet Response
<html>
<head>
<title>Error while processing /bin/testpost/rest</title>
</head>
<body>
<h1>Error while processing /bin/testpost/rest</h1>
<table>
<tbody>
<tr>
<td>Status</td>
<td>
<div id="Status">500</div>
</td>
</tr>
<tr>
<td>Message</td>
<td>
<div id="Message">org.apache.sling.api.resource.PersistenceException: Unable to create node at
/bin/testpost</div>
</td>
</tr>
<tr>
<td>Location</td>
<td>/bin/testpost/rest</td>
</tr>
<tr>
<td>Parent Location</td>
<td>/bin/testpost</td>
</tr>
<tr>
<td>Path</td>
<td>
<div id="Path">/bin/testpost/rest</div>
</td>
</tr>
<tr>
<td>Referer</td>
<td><a href="http://localhost:4502/en_US/book/page-search.html"
id="Referer">http://localhost:4502/en_US/book/page-search.html</a></td>
</tr>
<tr>
<td>ChangeLog</td>
<td>
<div id="ChangeLog"></div>
</td>
</tr>
</tbody>
</table>
<p><a href="http://localhost:4502/en_US/book/page-search.html">Go Back</a></p>
<p>Modified Resource</p>
<p>Parent of Modified Resource</p>
</body>
</html>
Views
Replies
Total Likes
@aemdev9 Please check for the below URL:
https://stackoverflow.com/questions/37298435/handling-exception-in-jquery-ajax-response-from-servlet
Hi @aemdev9
Default error handling for servlet is located under /libs/sling/servlet/errorhandler/ .You can override this in your custom app as per your requirement.
Please refer this link for more info:
You can customize either default.jsp or 404.jsp as per youre requirement.
Regards,
Rajashankar
Thanks for your response. We have to customize 500.jsp, it won't work unless we set HttpServletResponse.sendError(500) explicitly and for this we have customize the OOTB default servlet (as we are trying to update invalid servlet response).
Hi,
where do you want to achieve this? On Author or Publish instance.
If you are looking at publishing, you can simply set error handler at apache https server for 500 error.
Thanks for your response @arunpatidar, we would like to customize both on author and publisher.
I think it that case you have to overlay /libs/sling/servlet/errorhandler/default.jsp
We are not able to achieve by overlaying /libs/sling/servlet/errorhandler/default.jsp without modifying the "default servlet" as we are trying to update the invalid servlet response. So we are not trying find a way to update the above posted HTML(response).
Views
Likes
Replies
Views
Likes
Replies