Package org.apache.jackrabbit.webdav
Class WebdavResponseImpl
- java.lang.Object
-
- org.apache.jackrabbit.webdav.WebdavResponseImpl
-
- All Implemented Interfaces:
javax.servlet.http.HttpServletResponse
,javax.servlet.ServletResponse
,DavServletResponse
,ObservationDavServletResponse
,WebdavResponse
public class WebdavResponseImpl extends Object implements WebdavResponse
WebdavResponseImpl implements theWebdavResponse
interface.
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.webdav.DavServletResponse
SC_FAILED_DEPENDENCY, SC_INSUFFICIENT_SPACE_ON_RESOURCE, SC_LOCKED, SC_MULTI_STATUS, SC_PROCESSING, SC_UNPROCESSABLE_ENTITY
-
Fields inherited from interface javax.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
-
-
Constructor Summary
Constructors Constructor Description WebdavResponseImpl(javax.servlet.http.HttpServletResponse httpResponse)
Create a newWebdavResponse
WebdavResponseImpl(javax.servlet.http.HttpServletResponse httpResponse, boolean noCache)
Create a newWebdavResponse
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCookie(javax.servlet.http.Cookie cookie)
void
addDateHeader(String s, long l)
void
addHeader(String s, String s1)
void
addIntHeader(String s, int i)
boolean
containsHeader(String s)
String
encodeRedirectUrl(String s)
String
encodeRedirectURL(String s)
String
encodeUrl(String s)
String
encodeURL(String s)
void
flushBuffer()
int
getBufferSize()
String
getCharacterEncoding()
String
getContentType()
String
getHeader(String name)
Collection<String>
getHeaderNames()
Collection<String>
getHeaders(String name)
Locale
getLocale()
javax.servlet.ServletOutputStream
getOutputStream()
int
getStatus()
Supplier<Map<String,String>>
getTrailerFields()
PrintWriter
getWriter()
boolean
isCommitted()
void
reset()
void
resetBuffer()
void
sendError(int i)
void
sendError(int i, String s)
void
sendError(DavException exception)
If the specifid exception provides an error condition an Xml response body is sent providing more detailed information about the error.void
sendMultiStatus(MultiStatus multistatus)
Send the multistatus response to the client.void
sendMultiStatus(MultiStatus multistatus, List<String> acceptableContentCodings)
Send the multistatus response to the client.void
sendPollResponse(EventDiscovery eventDiscovery)
Send the response to a successful POLL request.void
sendRedirect(String s)
void
sendRefreshLockResponse(ActiveLock[] locks)
Send response body for a lock request that was intended to refresh one or several locks.void
sendSubscriptionResponse(Subscription subscription)
Send the response to a successful SUBSCRIBE request.void
sendXmlResponse(XmlSerializable serializable, int status)
Generic method to return an Xml response body.void
sendXmlResponse(XmlSerializable serializable, int status, List<String> acceptableContentCodings)
Generic method to return an Xml response body.void
setBufferSize(int i)
void
setCharacterEncoding(String charset)
void
setContentLength(int i)
void
setContentLengthLong(long len)
void
setContentType(String s)
void
setDateHeader(String s, long l)
void
setHeader(String s, String s1)
void
setIntHeader(String s, int i)
void
setLocale(Locale locale)
void
setStatus(int i)
void
setStatus(int i, String s)
void
setTrailerFields(Supplier<Map<String,String>> supplier)
-
-
-
Constructor Detail
-
WebdavResponseImpl
public WebdavResponseImpl(javax.servlet.http.HttpServletResponse httpResponse)
Create a newWebdavResponse
- Parameters:
httpResponse
-
-
WebdavResponseImpl
public WebdavResponseImpl(javax.servlet.http.HttpServletResponse httpResponse, boolean noCache)
Create a newWebdavResponse
- Parameters:
httpResponse
-noCache
-
-
-
Method Detail
-
sendError
public void sendError(DavException exception) throws IOException
If the specifid exception provides an error condition an Xml response body is sent providing more detailed information about the error. Otherwise only the error code and status phrase is sent back.- Specified by:
sendError
in interfaceDavServletResponse
- Parameters:
exception
-- Throws:
IOException
- See Also:
DavServletResponse.sendError(org.apache.jackrabbit.webdav.DavException)
,sendError(int, String)
,sendXmlResponse(XmlSerializable, int)
-
sendMultiStatus
public void sendMultiStatus(MultiStatus multistatus) throws IOException
Description copied from interface:DavServletResponse
Send the multistatus response to the client. A multistatus response is returned in response to a successful PROPFIND and PROPPATCH request. In addition multistatus response is required response in case a COPY, MOVE, DELETE, LOCK or PROPPATCH request fails.- Specified by:
sendMultiStatus
in interfaceDavServletResponse
- Throws:
IOException
- See Also:
DavServletResponse.SC_MULTI_STATUS
-
sendMultiStatus
public void sendMultiStatus(MultiStatus multistatus, List<String> acceptableContentCodings) throws IOException
Description copied from interface:DavServletResponse
Send the multistatus response to the client. A multistatus response is returned in response to a successful PROPFIND and PROPPATCH request. In addition multistatus response is required response in case a COPY, MOVE, DELETE, LOCK or PROPPATCH request fails.- Specified by:
sendMultiStatus
in interfaceDavServletResponse
acceptableContentCodings
- content codings accepted by the client- Throws:
IOException
- See Also:
DavServletResponse.SC_MULTI_STATUS
-
sendRefreshLockResponse
public void sendRefreshLockResponse(ActiveLock[] locks) throws IOException
Send response body for a lock request that was intended to refresh one or several locks.- Specified by:
sendRefreshLockResponse
in interfaceDavServletResponse
- Parameters:
locks
-- Throws:
IOException
- See Also:
DavServletResponse.sendRefreshLockResponse(org.apache.jackrabbit.webdav.lock.ActiveLock[])
-
sendXmlResponse
public void sendXmlResponse(XmlSerializable serializable, int status) throws IOException
Description copied from interface:DavServletResponse
Generic method to return an Xml response body.- Specified by:
sendXmlResponse
in interfaceDavServletResponse
- Parameters:
serializable
- object that can be converted to the root Xml element of the document to be sent as response body.status
- Status code to be used withHttpServletResponse.setStatus(int)
.- Throws:
IOException
-
sendXmlResponse
public void sendXmlResponse(XmlSerializable serializable, int status, List<String> acceptableContentCodings) throws IOException
Description copied from interface:DavServletResponse
Generic method to return an Xml response body.- Specified by:
sendXmlResponse
in interfaceDavServletResponse
- Parameters:
serializable
- object that can be converted to the root Xml element of the document to be sent as response body.status
- Status code to be used withHttpServletResponse.setStatus(int)
.acceptableContentCodings
- content codings accepted by the client- Throws:
IOException
-
sendSubscriptionResponse
public void sendSubscriptionResponse(Subscription subscription) throws IOException
Description copied from interface:ObservationDavServletResponse
Send the response to a successful SUBSCRIBE request.- Specified by:
sendSubscriptionResponse
in interfaceObservationDavServletResponse
- Parameters:
subscription
-- Throws:
IOException
- See Also:
ObservationDavServletResponse.sendSubscriptionResponse(org.apache.jackrabbit.webdav.observation.Subscription)
-
sendPollResponse
public void sendPollResponse(EventDiscovery eventDiscovery) throws IOException
Description copied from interface:ObservationDavServletResponse
Send the response to a successful POLL request.- Specified by:
sendPollResponse
in interfaceObservationDavServletResponse
- Parameters:
eventDiscovery
-- Throws:
IOException
- See Also:
ObservationDavServletResponse.sendPollResponse(org.apache.jackrabbit.webdav.observation.EventDiscovery)
-
addCookie
public void addCookie(javax.servlet.http.Cookie cookie)
- Specified by:
addCookie
in interfacejavax.servlet.http.HttpServletResponse
-
containsHeader
public boolean containsHeader(String s)
- Specified by:
containsHeader
in interfacejavax.servlet.http.HttpServletResponse
-
encodeURL
public String encodeURL(String s)
- Specified by:
encodeURL
in interfacejavax.servlet.http.HttpServletResponse
-
encodeRedirectURL
public String encodeRedirectURL(String s)
- Specified by:
encodeRedirectURL
in interfacejavax.servlet.http.HttpServletResponse
-
encodeUrl
public String encodeUrl(String s)
- Specified by:
encodeUrl
in interfacejavax.servlet.http.HttpServletResponse
-
encodeRedirectUrl
public String encodeRedirectUrl(String s)
- Specified by:
encodeRedirectUrl
in interfacejavax.servlet.http.HttpServletResponse
-
sendError
public void sendError(int i, String s) throws IOException
- Specified by:
sendError
in interfacejavax.servlet.http.HttpServletResponse
- Throws:
IOException
-
sendError
public void sendError(int i) throws IOException
- Specified by:
sendError
in interfacejavax.servlet.http.HttpServletResponse
- Throws:
IOException
-
sendRedirect
public void sendRedirect(String s) throws IOException
- Specified by:
sendRedirect
in interfacejavax.servlet.http.HttpServletResponse
- Throws:
IOException
-
setDateHeader
public void setDateHeader(String s, long l)
- Specified by:
setDateHeader
in interfacejavax.servlet.http.HttpServletResponse
-
addDateHeader
public void addDateHeader(String s, long l)
- Specified by:
addDateHeader
in interfacejavax.servlet.http.HttpServletResponse
-
setHeader
public void setHeader(String s, String s1)
- Specified by:
setHeader
in interfacejavax.servlet.http.HttpServletResponse
-
addHeader
public void addHeader(String s, String s1)
- Specified by:
addHeader
in interfacejavax.servlet.http.HttpServletResponse
-
setIntHeader
public void setIntHeader(String s, int i)
- Specified by:
setIntHeader
in interfacejavax.servlet.http.HttpServletResponse
-
addIntHeader
public void addIntHeader(String s, int i)
- Specified by:
addIntHeader
in interfacejavax.servlet.http.HttpServletResponse
-
setStatus
public void setStatus(int i)
- Specified by:
setStatus
in interfacejavax.servlet.http.HttpServletResponse
-
setStatus
public void setStatus(int i, String s)
- Specified by:
setStatus
in interfacejavax.servlet.http.HttpServletResponse
-
getCharacterEncoding
public String getCharacterEncoding()
- Specified by:
getCharacterEncoding
in interfacejavax.servlet.ServletResponse
-
getOutputStream
public javax.servlet.ServletOutputStream getOutputStream() throws IOException
- Specified by:
getOutputStream
in interfacejavax.servlet.ServletResponse
- Throws:
IOException
-
getWriter
public PrintWriter getWriter() throws IOException
- Specified by:
getWriter
in interfacejavax.servlet.ServletResponse
- Throws:
IOException
-
setContentLength
public void setContentLength(int i)
- Specified by:
setContentLength
in interfacejavax.servlet.ServletResponse
-
setContentType
public void setContentType(String s)
- Specified by:
setContentType
in interfacejavax.servlet.ServletResponse
-
setBufferSize
public void setBufferSize(int i)
- Specified by:
setBufferSize
in interfacejavax.servlet.ServletResponse
-
getBufferSize
public int getBufferSize()
- Specified by:
getBufferSize
in interfacejavax.servlet.ServletResponse
-
flushBuffer
public void flushBuffer() throws IOException
- Specified by:
flushBuffer
in interfacejavax.servlet.ServletResponse
- Throws:
IOException
-
resetBuffer
public void resetBuffer()
- Specified by:
resetBuffer
in interfacejavax.servlet.ServletResponse
-
isCommitted
public boolean isCommitted()
- Specified by:
isCommitted
in interfacejavax.servlet.ServletResponse
-
reset
public void reset()
- Specified by:
reset
in interfacejavax.servlet.ServletResponse
-
setLocale
public void setLocale(Locale locale)
- Specified by:
setLocale
in interfacejavax.servlet.ServletResponse
-
getLocale
public Locale getLocale()
- Specified by:
getLocale
in interfacejavax.servlet.ServletResponse
-
getContentType
public String getContentType()
- Specified by:
getContentType
in interfacejavax.servlet.ServletResponse
-
setCharacterEncoding
public void setCharacterEncoding(String charset)
- Specified by:
setCharacterEncoding
in interfacejavax.servlet.ServletResponse
-
getStatus
public int getStatus()
- Specified by:
getStatus
in interfacejavax.servlet.http.HttpServletResponse
-
getHeader
public String getHeader(String name)
- Specified by:
getHeader
in interfacejavax.servlet.http.HttpServletResponse
-
getHeaders
public Collection<String> getHeaders(String name)
- Specified by:
getHeaders
in interfacejavax.servlet.http.HttpServletResponse
-
getHeaderNames
public Collection<String> getHeaderNames()
- Specified by:
getHeaderNames
in interfacejavax.servlet.http.HttpServletResponse
-
setContentLengthLong
public void setContentLengthLong(long len)
- Specified by:
setContentLengthLong
in interfacejavax.servlet.ServletResponse
-
setTrailerFields
public void setTrailerFields(Supplier<Map<String,String>> supplier)
- Specified by:
setTrailerFields
in interfaceWebdavResponse
-
getTrailerFields
public Supplier<Map<String,String>> getTrailerFields()
- Specified by:
getTrailerFields
in interfaceWebdavResponse
-
-