The URL pattern descriptor

Description

This is an XML document that maps HTTP requests to XPipes

The top level element

The descriptor stats with a xpipeDef element under the namespace of "http://www.xml.org/xml/pipe"


   <urlPattern  xmlns="http://www.xmlpipe.org/xpe/manual" >
      <method  name="GET"  xmlns="" >
         <map  pattern="/manual/xml/test"  xpipe="http://www.xmlpipe.org/xpe/manual/xmlRender" />
         <map  pattern="/manual/*"  xpipe="http://www.xmlpipe.org/xpe/manual/main" />
         <map  pattern="/manual/css/*"  xpipe="http://www.xmlpipe.org/xpe/manual/css" />
      </method>
      <method  name="POST"  xmlns="" >
         <map  pattern="/manual/xml/test"  xpipe="http://www.xmlpipe.org/xpe/manual/process" />
      </method>
   </urlPattern>

The urlPattern can have a number of method element. Each method element has a name attribute whose value can only be "GET" or "POST". Each method element has zero or more map elements. Each map element maps a URL pattern with a pipe using a pattern attribute and an xpipe attribute.

The pattern attribute

The value of the pattern attribute can be an exact URI or a wildcard match. The following rules for matching are applied:

  1. If the pattern is an exact URI, the exactly matched HTTP request will be forwarded to the corresponding pipe.
  2. If the pattern has a wildcard (*), the longest matching pattern wins. For example, a HTTP request with URI: /manual/css/main.css will be forwarded to pipe, http://www.xmlpipe.org/xpe/manual/css.

Pattern tips

  • If possible, always specify exact URI pattern. This gives better performance and security.
  • Keep the number of wildcard patterns to the minimum.
  • Use different pipes to handle GET and POST requests.