|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.servletservice.AbstractServletConnection
public abstract class AbstractServletConnection
Nested Class Summary | |
---|---|
protected static class |
AbstractServletConnection.NoServletContextAvailableException
A special exception indicating that there is no servlet context available. |
Field Summary | |
---|---|
protected boolean |
connected
If already connected |
protected javax.servlet.ServletContext |
context
The current block context |
protected org.apache.commons.logging.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 Summary | |
---|---|
AbstractServletConnection()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.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
Constructor Detail |
---|
public AbstractServletConnection()
Method Detail |
---|
public void connect() throws IOException, javax.servlet.ServletException
ServletConnection
connect
in interface ServletConnection
IOException
- 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.ServletException
IOException
public InputStream getInputStream() throws IOException, javax.servlet.ServletException
InputStream
object to read from the source.
getInputStream
in interface ServletConnection
IOException
javax.servlet.ServletException
public void setIfModifiedSince(long ifmodifiedsince)
ServletConnection
setIfModifiedSince
in interface ServletConnection
ifmodifiedsince
- The timestamp of the last known resource.public long getLastModified()
ServletConnection
getLastModified
in interface ServletConnection
public String getContentType()
ServletConnection
getContentType
in interface ServletConnection
public long getDateHeader(String name, long defaultValue)
public String getHeaderField(String name)
ServletConnection
getHeaderField
in interface ServletConnection
name
- The name of the header parameter
public long getHeaderFieldDate(String name, long defaultValue)
public Map getHeaders()
ServletConnection
getHeaders
in interface ServletConnection
Map
that contains all response headers.public int getResponseCode() throws IOException
getResponseCode
in interface ServletConnection
IOException
public OutputStream getOutputStream() throws IllegalStateException
getOutputStream
in interface ServletConnection
IllegalStateException
- - if already connectedpublic URI getURI()
ServletConnection
getURI
in interface ServletConnection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |