AnsweredAssumed Answered

Webscript status redirect not working

Question asked by tlo on Mar 29, 2016
Hi,

I have written a java-backed webscript that delivers modified file contents from a noderef.  I would like for an exception thrown in that webscript to cause a custom 403 "not authorized" page.  Here is the snippet that throws the exception:


   catch (Exception ex)
   {
      status.setRedirect(true);
      throw new
        WebScriptException(Status.STATUS_FORBIDDEN,
                           "You are not authorized to view this document");
   }

I have added
  src/main/amp/config/alfresco/extension/templates/webscripts/example.get.html.403.ftl

When the exception occurs, I see this in the logs, as expected:
<blockquote>
2016-03-29 02:02:28,064  ERROR [extensions.webscripts.AbstractRuntime] [http-bio-8080-exec-6] Exception from executeScript - redirecting to status template error: 02290001 You are not authorized to view this document
</blockquote>

What I see in the browser, however, is:
<blockquote>
Firefox can't find the file at http://deb:8080/alfresco/service/myservice/example?node=workspace://SpacesStore/e125d113-5b75-4750-b15c-2c840f666a19.
</blockquote>

It looks like the redirect to the custom status message template is not working.  Where should it reside to be found?

Outcomes