Solved : HTTP 302 – ATG Rest MVC Response

ATG REST MVC framework leverages existing Droplets, Form handlers and Components. As REST MVC uses the form handler in web service call, form handler internally redirects to either Success Url or Error Url. So due to this every time we invoke any actor that uses form handler always give HTTP 302 Moved Permanently because internal redirection happens on success and error pages.


Like in above login call if login is successful the it is redirecting to /rest/model/atg/userprofiling/ProfileActor/login-success actor chain and if there is an error then it redirects to /rest/model/atg/userprofiling/ProfileActor/login-error actor chain.

So whenerver the redirection occurs in HTTP call we will get HTTP 302 Moved Permanently but as we want to get login exceptions or login success messages we have to follow the redirection.

In my case I am using Apache HTTP Client for calling ATG REST MVC. Apache Http client provides LaxRedirectStrategy that automatically redirects all HEAD, GET and POST requests and relaxes restrictions on automatic redirection of POST methods imposed by the HTTP specification. Use this to create HTTp Client…

CloseableHttpClient client = HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()).build();

After using this we will always get the response from the actor which is lastly invoked.

  • aashish patel

    There exists an alternative, you need to create chain id-s for success and error case in the actor definition file itself and send their paths as success and error URLs like as shown below :-

    • Hi Aashish,
      Thanks for comment but this is not about redirecting to error or success url.
      This is all about follow the redirection in actor chains so that we won’t get 302 status.