apache > cocoon

- Home

# RequestMethodSelector in Cocoon

## RequestMethodSelector

NAME | RequestMethod
WHAT | The `RequestMethodSelector` component is used to select appropriate sitemap processing depending on the request method, for example, `GET` or `POST`.
TYPE | Selector, Sitemap Component
BLOCK | Core
CLASS | org.apache.cocoon.selection.RequestMethodSelector
CACHEABLE | not applicable

## Description

The RequestMethodSelector allows pipeline creation to be influenced by the method of the request. For example, in a Cocoon Forms environment, a `GET` request could be forwarded to a new FlowScript function, whilst a `POST` could be forwarded to a continuation, for example:

    <map:match pattern="myform">
      <map:select type="request-method">
        <map:when test="GET">
           <map:call function="myform"/>
        </map:when>
        <map:when test="POST">
          <map:call continuation="request-param:continuation-id"/>
        </map:when>
      </map:select>
    </map:match>

## Configuration

### Sitemap component configuration example

    <map:selectors...
      <map:selector name="request-method"
                    logger="sitemap.selector.request-method"
                    src="org.apache.cocoon.selection.RequestMethodSelector"/>
      ...
    </map:selectors>

### Configuration

The request method selector does not require any specific configuration, other than specifying a name and an implementing class, as in the example above.

## History

2004-12-16: Created this document

## See also

General documentation about selectors is available at Matchers and Selectors.

Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).