public class RepositoryHttpServlet
extends HttpServlet
Modifier and Type | Class and Description |
---|---|
protected static class |
RepositoryHttpServlet.Range |
Modifier and Type | Field and Description |
---|---|
protected int |
debug
The debugging detail level for this servlet.
|
protected static int |
FILE_BUFFER_SIZE
Size of file transfer buffer in bytes.
|
protected static java.util.List<RepositoryHttpServlet.Range> |
FULL
Full range constant.
|
protected static java.lang.String |
MIME_SEPARATION
MIME multipart separation string.
|
protected RepositoryHttpManager |
repoHttpManager
RepoItemHttpElems.
|
Constructor and Description |
---|
RepositoryHttpServlet() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkIfHeaders(HttpServletRequest request,
HttpServletResponse response,
RepositoryItemAttributes resourceAttributes)
Check if the conditions specified in the optional If headers are satisfied.
|
protected boolean |
checkIfMatch(HttpServletRequest request,
HttpServletResponse response,
RepositoryItemAttributes resourceAttributes)
Check if the if-match condition is satisfied.
|
protected boolean |
checkIfModifiedSince(HttpServletRequest request,
HttpServletResponse response,
RepositoryItemAttributes resourceAttributes)
Check if the if-modified-since condition is satisfied.
|
protected boolean |
checkIfNoneMatch(HttpServletRequest request,
HttpServletResponse response,
RepositoryItemAttributes resourceAttributes)
Check if the if-none-match condition is satisfied.
|
protected boolean |
checkIfUnmodifiedSince(HttpServletRequest request,
HttpServletResponse response,
RepositoryItemAttributes resourceAttributes)
Check if the if-unmodified-since condition is satisfied.
|
protected void |
copy(RepositoryHttpEndpointImpl repoItemHttpElem,
HttpServletResponse response)
Copy the contents of the specified input stream to the specified output stream, and ensure that
both streams are closed before returning (even in the face of an exception).
|
protected void |
copy(RepositoryHttpEndpointImpl repoItemHttpElem,
HttpServletResponse response,
java.util.List<RepositoryHttpServlet.Range> ranges,
java.lang.String contentType)
Copy the contents of the specified input stream to the specified output stream, and ensure that
both streams are closed before returning (even in the face of an exception).
|
protected void |
copy(RepositoryHttpEndpointImpl repoItemHttpElem,
HttpServletResponse response,
RepositoryHttpServlet.Range range)
Copy the contents of the specified input stream to the specified output stream, and ensure that
both streams are closed before returning (even in the face of an exception).
|
protected java.io.IOException |
copyStreams(java.io.InputStream istream,
java.io.OutputStream ostream)
Copy the contents of the specified input stream to the specified output stream, and ensure that
both streams are closed before returning (even in the face of an exception).
|
protected java.io.IOException |
copyStreamsRange(java.io.InputStream istream,
java.io.OutputStream ostream,
RepositoryHttpServlet.Range range)
Copy the contents of the specified input stream to the specified output stream, and ensure that
both streams are closed before returning (even in the face of an exception).
|
void |
destroy()
Finalize this servlet.
|
protected void |
doGet(HttpServletRequest request,
HttpServletResponse response)
Process a GET request for the specified resource.
|
protected void |
doHead(HttpServletRequest request,
HttpServletResponse response)
Process a HEAD request for the specified resource.
|
protected void |
doOptions(HttpServletRequest req,
HttpServletResponse resp)
Override default implementation to ensure that TRACE is correctly handled.
|
protected void |
doPost(HttpServletRequest request,
HttpServletResponse response)
Process a POST request for the specified resource.
|
protected void |
doPut(HttpServletRequest req,
HttpServletResponse resp)
Process a PUT request for the specified resource.
|
protected java.io.File |
executePartialPut(HttpServletRequest req,
RepositoryHttpServlet.Range range,
java.lang.String sessionId)
Handle a partial PUT.
|
protected java.lang.String |
extractSessionId(HttpServletRequest request)
Return the sessionId from the request.
|
void |
init(ServletConfig servletConfig)
Initialize this servlet.
|
protected RepositoryHttpServlet.Range |
parseContentRange(HttpServletRequest request,
HttpServletResponse response)
Parse the content-range header.
|
protected java.util.List<RepositoryHttpServlet.Range> |
parseRange(HttpServletRequest request,
HttpServletResponse response,
RepositoryItemAttributes resourceAttributes)
Parse the range header.
|
protected void |
serveResource(HttpServletRequest request,
HttpServletResponse response,
boolean content)
Serve the specified resource, optionally including the data content.
|
protected void |
service(HttpServletRequest req,
HttpServletResponse resp) |
protected void |
uploadContent(HttpServletRequest req,
HttpServletResponse resp) |
protected static final java.util.List<RepositoryHttpServlet.Range> FULL
protected static final java.lang.String MIME_SEPARATION
protected static final int FILE_BUFFER_SIZE
protected int debug
protected transient RepositoryHttpManager repoHttpManager
public void destroy()
public void init(ServletConfig servletConfig) throws ServletException
ServletException
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
ServletException
java.io.IOException
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
req
- the HttpServletRequest
object that contains the request the client made of the
servletresp
- the HttpServletResponse
object that contains the response the servlet returns
to the clientjava.io.IOException
- if an input or output error occurs while the servlet is handling the OPTIONS
requestServletException
- if the request for the OPTIONS cannot be handledprotected void doHead(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException
request
- The servlet request we are processingresponse
- The servlet response we are creatingjava.io.IOException
- if an input/output error occursServletException
- if a servlet-specified error occursprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException
request
- The servlet request we are processingresponse
- The servlet response we are creatingjava.io.IOException
- if an input/output error occursServletException
- if a servlet-specified error occursprotected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
req
- The servlet request we are processingresp
- The servlet response we are creatingjava.io.IOException
- if an input/output error occursServletException
- if a servlet-specified error occursprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException
request
- The servlet request we are processingresponse
- The servlet response we are creatingjava.io.IOException
- if an input/output error occursServletException
- if a servlet-specified error occursprotected void uploadContent(HttpServletRequest req, HttpServletResponse resp) throws java.io.IOException
java.io.IOException
protected java.lang.String extractSessionId(HttpServletRequest request)
request
- The servlet request we are processingprotected java.io.File executePartialPut(HttpServletRequest req, RepositoryHttpServlet.Range range, java.lang.String sessionId) throws java.io.IOException
java.io.IOException
protected boolean checkIfHeaders(HttpServletRequest request, HttpServletResponse response, RepositoryItemAttributes resourceAttributes) throws java.io.IOException
request
- The servlet request we are processingresponse
- The servlet response we are creatingresourceAttributes
- The resource informationjava.io.IOException
protected void serveResource(HttpServletRequest request, HttpServletResponse response, boolean content) throws java.io.IOException, ServletException
request
- The servlet request we are processingresponse
- The servlet response we are creatingcontent
- Should the content be included?java.io.IOException
- if an input/output error occursServletException
- if a servlet-specified error occursprotected RepositoryHttpServlet.Range parseContentRange(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException
request
- The servlet request we are processingresponse
- The servlet response we are creatingjava.io.IOException
protected java.util.List<RepositoryHttpServlet.Range> parseRange(HttpServletRequest request, HttpServletResponse response, RepositoryItemAttributes resourceAttributes) throws java.io.IOException
request
- The servlet request we are processingresponse
- The servlet response we are creatingjava.io.IOException
protected boolean checkIfMatch(HttpServletRequest request, HttpServletResponse response, RepositoryItemAttributes resourceAttributes) throws java.io.IOException
request
- The servlet request we are processingresponse
- The servlet response we are creatingresourceAttributes
- File objectjava.io.IOException
protected boolean checkIfModifiedSince(HttpServletRequest request, HttpServletResponse response, RepositoryItemAttributes resourceAttributes)
request
- The servlet request we are processingresponse
- The servlet response we are creatingresourceAttributes
- File objectprotected boolean checkIfNoneMatch(HttpServletRequest request, HttpServletResponse response, RepositoryItemAttributes resourceAttributes) throws java.io.IOException
request
- The servlet request we are processingresponse
- The servlet response we are creatingresourceAttributes
- File objectjava.io.IOException
protected boolean checkIfUnmodifiedSince(HttpServletRequest request, HttpServletResponse response, RepositoryItemAttributes resourceAttributes) throws java.io.IOException
request
- The servlet request we are processingresponse
- The servlet response we are creatingresourceAttributes
- File objectjava.io.IOException
protected void copy(RepositoryHttpEndpointImpl repoItemHttpElem, HttpServletResponse response) throws java.io.IOException
repoItemHttpElem
- The cache entry for the source resourceresponse
- The HttpResponse where the resource will be copiedjava.io.IOException
- if an input/output error occursprotected void copy(RepositoryHttpEndpointImpl repoItemHttpElem, HttpServletResponse response, RepositoryHttpServlet.Range range) throws java.io.IOException
repoItemHttpElem
- The cache entry for the source resourceresponse
- The response we are writing torange
- Range asked by the clientjava.io.IOException
- if an input/output error occursprotected void copy(RepositoryHttpEndpointImpl repoItemHttpElem, HttpServletResponse response, java.util.List<RepositoryHttpServlet.Range> ranges, java.lang.String contentType) throws java.io.IOException
repoItemHttpElem
- The cache entry for the source resourceresponse
- The response we are writing toranges
- Enumeration of the ranges the client wanted to retrievecontentType
- Content type of the resourcejava.io.IOException
- if an input/output error occursprotected java.io.IOException copyStreams(java.io.InputStream istream, java.io.OutputStream ostream)
istream
- The input stream to read fromostream
- The output stream to write toprotected java.io.IOException copyStreamsRange(java.io.InputStream istream, java.io.OutputStream ostream, RepositoryHttpServlet.Range range)
istream
- The input stream to read fromostream
- The output stream to write torange
- Range we are copying