org.alfresco.web.app.servlet
Class TemplateContentServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.alfresco.web.app.servlet.BaseServlet
org.alfresco.web.app.servlet.BaseTemplateContentServlet
org.alfresco.web.app.servlet.TemplateContentServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class TemplateContentServlet
- extends BaseTemplateContentServlet
Servlet responsible for streaming content from a template processed against a node directly
to the response stream.
The URL to the servlet should be generated thus:
/alfresco/template/workspace/SpacesStore/0000-0000-0000-0000
or
/alfresco/template/workspace/SpacesStore/0000-0000-0000-0000/workspace/SpacesStore/0000-0000-0000-0000
or
/alfresco/template?templatePath=/Company%20Home/Data%20Dictionary/Presentation%20Templates/doc_info.ftl&contextPath=/Company%20Home/mydoc.txt
The store protocol, followed by the store ID, followed by the content Node Id used to
identify the node to execute the default template for. The second set of elements encode
the store and node Id of the template to used if a default is not set or not requested. Instead
of using NodeRef references to the template and context, path arguments can be used. The URL args
of 'templatePath' and 'contextPath' can be used instead to specify name based encoded Paths to the
template and its context.
The URL may be followed by a 'mimetype' argument specifying the mimetype to return the result as
on the stream. Otherwise it is assumed that HTML is the default response mimetype.
Like most Alfresco servlets, the URL may be followed by a valid 'ticket' argument for authentication:
?ticket=1234567890
And/or also followed by the "?guest=true" argument to force guest access login for the URL. If the
guest=true parameter is used the current session will be logged out and the guest user logged in.
Therefore upon completion of this request the current user will be "guest".
If the user attempting the request is not authorised to access the requested node the login page
will be redirected to.
- See Also:
- Serialized Form
Method Summary |
protected java.util.Map |
buildModel(org.alfresco.service.ServiceRegistry services,
javax.servlet.http.HttpServletRequest req,
org.alfresco.service.cmr.repository.NodeRef templateRef)
Builds the FreeMarker model |
static java.lang.String |
generateURL(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.cmr.repository.NodeRef templateRef)
Helper to generate a URL to process a template against a node. |
protected org.apache.commons.logging.Log |
getLogger()
Gets the logger to use for this request. |
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
Methods inherited from class org.alfresco.web.app.servlet.BaseServlet |
checkAccess, getServiceRegistry, redirectToLoginPage, resolveNamePath, resolveWebDAVPath, resolveWebDAVPath, resolveWebDAVPath, resolveWebDAVPath, servletAuthenticate, servletAuthenticate, setNoCacheHeaders, validRedirectJSP |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TemplateContentServlet
public TemplateContentServlet()
getLogger
protected org.apache.commons.logging.Log getLogger()
- Description copied from class:
BaseTemplateContentServlet
- Gets the logger to use for this request.
This will show all debug entries from this class as though they
came from the subclass.
- Specified by:
getLogger
in class BaseTemplateContentServlet
- Returns:
- The logger
buildModel
protected java.util.Map buildModel(org.alfresco.service.ServiceRegistry services,
javax.servlet.http.HttpServletRequest req,
org.alfresco.service.cmr.repository.NodeRef templateRef)
- Description copied from class:
BaseTemplateContentServlet
- Builds the FreeMarker model
- Specified by:
buildModel
in class BaseTemplateContentServlet
- Parameters:
services
- Service Registry instancereq
- Http requesttemplateRef
- The node ref of the template to process
- Returns:
- The FreeMarker model
service
protected void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
- Overrides:
service
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
- See Also:
HttpServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
generateURL
public static final java.lang.String generateURL(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.cmr.repository.NodeRef templateRef)
- Helper to generate a URL to process a template against a node.
The result of the template is supplied returned as the response.
- Parameters:
nodeRef
- NodeRef of the content node to generate URL for (cannot be null)templateRef
- NodeRef of the template to process against, or null to use default
- Returns:
- URL to process the template
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.