Package jadex.extension.rs.publish
Class PathHandler2
- java.lang.Object
-
- jadex.extension.rs.publish.PathHandler2
-
- All Implemented Interfaces:
IPathHandler
,IRequestHandler
public class PathHandler2 extends java.lang.Object implements IPathHandler
Main handler dealing with incoming request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PathHandler2.SubHandler
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.util.Map<java.lang.String,java.util.Collection<PathHandler2.SubHandler>>>
subhandlers
protected java.util.Map<Tuple2<java.lang.String,java.lang.String>,Tuple2<java.lang.String,IRequestHandler>>
subhandlersold
-
Constructor Summary
Constructors Constructor Description PathHandler2()
Create the handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSubhandler(java.lang.String vhost, java.lang.String path, IRequestHandler subhandler)
Adds a new subhandler.boolean
containsSubhandlerForExactUri(java.lang.String vhost, java.lang.String path)
Tests if a handler for the exact URI is currently published.protected PathHandler2.SubHandler
findSubhandler(java.lang.String host, java.lang.String path)
Locates an appropriate subhandler that matches the requested resource closely.java.util.Map<Tuple2<java.lang.String,java.lang.String>,Tuple2<java.lang.String,IRequestHandler>>
getSubhandlers()
Get the subhandlers.void
handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object args)
Handle the request.boolean
isEmpty()
Tests if the handler contains no subhandlers.void
removeSubhandler(java.lang.String vhost, java.lang.String path)
Remove a subhandler.
-
-
-
Field Detail
-
subhandlersold
protected java.util.Map<Tuple2<java.lang.String,java.lang.String>,Tuple2<java.lang.String,IRequestHandler>> subhandlersold
-
subhandlers
protected java.util.List<java.util.Map<java.lang.String,java.util.Collection<PathHandler2.SubHandler>>> subhandlers
-
-
Method Detail
-
handleRequest
public void handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object args) throws java.lang.Exception
Handle the request.- Specified by:
handleRequest
in interfaceIRequestHandler
- Parameters:
request
- The request.response
- The response.args
- Container specific args.- Throws:
java.lang.Exception
-
addSubhandler
public void addSubhandler(java.lang.String vhost, java.lang.String path, IRequestHandler subhandler)
Adds a new subhandler.- Specified by:
addSubhandler
in interfaceIPathHandler
- Parameters:
vhost
- Virtual host specification.path
- Path being handled.subhandler
- The subhandler.
-
containsSubhandlerForExactUri
public boolean containsSubhandlerForExactUri(java.lang.String vhost, java.lang.String path)
Tests if a handler for the exact URI is currently published.- Specified by:
containsSubhandlerForExactUri
in interfaceIPathHandler
- Parameters:
vhost
- Virtual host specification.path
- Path being handled.- Returns:
- True, if a handler was found.
-
isEmpty
public boolean isEmpty()
Tests if the handler contains no subhandlers.- Returns:
- True, if no subhandlers remain.
-
removeSubhandler
public void removeSubhandler(java.lang.String vhost, java.lang.String path)
Description copied from interface:IPathHandler
Remove a subhandler.- Specified by:
removeSubhandler
in interfaceIPathHandler
- Parameters:
vhost
- Virtual host specification.path
- Path being handled.
-
getSubhandlers
public java.util.Map<Tuple2<java.lang.String,java.lang.String>,Tuple2<java.lang.String,IRequestHandler>> getSubhandlers()
Get the subhandlers.- Specified by:
getSubhandlers
in interfaceIPathHandler
- Returns:
- The subhandlers
-
findSubhandler
protected PathHandler2.SubHandler findSubhandler(java.lang.String host, java.lang.String path)
Locates an appropriate subhandler that matches the requested resource closely.- Parameters:
host
- The requested virtual host.path
- The requested path- Returns:
- The subhandler or null if none is found for the host.
-
-