|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.danube.http.Selector
public class Selector
This class selects appropriate ConnectionHandler
based on matching based on the URI from the http connection.
Field Summary | |
---|---|
protected List<Matcher> |
components
List of Matcher objects |
protected ConnectionHandler |
errorResponse
Error response if uri hasn't been matched |
Constructor Summary | |
---|---|
Selector()
Constructor |
Method Summary | |
---|---|
List<Matcher> |
getComponents()
Returns list of connection handlers |
ConnectionHandler |
getErrorResponse()
Returns error response |
void |
handleConnection(Connection connection)
Selects ConnectionHandler checking all Matcher from components list. |
void |
setComponents(List<Matcher> components)
Sets list of connection handlers |
void |
setErrorResponse(ConnectionHandler errorResponse)
Sets error response |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<Matcher> components
Matcher
objects
protected ConnectionHandler errorResponse
Constructor Detail |
---|
public Selector()
Method Detail |
---|
public void handleConnection(Connection connection)
Selects ConnectionHandler
checking all Matcher
from components
list.
If Matcher.matches(HTTPConnection)
returns true then ConnectionHandler
stored in
Matcher
is called. Depending on Matcher.isStopOnMatch()
selector will
proceed with rest of the list or not.
If no matches are found errorResponse
is used to generate error. Default
value is ErrorConnectionHandler
.
handleConnection
in interface ConnectionHandler
connection
- http connectionpublic void setComponents(List<Matcher> components)
components
- list of connection handlerspublic List<Matcher> getComponents()
public ConnectionHandler getErrorResponse()
public void setErrorResponse(ConnectionHandler errorResponse)
errorResponse
- error response
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |