fedora.server.access
Class FedoraAccessServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byfedora.server.access.FedoraAccessServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class FedoraAccessServlet
extends javax.servlet.http.HttpServlet

Title: FedoraAccessServlet.java

Description: Implements the three methods GetObjectProfile, GetDissemination, and GetDatastreamDissemination of the Fedora Access LITE (API-A-LITE) interface using a java servlet front end. The syntax defined by API-A-LITE defines three bindings for these methods:

  1. GetDissemination URL syntax:

    protocol://hostname:port/fedora/get/PID/bDefPID/methodName[/dateTime][?parmArray]

    This syntax requests a dissemination of the specified object using the specified method of the associated behavior definition object. The result is returned as a MIME-typed stream.

  2. GetObjectProfile URL syntax:

    protocol://hostname:port/fedora/get/PID[/dateTime][?xml=BOOLEAN]

    This syntax requests an object profile for the specified digital object. The xml parameter determines the type of output returned. If the parameter is omitted or has a value of "false", a MIME-typed stream consisting of an html table is returned providing a browser-savvy means of viewing the object profile. If the value specified is "true", then a MIME-typed stream consisting of XML is returned.

  3. GetDatastreamDissemination URL syntax:

    protocol://hostname:port/fedora/get/PID/DSID[/dateTime]

    This syntax requests a datastream dissemination for the specified digital object. It is used to return the contents of a datastream.

Version:
$Id: FedoraAccessServlet.java,v 1.109 2005/08/16 17:24:53 cwilper Exp $
Author:
rlw@virginia.edu
See Also:
Serialized Form

Nested Class Summary
 class FedoraAccessServlet.ProfileSerializerThread
           A Thread to serialize an ObjectProfile object into XML.
 
Field Summary
 Logger logger
          Instance of Logger to log servlet events in Fedora server log
 
Constructor Summary
FedoraAccessServlet()
           
 
Method Summary
 void destroy()
          Cleans up servlet resources.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process Fedora Access Request.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          For now, treat a HTTP POST request just like a GET request.
 void getDatastreamDissemination(Context context, java.lang.String PID, java.lang.String dsID, java.util.Date asOfDateTime, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request)
           
 void getDissemination(Context context, java.lang.String PID, java.lang.String bDefPID, java.lang.String methodName, Property[] userParms, java.util.Date asOfDateTime, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request)
          This method calls the Fedora Access Subsystem to retrieve a MIME-typed stream corresponding to the dissemination request.
 void getObjectProfile(Context context, java.lang.String PID, java.util.Date asOfDateTime, boolean xml, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void init()
          Initialize servlet.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public Logger logger
Instance of Logger to log servlet events in Fedora server log

Constructor Detail

FedoraAccessServlet

public FedoraAccessServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException

Process Fedora Access Request. Parse and validate the servlet input parameters and then execute the specified request.

Parameters:
request - The servlet request.
response - servlet The servlet response.
Throws:
javax.servlet.ServletException - If an error occurs that effects the servlet's basic operation.
java.io.IOException - If an error occurrs with an input or output operation.

getObjectProfile

public void getObjectProfile(Context context,
                             java.lang.String PID,
                             java.util.Date asOfDateTime,
                             boolean xml,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws ServerException
Throws:
ServerException

getDatastreamDissemination

public void getDatastreamDissemination(Context context,
                                       java.lang.String PID,
                                       java.lang.String dsID,
                                       java.util.Date asOfDateTime,
                                       javax.servlet.http.HttpServletResponse response,
                                       javax.servlet.http.HttpServletRequest request)
                                throws java.io.IOException,
                                       ServerException
Throws:
java.io.IOException
ServerException

getDissemination

public void getDissemination(Context context,
                             java.lang.String PID,
                             java.lang.String bDefPID,
                             java.lang.String methodName,
                             Property[] userParms,
                             java.util.Date asOfDateTime,
                             javax.servlet.http.HttpServletResponse response,
                             javax.servlet.http.HttpServletRequest request)
                      throws java.io.IOException,
                             ServerException

This method calls the Fedora Access Subsystem to retrieve a MIME-typed stream corresponding to the dissemination request.

Parameters:
context - The read only context of the request.
PID - The persistent identifier of the Digital Object.
bDefPID - The persistent identifier of the Behavior Definition object.
methodName - The method name.
userParms - An array of user-supplied method parameters.
asOfDateTime - The version datetime stamp of the digital object.
response - The servlet response.
request - The servlet request.
Throws:
java.io.IOException - If an error occurrs with an input or output operation.
ServerException - If an error occurs in the Access Subsystem.

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException

For now, treat a HTTP POST request just like a GET request.

Parameters:
request - The servet request.
response - The servlet response.
Throws:
javax.servlet.ServletException - If thrown by doGet.
java.io.IOException - If thrown by doGet.

init

public void init()
          throws javax.servlet.ServletException

Initialize servlet.

Throws:
javax.servlet.ServletException - If the servet cannot be initialized.

destroy

public void destroy()

Cleans up servlet resources.