com.atlassian.jira.web.servlet
Class AbstractViewFileServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.atlassian.jira.web.servlet.AbstractViewFileServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
ViewAttachmentServlet

public abstract class AbstractViewFileServlet
extends javax.servlet.http.HttpServlet

See Also:
Serialized Form

Constructor Summary
AbstractViewFileServlet()
           
 
Method Summary
protected  String attachmentPath(javax.servlet.http.HttpServletRequest request)
          Validates that path is valid attachment path.
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected abstract  File getFileName(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Gets the attachment file (not the file name) that corresponds to the requested attachment.
protected  String getUserName()
           
protected abstract  void setResponseHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Sets any required headers on the http response.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, 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
 

Constructor Detail

AbstractViewFileServlet

public AbstractViewFileServlet()
Method Detail

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

attachmentPath

protected final String attachmentPath(javax.servlet.http.HttpServletRequest request)
Validates that path is valid attachment path.

Parameters:
request - HTTP request
Returns:
attachment path

getFileName

protected abstract File getFileName(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)
                             throws InvalidAttachmentPathException,
                                    DataAccessException,
                                    IOException,
                                    PermissionException
Gets the attachment file (not the file name) that corresponds to the requested attachment.

Parameters:
request - the http request.
response - the http response.
Returns:
the File resource for the attachment.
Throws:
DataAccessException - If there is a problem looking up the data to support the attachment.
IOException - if there is a problem getting the File.
PermissionException - if the user has insufficient permission to see the attachment.
InvalidAttachmentPathException - if the path to the attachment was invalid in some way.

setResponseHeaders

protected abstract void setResponseHeaders(javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws InvalidAttachmentPathException,
                                           DataAccessException,
                                           IOException
Sets any required headers on the http response.

Parameters:
request - HTTP request
response - HTTP response
Throws:
InvalidAttachmentPathException
DataAccessException
IOException

getUserName

protected final String getUserName()
Returns:
The logged-in user's name, or null (anonymous)


Copyright © 2002-2010 Atlassian. All Rights Reserved.