Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

500 internal error on requestDispatcher.forward for Experience Manager

Avatar

Employee

Hi

We have a form when submitted calls a webservice and may return error messages as response. We need to redirect to same page posting the error.

 

trying with this code in POST.jsp of the form, but it returns a 500 server error and couldnt find anything in logs:

 

 

SlingHttpServletRequest req =

       new SlingHttpServletRequestWrapper(((SlingHttpServletRequest)slingRequest )) {

           public String getMethod() {

               return "GET";

          }

       };

    

       // req.setAttribute("PARAMS", paramsMap);

              

        slingRequest = (SlingHttpServletRequest)req;

        RequestDispatcherOptions requestDispatcherOptions = new RequestDispatcherOptions();       

        RequestDispatcher requestDispatcher = req.getRequestDispatcher(req.getRequestURI(), requestDispatcherOptions);

     

      if(requestDispatcher != null)

        requestDispatcher.forward(req, response);        

 

 

Any pointers on what could be wrong here? Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee

Details of error handling at http://sling.apache.org/site/errorhandling.html

Create a file Throwable.jsp at [1] & Have your custom implementation to handle server internal error.

 

[1]  /apps/sling/servlet/errorhandler/Throwable.jsp

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

Details of error handling at http://sling.apache.org/site/errorhandling.html

Create a file Throwable.jsp at [1] & Have your custom implementation to handle server internal error.

 

[1]  /apps/sling/servlet/errorhandler/Throwable.jsp