public abstract class AbstractServletConnection extends Object implements ServletConnection
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractServletConnection.NoServletContextAvailableException
A special exception indicating that there is no servlet context available.
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
connected
If already connected
|
protected javax.servlet.ServletContext |
context
The current block context
|
protected Log |
logger
By default we use the logger for this class.
|
protected ServletServiceRequest |
request
Connection request
|
protected ByteArrayOutputStream |
requestBody |
protected ServletServiceResponse |
response
Connection response
|
protected InputStream |
responseBody |
protected URI |
uri |
| Constructor and Description |
|---|
AbstractServletConnection() |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connect to the servlet service.
|
String |
getContentType()
Get the mime-type of the servlet-service.
|
long |
getDateHeader(String name,
long defaultValue) |
String |
getHeaderField(String name)
Get a response header with the given name.
|
long |
getHeaderFieldDate(String name,
long defaultValue) |
Map |
getHeaders()
Get all response header fields.
|
InputStream |
getInputStream()
Return an
InputStream object to read from the source. |
long |
getLastModified()
Get the last modification date of the servlet service.
|
OutputStream |
getOutputStream()
Returns an output stream that writes as POST to this connection.
|
int |
getResponseCode() |
URI |
getURI()
Get a URI representing this servlet connection.
|
protected abstract void |
performConnect()
Access the servlet and fill the response object.
|
void |
setIfModifiedSince(long ifmodifiedsince)
Set the last modification date if you want to make use of caching.
|
protected final Log logger
protected ServletServiceRequest request
protected ServletServiceResponse response
protected javax.servlet.ServletContext context
protected boolean connected
protected ByteArrayOutputStream requestBody
protected InputStream responseBody
protected URI uri
public void connect()
throws IOException,
javax.servlet.ServletException
ServletConnectionconnect in interface ServletConnectionIOException - The connection to the servlet service can't be established.javax.servlet.ServletException - Any other problem when connecting to a servlet service.protected abstract void performConnect()
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionpublic InputStream getInputStream() throws IOException, javax.servlet.ServletException
InputStream object to read from the source.getInputStream in interface ServletConnectionIOExceptionjavax.servlet.ServletExceptionpublic void setIfModifiedSince(long ifmodifiedsince)
ServletConnectionsetIfModifiedSince in interface ServletConnectionifmodifiedsince - The timestamp of the last known resource.public long getLastModified()
ServletConnectiongetLastModified in interface ServletConnectionpublic String getContentType()
ServletConnectiongetContentType in interface ServletConnectionpublic long getDateHeader(String name, long defaultValue)
public String getHeaderField(String name)
ServletConnectiongetHeaderField in interface ServletConnectionname - The name of the header parameterpublic long getHeaderFieldDate(String name, long defaultValue)
public Map getHeaders()
ServletConnectiongetHeaders in interface ServletConnectionMap that contains all response headers.public int getResponseCode()
throws IOException
getResponseCode in interface ServletConnectionIOExceptionpublic OutputStream getOutputStream() throws IllegalStateException
getOutputStream in interface ServletConnectionIllegalStateException - - if already connectedpublic URI getURI()
ServletConnectiongetURI in interface ServletConnectionCopyright © 1999-2012 The Apache Software Foundation. All Rights Reserved.