org.apache.cocoon.servletservice
Interface ServletConnection

All Known Implementing Classes:
AbstractServletConnection

public interface ServletConnection

Contract to connect to a servlet service. The implementing classes differ from how they look up the servlet service.

This class was designed similar to URLConnection.

Since:
1.0.0
Version:
$Id: ServletConnection.java 637012 2008-03-14 07:29:12Z crossley $

Method Summary
 void connect()
          Connect to the servlet service.
 String getContentType()
          Get the mime-type of the servlet-service.
 InputStream getInputStream()
          Read the input stream from the servlet service response.
 long getLastModified()
          Get the last modification date of the servlet service.
 OutputStream getOutputStream()
          Get an output stream that writes as POST to this connection.
 int getResponseCode()
           
 URI getURI()
          Get a URI representing this servlet connection.
 void setIfModifiedSince(long ifmodifiedsince)
          Set the last modification date if you want to make use of caching.
 

Method Detail

setIfModifiedSince

public void setIfModifiedSince(long ifmodifiedsince)
Set the last modification date if you want to make use of caching. This method has to be called before any of the other methods of this interface is invoked.

Parameters:
ifmodifiedsince - The timestamp of the last known resource.

getOutputStream

public OutputStream getOutputStream()
Get an output stream that writes as POST to this connection.

Returns:
An output stream that writes as POST to this connection.

connect

public void connect()
             throws IOException,
                    ServletException
Connect to the servlet service. Establishing a connection means that the service is executed and the response is available.

Throws:
IOException - The connection to the servlet service can't be established.
ServletException - Any other problem when connecting to a servlet service.

getInputStream

public InputStream getInputStream()
                           throws IOException,
                                  ServletException
Read the input stream from the servlet service response.

Returns:
An input stream on the servlet service response.
Throws:
IOException - The connection to the servlet service can't be established.
ServletException - Any other problem when connecting to a servlet service.

getResponseCode

public int getResponseCode()
                    throws IOException
Returns:
The HTTP status code returned by the servlet service.
Throws:
IOException

getLastModified

public long getLastModified()
Get the last modification date of the servlet service.

Returns:
The last modification date of the servlet service.

getContentType

public String getContentType()
Get the mime-type of the servlet-service.

Returns:
The mime-type of the servlet-service.

getURI

public URI getURI()
Get a URI representing this servlet connection.

Returns:
a URI representing this servlet connection.


Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.