public class ViewAttachmentServlet extends AbstractViewFileServlet
| Constructor and Description |
|---|
ViewAttachmentServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected com.atlassian.jira.web.servlet.CommonAttachment |
getCommonAttachment(String query) |
protected int |
getContentLength(String attachmentPath) |
protected void |
getInputStream(String attachmentQuery,
InputStreamConsumer<com.atlassian.fugue.Unit> consumer)
Gets the attachment file (not the file name) that corresponds to the requested attachment.
|
protected void |
setResponseHeaders(javax.servlet.http.HttpServletRequest request,
Optional<RangeResponse> rangeResponse,
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.
|
protected boolean |
supportsRangeRequests()
Returns true if this implementation supports RFC 7233 "Range Requests".
|
attachmentQuery, copyRange, doGet, getAttachment, getLoggedInUser, loggedInUserHasPermissionToViewAttachmentdoDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceprotected int getContentLength(String attachmentPath)
getContentLength in class AbstractViewFileServletprotected boolean supportsRangeRequests()
AbstractViewFileServlet
Returning true means that you must set the appropriate "Content-Range" and "Content-Length" headers for the
partial range we will return in the #setResponseHeaders implementation.
supportsRangeRequests in class AbstractViewFileServletAbstractViewFileServlet.setResponseHeaders(HttpServletRequest, Optional, HttpServletResponse)protected void getInputStream(String attachmentQuery, InputStreamConsumer<com.atlassian.fugue.Unit> consumer) throws PermissionException, IOException
AbstractViewFileServletgetInputStream in class AbstractViewFileServletattachmentQuery - the attachment pathconsumer - a procedure that consumes the stream with the attachment data.PermissionException - if the user has insufficient permission to see the attachment.IOException - if there is a problem getting the attachment.AbstractViewFileServlet.getInputStream(String, com.atlassian.jira.util.io.InputStreamConsumer)protected void setResponseHeaders(javax.servlet.http.HttpServletRequest request,
Optional<RangeResponse> rangeResponse,
javax.servlet.http.HttpServletResponse response)
throws AttachmentNotFoundException,
IOException
setResponseHeaders in class AbstractViewFileServletrequest - HTTP requestrangeResponse - if we are doing a partial response this holds teh range we will returnresponse - HTTP responseAttachmentNotFoundExceptionIOExceptionAbstractViewFileServlet.supportsRangeRequests()protected com.atlassian.jira.web.servlet.CommonAttachment getCommonAttachment(String query)
Copyright © 2002-2018 Atlassian. All Rights Reserved.