public class ViewAttachmentServlet extends AbstractViewFileServlet
AbstractViewFileServlet.JwtAttachmentPermissionException
IMAGE_ATTACHMENT_JWT_TOKEN_QUERY_PARAM_NAME, IMAGE_DISPLAYING_CANNOT_DISPLAY_IMAGE_PATH
Constructor and Description |
---|
ViewAttachmentServlet() |
Modifier and Type | Method and Description |
---|---|
protected CommonAttachment |
getCommonAttachment(String query) |
protected int |
getContentLength(String attachmentPath) |
protected void |
getInputStream(javax.servlet.http.HttpServletRequest request,
String attachmentQuery,
InputStreamConsumer<io.atlassian.fugue.Unit> consumer)
Gets the attachment file (not the file name) that corresponds to the requested attachment.
|
protected void |
setResponseContentHeaders(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 attachment found.
|
protected boolean |
supportsRangeRequests()
Returns true if this implementation supports RFC 7233 "Range Requests".
|
attachmentQuery, checkRequesterIsPermittedToViewTheAttachment, copyRange, doGet, getAttachment, getAttachmentManager, getLoggedInUser, isAnonymousUserPermittedToViewAttachment, isImageAttachmentJwtTokenPresent, isJwtTokenUserPermittedToViewAttachment_andSendAnalyticsEvent, isLoggedInUserPermittedToViewAttachment, isUserLoggedIn, isUserPermittedToViewAttachment
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.setResponseContentHeaders(HttpServletRequest, Optional, HttpServletResponse)
protected void getInputStream(javax.servlet.http.HttpServletRequest request, String attachmentQuery, InputStreamConsumer<io.atlassian.fugue.Unit> consumer) throws IOException, PermissionException
AbstractViewFileServlet
getInputStream
in class AbstractViewFileServlet
attachmentQuery
- the attachment pathconsumer
- a procedure that consumes the stream with the attachment data.IOException
- if there is a problem getting the attachment.PermissionException
protected void setResponseContentHeaders(javax.servlet.http.HttpServletRequest request, Optional<RangeResponse> rangeResponse, javax.servlet.http.HttpServletResponse response) throws AttachmentNotFoundException, IOException
setResponseContentHeaders
in class AbstractViewFileServlet
request
- HTTP requestrangeResponse
- if we are doing a partial response this holds the range we will returnresponse
- HTTP responseAttachmentNotFoundException
IOException
AbstractViewFileServlet.supportsRangeRequests()
protected CommonAttachment getCommonAttachment(String query)
Copyright © 2002-2022 Atlassian. All Rights Reserved.
View cookie preferences