| Example:
Selector selector = new PatternMatchingHTTPFieldSelector(
"host", "(?:[a-zA-Z0-9]+\.)*myhostname\.org" );
boolean selected = selector.select(
getHTTPMessage(
"GET / HTTP/1.1",
"Host: www.myhostname.org"
)
);
Assert.assertTrue( selected );
selected = selector.select(
getHTTPMessage(
"GET / HTTP/1.1",
"host: www3.dynamic.sub.myhostname.org"
)
);
Assert.assertTrue( selected );
selected = selector.select(
getHTTPMessage(
"GET / HTTP/1.1",
"Host: notmyhostname.org"
)
);
Assert.assertFalse( selected );
author: Leo Simons version: $Id: PatternMatchingHTTPFieldSelector.java,v 1.4 2004/03/31 12:10:59 lsimons Exp $ |