cancel
Showing results for 
Search instead for 
Did you mean: 

404 related files for webscripts.

explorer
Champ in-the-making
Champ in-the-making
Hi,
I am a newbie, i looked at a couple of examples for creating webscripts and i could see that…

in the .js file we declare this:

if (folder == undefined || !folder.isContainer)
{
   status.code = 404;
   status.message = "Folder " + url.extension + " not found.";
   status.redirect = true;
}
model.folder = folder;

and have a relative 404 file.

File: blogsearch.get.html.404.ftl

<html>
  <body>
    ${status.message}
  </body>
</html>

Can anyone explain the relation between them if any.
If not, whats the purpose of the 404.ftl file…

Thanks in advance…
2 REPLIES 2

davidc
Star Contributor
Star Contributor
You may set any http status code on a web script response.  By default, it'll be 200 (OK), or 500 (error).  To set the status, the following javascript is issued:

status.code = xxx;

You may also customise the response content based on the error code.  This is achieved by providing a template for the status code and adding this to your javascript:

status.redirect = true;

The status code template follows a naming convention where the error code is part of the name.

If you don't set status.redirect = true, then the standard template associated with the web script is rendered, however, the status code on the response header is still set.

For more info see http://wiki.alfresco.com/wiki/Web_Scripts#Response_Status

explorer
Champ in-the-making
Champ in-the-making
Thank you for the reply.