public class ViewThumbnailServlet extends AbstractViewFileServlet
Constructor and Description |
---|
ViewThumbnailServlet() |
Modifier and Type | Method and Description |
---|---|
protected int |
getContentLength(String attachmentPath) |
protected void |
getInputStream(String attachmentPath,
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 attachment 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 attachmentPath, InputStreamConsumer<io.atlassian.fugue.Unit> consumer) throws IOException, PermissionException
AbstractViewFileServlet
getInputStream
in class AbstractViewFileServlet
attachmentPath
- the attachment pathconsumer
- a procedure that consumes the stream with the attachment data.IOException
- if there is a problem getting the attachment.PermissionException
- if the user has insufficient permission to see 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)
AbstractViewFileServlet
The rangeResponse parameter will only be present if this Concrete class declares it supports Range Requests, and the request actually contains a Range header.
setResponseHeaders
in class AbstractViewFileServlet
request
- HTTP requestrangeResponse
- If present, the partial byte range we will returnresponse
- HTTP responseAbstractViewFileServlet.supportsRangeRequests()
Copyright © 2002-2019 Atlassian. All Rights Reserved.