org.eaglei.repository.servlet
Class RepositoryServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.eaglei.repository.servlet.RepositoryServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
Disseminate, EmailContact, Graph, Harvest, ImportExport, Internal, ListGraphs, Model, New, SparqlProtocol, Update, UpdateGrants, UpdateNamedGraph, UpdateRole, UpdateTransition, UpdateUser, WhoAmI, WorkflowClaim, WorkflowPush, WorkflowRelease, WorkflowResources, WorkflowTransitions

public class RepositoryServlet
extends javax.servlet.http.HttpServlet

Superclass for repo servlet classes, with shared utility methods. Also wraps the service() method with code that manages resources, catches and processes the runtime errors used to signal HTTP status.

Version:
$Id: $
Author:
Larry Stone
See Also:
Serialized Form

Constructor Summary
RepositoryServlet()
           
 
Method Summary
protected  java.lang.String getExactParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, boolean required)
          Get a plain string parameter, including empty or whitespace string.
protected  java.lang.String getParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, boolean required)
          Get a plain string parameter, AND turn empty string into null.
protected  boolean getParameterAsBoolean(javax.servlet.http.HttpServletRequest request, java.lang.String name, boolean defaultValue, boolean required)
          XXX needs javadoc
protected  java.lang.Enum getParameterAsKeyword(javax.servlet.http.HttpServletRequest request, java.lang.String name, java.lang.Class argType, java.lang.Enum defaultValue, boolean required)
          XXX needs javadoc
protected  java.io.Reader getParameterAsReader(javax.servlet.http.HttpServletRequest request, java.lang.String name, boolean required)
          returns Reader on stream param or none if not there XXX needs javadoc
protected  org.openrdf.model.URI getParameterAsURI(javax.servlet.http.HttpServletRequest request, java.lang.String name, boolean required)
          XXX needs javadoc
protected  java.lang.String getParameterContentType(javax.servlet.http.HttpServletRequest request, java.lang.String name)
          returns contnet-type of stream param or none if not there XXX needs javadoc
protected  java.lang.String[] getParameters(javax.servlet.http.HttpServletRequest request, java.lang.String name, boolean required)
          Get multiple params, return null for no params XXX needs javadoc
protected  boolean isParameterPresent(javax.servlet.http.HttpServletRequest request, java.lang.String name)
          return true when parameter is present, even if no value XXX needs javadoc
protected  void redirectToJSP(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String message, java.lang.String[] passThru, java.lang.String... more)
          Detect and manage the redirect to a JSP page whose form action invoked this servlet.
protected  void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Wrap service() with error-handling, logging, and cleanup of any Sesame repository connection left open.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryServlet

public RepositoryServlet()
Method Detail

getExactParameter

protected java.lang.String getExactParameter(javax.servlet.http.HttpServletRequest request,
                                             java.lang.String name,
                                             boolean required)
Get a plain string parameter, including empty or whitespace string. XXX needs javadoc


getParameter

protected java.lang.String getParameter(javax.servlet.http.HttpServletRequest request,
                                        java.lang.String name,
                                        boolean required)
Get a plain string parameter, AND turn empty string into null. XXX needs javadoc


getParameters

protected java.lang.String[] getParameters(javax.servlet.http.HttpServletRequest request,
                                           java.lang.String name,
                                           boolean required)
Get multiple params, return null for no params XXX needs javadoc


isParameterPresent

protected boolean isParameterPresent(javax.servlet.http.HttpServletRequest request,
                                     java.lang.String name)
return true when parameter is present, even if no value XXX needs javadoc


getParameterAsBoolean

protected boolean getParameterAsBoolean(javax.servlet.http.HttpServletRequest request,
                                        java.lang.String name,
                                        boolean defaultValue,
                                        boolean required)
XXX needs javadoc


getParameterAsURI

protected org.openrdf.model.URI getParameterAsURI(javax.servlet.http.HttpServletRequest request,
                                                  java.lang.String name,
                                                  boolean required)
XXX needs javadoc


getParameterContentType

protected java.lang.String getParameterContentType(javax.servlet.http.HttpServletRequest request,
                                                   java.lang.String name)
returns contnet-type of stream param or none if not there XXX needs javadoc


getParameterAsReader

protected java.io.Reader getParameterAsReader(javax.servlet.http.HttpServletRequest request,
                                              java.lang.String name,
                                              boolean required)
returns Reader on stream param or none if not there XXX needs javadoc


getParameterAsKeyword

protected java.lang.Enum getParameterAsKeyword(javax.servlet.http.HttpServletRequest request,
                                               java.lang.String name,
                                               java.lang.Class argType,
                                               java.lang.Enum defaultValue,
                                               boolean required)
XXX needs javadoc


service

protected void service(javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse resp)
                throws javax.servlet.ServletException,
                       java.io.IOException
Wrap service() with error-handling, logging, and cleanup of any Sesame repository connection left open.

Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

redirectToJSP

protected void redirectToJSP(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             java.lang.String message,
                             java.lang.String[] passThru,
                             java.lang.String... more)
                      throws javax.servlet.ServletException,
                             java.io.IOException
Detect and manage the redirect to a JSP page whose form action invoked this servlet. Upon success, the servlet wants to present the JSP again with its new state and a messaeg (the "message" arg) explaining what was done, to indicate success. This ONLY redirects when the referrer was a JSP, i.e. the URL has ".jsp" in it. It expects the rererring JSP to be in the repo admin UI so it follows those conventions (message, other args). WARNING, note that the 'more' vararg is expected to be an even number of args, alternating arg name and value. The values of all args are escaped by this function.

Parameters:
request -
response -
message - value of 'message' arg to send jsp
passThru - names of servlet params to pass through to jsp request
more - additional params; alternating param name and value (unencoded) to send to JSP
Throws:
javax.servlet.ServletException
java.io.IOException


Copyright © 2009-2011 Eagle-I. All Rights Reserved.