org.sapia.ubik.net.mplex
Class HttpStreamSelector

java.lang.Object
  extended by org.sapia.ubik.net.mplex.HttpStreamSelector
All Implemented Interfaces:
StreamSelector

public class HttpStreamSelector
extends java.lang.Object
implements StreamSelector

Implements a selection logic for HTTP requests. By default this selector will choose all HTTP request, as it looks for the token "HTTP/" as specified by the HTTP specification. This selector also gives the functionaly to select only a given HTTP method (like POST or GET) and/or to specify a pattern for the HTTP request path. If specify this request pattern must be the first characters of the request path to select (without any starts or regex expression). The current logic to determine if the request pattern matches is done using the startsWith() method of the java.lang.String object.

Author:
Jean-Cedric Desrochers
Copyright:
Copyright © 2002-2004 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Constructor Summary
HttpStreamSelector()
          Creates a new HtpStreamSelector instance that will select any HTTP request.
HttpStreamSelector(java.lang.String aMethod, java.lang.String aRequestPattern)
          Creates a new HtpStreamSelector instance that will select an HTTP request based on the criterias passed in.
 
Method Summary
 boolean selectStream(byte[] header)
          Selects or not a stream by analyzing the header of the stream passed in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpStreamSelector

public HttpStreamSelector()
Creates a new HtpStreamSelector instance that will select any HTTP request.


HttpStreamSelector

public HttpStreamSelector(java.lang.String aMethod,
                          java.lang.String aRequestPattern)
Creates a new HtpStreamSelector instance that will select an HTTP request based on the criterias passed in.

Parameters:
aMethod - The specific HTTP method to discrimate on, or null for any type of HTTP method.
aRequestPattern - The simple pattern that defines the starting request path of the HTTP request. For example the value "/sapia/example" would select the path "/sapia/example/index.html" and also "/sapia/example/service/myWebService". Passing null will make this selector choose any request path.
Method Detail

selectStream

public boolean selectStream(byte[] header)
Selects or not a stream by analyzing the header of the stream passed in.

Specified by:
selectStream in interface StreamSelector
Parameters:
header - The first 64 bytes of the stream.
Returns:
True if the header is accepted by this selector, false otherwise.


Copyright © 2010 Sapia OSS. All Rights Reserved.