org.ws4d.java.communication
Interface Resource

All Known Implementing Classes:
Schema, WSDL

public interface Resource

This is the interface for resources which can be deployed by a given communication manager.

Every implementation of this interface should return correct values for content type and size.

If it is not possible to determinate the content type of the resource, the getContentType() method should return at least the application/octet-stream content type.


Method Summary
 InternetMediaType getContentType()
          Returns the content type of this resource.
 HashMap getHeaderFields()
          Returns additional header fields for this resource.
 long getLastModifiedDate()
          Returns the last time where this resource was modified as UNIX timestamp.
 void serialize(URI request, RequestHeader requestHeader, java.io.InputStream requestBody, java.io.OutputStream out)
          Serializes this resource to the given output stream out.
 java.lang.String shortDescription()
          A short string representation of this resource.
 long size()
          The size of the resource.
 

Method Detail

getContentType

InternetMediaType getContentType()
Returns the content type of this resource.

If it is not possible to determinate the content type of the resource, the getContentType() method should return at least the application/octet-stream content type.

Returns:
the content type of this resource.

serialize

void serialize(URI request,
               RequestHeader requestHeader,
               java.io.InputStream requestBody,
               java.io.OutputStream out)
               throws java.io.IOException
Serializes this resource to the given output stream out.

Parameters:
request - the request URI
requestHeader - the header of the request
requestBody - makes the content of the request body available
out - the outputs stream to serialize this resource over
Throws:
java.io.IOException - if an IO failure occurs during serialization

getHeaderFields

HashMap getHeaderFields()
Returns additional header fields for this resource.

The additional header fields allow to add header fields to the response which will be created to send this resource.

NOTICE: The map must contain a String, String mapping.

Returns:
a map which contains the header=>value mapping.

size

long size()
The size of the resource.

If it is not possible to determinate the size of the resource. The implementation should return -1. This will allow to send the resource as chunked content.

Returns:
the size of the resource.

getLastModifiedDate

long getLastModifiedDate()
Returns the last time where this resource was modified as UNIX timestamp.

Returns:
last time where this resource was modified.

shortDescription

java.lang.String shortDescription()
A short string representation of this resource.

Returns:
a short string representation.