Package jadex.publishservice.publish
Class PathHandler2
java.lang.Object
jadex.publishservice.publish.PathHandler2
- All Implemented Interfaces:
IPathHandler
,IRequestHandler
Main handler dealing with incoming request.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List
<Map<String, Collection<PathHandler2.SubHandler>>> protected Map
<jadex.common.Tuple2<String, String>, jadex.common.Tuple2<String, IRequestHandler>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSubhandler
(String vhost, String path, IRequestHandler subhandler) Adds a new subhandler.boolean
containsSubhandlerForExactUri
(String vhost, String path) Tests if a handler for the exact URI is currently published.protected PathHandler2.SubHandler
findSubhandler
(String host, String path) Locates an appropriate subhandler that matches the requested resource closely.Map
<jadex.common.Tuple2<String, String>, jadex.common.Tuple2<String, IRequestHandler>> Get the subhandlers.void
handleRequest
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object args) Handle the request.boolean
isEmpty()
Tests if the handler contains no subhandlers.void
removeSubhandler
(String vhost, String path) Remove a subhandler.
-
Field Details
-
subhandlersold
protected Map<jadex.common.Tuple2<String,String>, subhandlersoldjadex.common.Tuple2<String, IRequestHandler>> -
subhandlers
-
-
Constructor Details
-
PathHandler2
public PathHandler2()Create the handler.
-
-
Method Details
-
handleRequest
public void handleRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object args) throws Exception Handle the request.- Specified by:
handleRequest
in interfaceIRequestHandler
- Parameters:
request
- The request.response
- The response.args
- Container specific args.- Throws:
Exception
-
addSubhandler
Adds a new subhandler.- Specified by:
addSubhandler
in interfaceIPathHandler
- Parameters:
vhost
- Virtual host specification.path
- Path being handled.subhandler
- The subhandler.
-
containsSubhandlerForExactUri
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
Description copied from interface:IPathHandler
Remove a subhandler.- Specified by:
removeSubhandler
in interfaceIPathHandler
- Parameters:
vhost
- Virtual host specification.path
- Path being handled.
-
getSubhandlers
public Map<jadex.common.Tuple2<String,String>, getSubhandlers()jadex.common.Tuple2<String, IRequestHandler>> Get the subhandlers.- Specified by:
getSubhandlers
in interfaceIPathHandler
- Returns:
- The subhandlers
-
findSubhandler
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.
-