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<io.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, loggedInUserHasPermissionToViewAttachment
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
protected int getContentLength(String attachmentPath)
getContentLength
in class AbstractViewFileServlet
protected 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 AbstractViewFileServlet
AbstractViewFileServlet.setResponseHeaders(HttpServletRequest, Optional, HttpServletResponse)
protected void getInputStream(String attachmentQuery, InputStreamConsumer<io.atlassian.fugue.Unit> consumer) throws PermissionException, IOException
AbstractViewFileServlet
getInputStream
in class AbstractViewFileServlet
attachmentQuery
- 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 AbstractViewFileServlet
request
- HTTP requestrangeResponse
- if we are doing a partial response this holds teh range we will returnresponse
- HTTP responseAttachmentNotFoundException
IOException
AbstractViewFileServlet.supportsRangeRequests()
protected com.atlassian.jira.web.servlet.CommonAttachment getCommonAttachment(String query)
Copyright © 2002-2019 Atlassian. All Rights Reserved.