org.activemath.webapp.ws
Interface ResourceHandler

All Known Implementing Classes:
BookListResource, DelegationGuide.GuideService, SietteCallback

public interface ResourceHandler

An interface to describe an object that can provide a representation of itself as a resource. Objects of this kind could be thought of as documents which can be read using the resource-representation as well as objects whose methods can be invoked when used by XmlRpcServiceServlet.


Method Summary
 int getLength()
          To populate the Content-Length header.
 String getMimeTypeChosen(Iterator acceptedMimeType)
          Chooses the appropriate mime-type from the list provided.
 long getModificationDate()
          To be returned to answer such queries as HTTP HEAD queries.
 void outputRepresentation(OutputStream response, String mimeTypes)
          Outputs content a descriptive state representation in the mime-type it recognizes as appropriate.
 

Method Detail

outputRepresentation

void outputRepresentation(OutputStream response,
                          String mimeTypes)
                          throws IOException
Outputs content a descriptive state representation in the mime-type it recognizes as appropriate.

Parameters:
response - the response to output to, the content-length, content-type and other headers should first be set.
mimeTypes - the list of mime-types as received by the Accept-Type http header.
Throws:
IOException

getMimeTypeChosen

String getMimeTypeChosen(Iterator acceptedMimeType)
Chooses the appropriate mime-type from the list provided. This call is expected to be followed by a call to outputRepresentation(java.io.OutputStream, java.lang.String).

Parameters:
acceptedMimeType - an iterator of mime-types (such as text/plain possbly followed by a semicolon with a quality value)
Returns:
the chosen mime-type

getModificationDate

long getModificationDate()
To be returned to answer such queries as HTTP HEAD queries.

Returns:
the expected last-modification date or -1 if it is not known in which case, one assumes it was modified instantenously

getLength

int getLength()
To populate the Content-Length header.

Returns:
the length if known or -1 if unknown