This page last changed on Sep 27, 2006 by bowens.

Overview

An Operation is a method or component of a service. It can be thought of as a remote procedure call in a sense. In GeoServer, operations form the basis of the Request-Response subsystem depicted below.

The following sequence diagram depicts a more precise description of the interaction between the components of the request response system.

The major players of the request-resoonse system include:

Dispatcher Handles all incoming requests, and routes the request to the correct operation.
AbstractService The operation itself. Its role is to create a RequestReader which will be used to read information from the incoming request and configure the operation.
RequestReader Reads a request. Requests can be executed via http "GET" or "POST". This interface abstracts away the specifics of either from the operation by creating a single Request object.
Request A normal java bean containg information about the incoming request.
Response Executes the operation being requested. A response is paramterized by the Request bean.

WFS GetCapabilities Example

As an example, consider a Web Feature Service Get Capabilities operation:

Extension

Extending the request response system boils down to providing an instance of org.vfny.geoserver.servlets.AbstractService . The following is a snippet of class:

public abstract class AbstractService extends HttpServlet {
...
    /**
     * @return Returns the "service group" that this service falls into.
     */
    public String getService() {
	return service;
    }
    
    /**
     * @return Returns the "request" this service maps to.
     */
    public String getRequest() {
	return request;
    }
...
}

The above shows that an operation has a "service" property, and a "request" property. The service property is the identifer of service the operation belongs to. Examples include "WFS","WMS", "WCS", etc.. The "request" property identifies the operation itself. Examples include "GetCapabilities,GetMap,GetFeature,etc...

The two together form a unique identifier for the operation. This identifier is used by the dispatcher to route requests to the operation. For instance from the url: "http://localhost:8080/geoserver/wfs?request=GetCapabilities", the dispatcher can infer that the service being requested is "wfs", and the request being performed is "GetCapabilities". The dispatch system is capable of parsing urls of the following forms:

HTTP Method Request Form Example
GET <protocol>://<host>:[GEOSDEV:port]/geoserver/<service>?request=<request> http://localhost/geoserver/wfs?request=GetCapabilties
GET <protocol>://<host>:[GEOSDEV:port]/geoserver/<service>/<request> http://localhost/geoserver/wfs/GetCapabilties
GET <protocol>://<host>:[GEOSDEV:port]/geoserver/ows?service<service>&request=<request> http://localhost/geoserver/ows?service=wfs&amp;request=GetCapabilities
POST <protocol>://<host>:[GEOSDEV:port]/geoserver/service http://localhost:8080/geoserver/wfs

Note: In the POST example above, the request is specified in the body of the request (usually as XML). Example:

&lt;GetCapabilities service=&quot;WFS&quot; .../&gt;

Operations are declared in a spring context as follows:

&lt;bean id=&quot;someOperation&quot; class=&quot;org.xyz.SomeOperation&quot;&gt;
     &lt;property name=&quot;service&quot; value=&quot;someService&quot;/&gt;
     &lt;property name=&quot;request&quot; value=&quot;someRequest&quot;/&gt;
  &lt;/bean&gt;

A complete example of creating a new operation is supplied here.


Document generated by Confluence on Jan 16, 2008 23:26