edu.ucsb.adl.middleware
Class MetadataServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--edu.ucsb.adl.middleware.MetadataServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public final class MetadataServlet
extends javax.servlet.http.HttpServlet

HTTP interface to the ADL metadata service. The metadata service can be accessed by an HTTP GET request containing two URL-encoded parameters: view, the name of a metadata view (e.g., adl:access); and id, an object identifier. If the URL of this servlet is S, then an example of a complete URL might be:

S?view=adl:access&id=adl_catalog:2012984
The content type of the returned XML document is text/xml. The document encoding is UTF-8.

The fictitious view adl:view-list returns a list of the views supported by the object in the syntax

<!ELEMENT ADL-view-list (identifier, view+)>
    <!ELEMENT identifier (#PCDATA)>
    <!ELEMENT view (#PCDATA)>

Service exceptions are caught and returned as HTTP errors. In particular, BadRequestException is mapped to 400 (bad request), NoAuthorizationException is mapped to 403 (forbidden), UnsupportedException is mapped to 501 (not implemented), and InternalErrorException is mapped to 500 (internal server error).

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/RCS/MetadataServlet.java,v 1.7 2004/09/22 03:00:26 gjanee Exp $

$Log: MetadataServlet.java,v $ Revision 1.7 2004/09/22 03:00:26 gjanee
Rewrite to use new, centralized XML/HTML encoding functions.

Revision 1.6 2004/03/02 22:01:48 gjanee
If the middleware_configuration_file servlet initialization parameter is not available, we now look for it as a context-wide initialization parameter.

Revision 1.5 2003/05/12 17:30:40 gjanee
Added support for arbitrary, per-collection and per-holding metadata views. Specifically, added the adl:view-list fictitious view.

Revision 1.4 2001/11/16 17:41:33 gjanee
Internationalization support. All returned data now uses UTF-8 encoding.

Revision 1.3 2001/10/04 18:20:33 gjanee
To support the middleware being a web application, we now allow the location of the middleware configuration file to be specified relative to the web application directory.

Revision 1.2 2001/02/15 18:36:46 gjanee
Minor upgrade to servlet API 2.2.

Revision 1.1 2000/04/04 18:17:55 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library
See Also:
Serialized Form

Constructor Summary
MetadataServlet()
          Creates a MetadataServlet.
 
Method Summary
 void destroy()
          Frees all resources held by the servlet.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          HTTP GET interface to the ADL metadata service.
 void init(javax.servlet.ServletConfig config)
          Initializes the servlet.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, 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
 

Constructor Detail

MetadataServlet

public MetadataServlet()
Creates a MetadataServlet.

Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initializes the servlet.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Parameters:
config - Must contain the following initialization parameter: middleware_configuration_file, the filename of the ADL middleware configuration file. If the filename is not absolute, it is interpreted relative to the middleware web application directory.
Throws:
javax.servlet.UnavailableException - If the initialization fails.
javax.servlet.ServletException

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException
HTTP GET interface to the ADL metadata service. This method is multithread-safe.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - The HTTP request.
response - The HTTP response.
Throws:
java.io.IOException - On any I/O error.

destroy

public void destroy()
Frees all resources held by the servlet.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet