info.sswap.http
Class SSWAPProxyServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by info.sswap.api.servlet.AbstractSSWAPServlet
              extended by info.sswap.http.SSWAPProxyServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class SSWAPProxyServlet
extends info.sswap.api.servlet.AbstractSSWAPServlet

A default SSWAP HTTP Servlet that will pass servlet calls to a remote URL.

Use of this servlet allows partial support for SSWAP Semantic Web Services using only the HTTP API (no Java programming necessary). Users of this class do not need to instantiate it nor call any methods. To use the class, map it in the servlet container's web.xml file by associating it with the parameter remoteServiceURI and a URL which will execute the service; e.g.:

<servlet>

  <servlet-name>MyRDGServlet</servlet-name>
  <servlet-class>info.sswap.http.SSWAPProxyServlet</servlet-class>

  <init-param>
    <param-name>remoteServiceURI</param-name>
    <param-value>http://someSite.org/someService</param-value>
  </init-param>

  <!-- if not defined, defaults to <url-pattern>
  <init-param>
    <param-name>RDGPath</param-name>
    <param-value>/resources/MyRDG/MyRDG</param-value>
  </init-param>
  -->

</servlet>

<servlet-mapping>
  <servlet-name>MyRDGServlet</servlet-name>
  <url-pattern>/resources/MyRDG</url-pattern>
</servlet-mapping>

Replace and customize the values for <servlet-name>, <param-value>, and <url-pattern> per usual web.xml practices. All other values should be as above. The URL associated with the remoteServiceURI will be invoked by the same method as which this servlet is called (HTTP GET or POST on the <url-pattern>) with the same query string or content body respectively. This servlet will block (wait) on the call and must receive a valid RRG (Response Response Graph) as the HTTP response.

The remoteServiceURI may satisfy the request in the language and manner of its choosing. It may use the SSWAP HTTP API /makeRRG service to construct a RRG from JSON input suitable for return.

The use and definition of RDGPath is optional. If it is not defined, then the RDG must reside at the path given in <url-pattern>; if it is defined, then its value must be the path to a valid RDG (Resource Description Graph) on the local web server. Future implementations of this servlet may offer semantic mapping based on the RDG.

Usage: This servlet allows SSWAP semantic description and discovery without the need for Java programming: simply set up the mapping in web.xml and the servlet will handle proxying the service and either returning the response to the caller or sending the response to the appropriate presentation layer or next service in the pipeline. But semantic support for invocation is limited; for full semantic support use the AbstractSSWAPServlet in the SSWAP Java API.

Author:
Damian Gessler
See Also:
/makeRRG, /makeRDG, AbstractSSWAPServlet, Serialized Form

Field Summary
private static long serialVersionUID
          Default
 
Fields inherited from class info.sswap.api.servlet.AbstractSSWAPServlet
remoteServiceURI, RRG_RETRIEVAL_SUFFIX
 
Constructor Summary
SSWAPProxyServlet()
           
 
Method Summary
protected  void handleRequest(info.sswap.api.model.RIG rig)
          Visibility for package access purposes only.
 void init(javax.servlet.ServletConfig servletConfig)
          Visibility for package access purposes only.
 
Methods inherited from class info.sswap.api.servlet.AbstractSSWAPServlet
doGet, doPost, getTimeout, setTimeout
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, 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

serialVersionUID

private static final long serialVersionUID
Default

See Also:
Constant Field Values
Constructor Detail

SSWAPProxyServlet

public SSWAPProxyServlet()
Method Detail

init

public final void init(javax.servlet.ServletConfig servletConfig)
                throws javax.servlet.ServletException
Visibility for package access purposes only. This method should not be called directly.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class info.sswap.api.servlet.AbstractSSWAPServlet
Throws:
javax.servlet.ServletException

handleRequest

protected final void handleRequest(info.sswap.api.model.RIG rig)
Visibility for package access purposes only. This method should not be called directly.

Specified by:
handleRequest in class info.sswap.api.servlet.AbstractSSWAPServlet


Copyright (c) 2010, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.