Class ViewAttachmentServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.atlassian.jira.web.servlet.viewfile.AbstractViewFileServlet
com.atlassian.jira.web.servlet.viewfile.ViewAttachmentServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
- Direct Known Subclasses:
ViewTemporaryAttachmentServlet
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.atlassian.jira.web.servlet.viewfile.AbstractViewFileServlet
AbstractViewFileServlet.JwtAttachmentPermissionException -
Field Summary
Fields inherited from class com.atlassian.jira.web.servlet.viewfile.AbstractViewFileServlet
IMAGE_ATTACHMENT_JWT_TOKEN_QUERY_PARAM_NAME, IMAGE_DISPLAYING_CANNOT_DISPLAY_IMAGE_PATHFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CommonAttachmentgetCommonAttachment(String query) protected intgetContentLength(String attachmentPath) protected voidgetInputStream(jakarta.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 voidsetResponseContentHeaders(jakarta.servlet.http.HttpServletRequest request, Optional<RangeResponse> rangeResponse, jakarta.servlet.http.HttpServletResponse response, Optional<Long> contentLength) Sets the content type, content length and "Content-Disposition" header of the response based on the values of the attachment found.protected booleanReturns true if this implementation supports RFC 7233 "Range Requests".Methods inherited from class com.atlassian.jira.web.servlet.viewfile.AbstractViewFileServlet
attachmentQuery, checkRequesterIsPermittedToViewTheAttachment, copyRange, doGet, getAttachment, getAttachmentManager, getLoggedInUser, isAnonymousUserPermittedToViewAttachment, isImageAttachmentJwtTokenPresent, isJwtTokenUserPermittedToViewAttachment_andSendAnalyticsEvent, isLoggedInUserPermittedToViewAttachment, isUserLoggedIn, isUserPermittedToViewAttachmentMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
ViewAttachmentServlet
public ViewAttachmentServlet()
-
-
Method Details
-
getContentLength
- Specified by:
getContentLengthin classAbstractViewFileServlet
-
supportsRangeRequests
protected boolean supportsRangeRequests()Description copied from class:AbstractViewFileServletReturns true if this implementation supports RFC 7233 "Range Requests".Returning true means that you must set the appropriate "Content-Range" and "Content-Length" headers for the partial range we will return in the
#setResponseHeadersimplementation.- Specified by:
supportsRangeRequestsin classAbstractViewFileServlet- Returns:
- true if this servlet supports RFC 7233 "Range Requests".
-
getInputStream
protected void getInputStream(jakarta.servlet.http.HttpServletRequest request, String attachmentQuery, InputStreamConsumer<io.atlassian.fugue.Unit> consumer) throws IOException, PermissionException Description copied from class:AbstractViewFileServletGets the attachment file (not the file name) that corresponds to the requested attachment.- Specified by:
getInputStreamin classAbstractViewFileServlet- Parameters:
attachmentQuery- the attachment pathconsumer- a procedure that consumes the stream with the attachment data.- Throws:
IOException- if there is a problem getting the attachment.PermissionException
-
setResponseContentHeaders
protected void setResponseContentHeaders(jakarta.servlet.http.HttpServletRequest request, Optional<RangeResponse> rangeResponse, jakarta.servlet.http.HttpServletResponse response, Optional<Long> contentLength) Sets the content type, content length and "Content-Disposition" header of the response based on the values of the attachment found.- Specified by:
setResponseContentHeadersin classAbstractViewFileServlet- Parameters:
request- HTTP requestrangeResponse- if we are doing a partial response this holds the range we will returnresponse- HTTP responsecontentLength- the length of the content we are returning in bytes, if known- Throws:
AttachmentNotFoundException- if the specified attachment cannot be foundDataAccessException- if there is a problem accessing the database.- See Also:
-
getCommonAttachment
-