public class ViewAttachmentServlet extends AbstractViewFileServlet
AbstractViewFileServlet.JwtAttachmentPermissionExceptionIMAGE_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, isUserPermittedToViewAttachmentdoDelete, 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.setResponseContentHeaders(HttpServletRequest, Optional, HttpServletResponse)protected void getInputStream(javax.servlet.http.HttpServletRequest request,
String attachmentQuery,
InputStreamConsumer<io.atlassian.fugue.Unit> consumer)
throws IOException,
PermissionException
AbstractViewFileServletgetInputStream in class AbstractViewFileServletattachmentQuery - the attachment pathconsumer - a procedure that consumes the stream with the attachment data.IOException - if there is a problem getting the attachment.PermissionExceptionprotected void setResponseContentHeaders(javax.servlet.http.HttpServletRequest request,
Optional<RangeResponse> rangeResponse,
javax.servlet.http.HttpServletResponse response)
throws AttachmentNotFoundException,
IOException
setResponseContentHeaders in class AbstractViewFileServletrequest - HTTP requestrangeResponse - if we are doing a partial response this holds the range we will returnresponse - HTTP responseAttachmentNotFoundExceptionIOExceptionAbstractViewFileServlet.supportsRangeRequests()protected CommonAttachment getCommonAttachment(String query)
Copyright © 2002-2021 Atlassian. All Rights Reserved.