TopoWeb Commons API

org.topoweb.net.server
Class XmlTailDetector

java.lang.Object
  |
  +--org.topoweb.net.server.XmlTailDetector
All Implemented Interfaces:
RequestBoundaryDetector

public class XmlTailDetector
extends java.lang.Object
implements RequestBoundaryDetector

Detects the presence of the tail of an XML element in the Session bytes read in. This class can be used with a SessionReader if every client request is terminated by a character sequence that forms the tail of an XML element. If non-whitespace characters following the tail of the XML element are read into the passed in Session, then the requestCompleted method will fail (return false).

Author:
Babak Farhang

Constructor Summary
XmlTailDetector(java.lang.String tag)
          Creates a new instance with the specified tag name.
 
Method Summary
 boolean requestCompleted(Session session)
          Tests whether enough bytes have been read into the given session to form a request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlTailDetector

public XmlTailDetector(java.lang.String tag)
Creates a new instance with the specified tag name.

Parameters:
tag - the tag name of the element
Throws:
java.lang.IllegalArgumentException - if tag is null; if a test indicates that tag is malformed
Method Detail

requestCompleted

public boolean requestCompleted(Session session)
Description copied from interface: RequestBoundaryDetector
Tests whether enough bytes have been read into the given session to form a request.

Specified by:
requestCompleted in interface RequestBoundaryDetector
Parameters:
session - the Session inspected
Returns:
true, if there are enough bytes in the given session to form an interpretable request; false, o.w.
See Also:
Session.getReadArray(), Session.getReadAmount()

TopoWeb Commons API

Copyright (C) 2002 Babak Farhang

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.