public abstract class AbstractViewFileServlet
extends javax.servlet.http.HttpServlet
Constructor and Description |
---|
AbstractViewFileServlet() |
Modifier and Type | Method and Description |
---|---|
protected String |
attachmentQuery(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 void |
getInputStream(String attachmentPath,
InputStreamConsumer<io.atlassian.blobstore.client.api.Unit> consumer)
Gets the attachment file (not the file name) that corresponds to the requested attachment.
|
protected JiraAuthenticationContext |
getJiraAuthenticationContext() |
protected String |
getUserName() |
protected abstract void |
setResponseHeaders(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sets the content type, content length and "Content-Disposition" header
of the response based on the values of the attachement found.
|
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
doGet
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
protected final String attachmentQuery(javax.servlet.http.HttpServletRequest request)
request
- HTTP requestprotected abstract void getInputStream(String attachmentPath, InputStreamConsumer<io.atlassian.blobstore.client.api.Unit> consumer) throws IOException, PermissionException
attachmentPath
- the attachment pathconsumer
- a procedure that consumes the stream with the attachment data.DataAccessException
- If there is a problem looking up the data to support the attachment.AttachmentNotFoundException
- if the attachment does not exist.PermissionException
- if the user has insufficient permission to see the attachment.IOException
- if there is a problem getting the attachment.NoAttachmentDataException
- if the attachment's contents cannot be found.AttachmentReadException
- if a problem occurs when the consumer processes the attachment's contents.protected abstract void setResponseHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws InvalidAttachmentPathException, DataAccessException, IOException
request
- HTTP requestresponse
- HTTP responseInvalidAttachmentPathException
DataAccessException
IOException
protected final String getUserName()
protected JiraAuthenticationContext getJiraAuthenticationContext()
Copyright © 2002-2015 Atlassian. All Rights Reserved.