org.alfresco.web.app.servlet
Class BaseDownloadContentServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.alfresco.web.app.servlet.BaseServlet
              extended by org.alfresco.web.app.servlet.BaseDownloadContentServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
DownloadContentServlet, GuestDownloadContentServlet

public abstract class BaseDownloadContentServlet
extends BaseServlet

Base class for the download content servlets. Provides common processing for the request.

See Also:
DownloadContentServlet, GuestDownloadContentServlet, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.alfresco.web.app.servlet.BaseServlet
BaseServlet.PathRefInfo
 
Field Summary
protected static java.lang.String ARG_PATH
           
protected static java.lang.String ARG_PROPERTY
           
protected static java.lang.String MIMETYPE_OCTET_STREAM
           
protected static java.lang.String MSG_ERROR_CONTENT_MISSING
           
protected static java.lang.String MSG_ERROR_NOT_FOUND
           
protected static java.lang.String URL_ATTACH
           
protected static java.lang.String URL_ATTACH_LONG
           
protected static java.lang.String URL_DIRECT
           
protected static java.lang.String URL_DIRECT_LONG
           
 
Fields inherited from class org.alfresco.web.app.servlet.BaseServlet
FACES_SERVLET, KEY_ROOT_PATH, KEY_STORE
 
Constructor Summary
BaseDownloadContentServlet()
           
 
Method Summary
protected static java.lang.String generateUrl(java.lang.String pattern, org.alfresco.service.cmr.repository.NodeRef ref, java.lang.String name)
          Helper to generate a URL to a content node for downloading content from the server.
protected abstract  org.apache.commons.logging.Log getLogger()
          Gets the logger to use for this request.
protected  void processDownloadRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean allowLogIn, boolean transmitContent)
          Processes the download request using the current context i.e.
 
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, 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
 

Field Detail

MIMETYPE_OCTET_STREAM

protected static final java.lang.String MIMETYPE_OCTET_STREAM
See Also:
Constant Field Values

MSG_ERROR_CONTENT_MISSING

protected static final java.lang.String MSG_ERROR_CONTENT_MISSING
See Also:
Constant Field Values

MSG_ERROR_NOT_FOUND

protected static final java.lang.String MSG_ERROR_NOT_FOUND
See Also:
Constant Field Values

URL_DIRECT

protected static final java.lang.String URL_DIRECT
See Also:
Constant Field Values

URL_DIRECT_LONG

protected static final java.lang.String URL_DIRECT_LONG
See Also:
Constant Field Values

URL_ATTACH

protected static final java.lang.String URL_ATTACH
See Also:
Constant Field Values

URL_ATTACH_LONG

protected static final java.lang.String URL_ATTACH_LONG
See Also:
Constant Field Values

ARG_PROPERTY

protected static final java.lang.String ARG_PROPERTY
See Also:
Constant Field Values

ARG_PATH

protected static final java.lang.String ARG_PATH
See Also:
Constant Field Values
Constructor Detail

BaseDownloadContentServlet

public BaseDownloadContentServlet()
Method Detail

getLogger

protected abstract org.apache.commons.logging.Log getLogger()
Gets the logger to use for this request.

This will show all debug entries from this class as though they came from the subclass.

Returns:
The logger

processDownloadRequest

protected void processDownloadRequest(javax.servlet.http.HttpServletRequest req,
                                      javax.servlet.http.HttpServletResponse res,
                                      boolean allowLogIn,
                                      boolean transmitContent)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Processes the download request using the current context i.e. no authentication checks are made, it is presumed they have already been done.

Parameters:
req - The HTTP request
res - The HTTP response
allowLogIn - Indicates whether guest users without access to the content should be redirected to the log in page. If false, a status 403 forbidden page is displayed instead.
Throws:
javax.servlet.ServletException
java.io.IOException

generateUrl

protected static final java.lang.String generateUrl(java.lang.String pattern,
                                                    org.alfresco.service.cmr.repository.NodeRef ref,
                                                    java.lang.String name)
Helper to generate a URL to a content node for downloading content from the server.

Parameters:
pattern - The pattern to use for the URL
ref - NodeRef of the content node to generate URL for (cannot be null)
name - File name to return in the URL (cannot be null)
Returns:
URL to download the content from the specified node


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.