Class RoutedService
java.lang.Object
com.invirgance.convirgance.web.service.RoutedService
Routes requests between multiples services based on the request URL. URLs
can contain
Longer paths are checked before shorter paths, so
Conversely
*
to handle cases where the component of the URL
is not known ahead of time. e.g. /owner/32/pet/12
would match
/owner/*/pet
.Longer paths are checked before shorter paths, so
/owner/32/pet/12
would match /owner/*/pet
instead of /owner
.Conversely
/owner/32/edit
would match /owner
.- Author:
- jbanes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(HttpRequest request, HttpResponse response) Executes the service, processing the HTTP request and generating a response.getDestinationService
(HttpRequest request) Obtain the service that will handle this request.The list of paths for routing and the service configured to handle each route.void
Set the list of paths and the associated services to handle those paths
-
Constructor Details
-
RoutedService
public RoutedService()
-
-
Method Details
-
getRoutes
The list of paths for routing and the service configured to handle each route.- Returns:
- a map of routes
-
setRoutes
Set the list of paths and the associated services to handle those paths- Parameters:
routes
- a map of routes
-
getDestinationService
Description copied from interface:Routable
Obtain the service that will handle this request.- Specified by:
getDestinationService
in interfaceRoutable
- Parameters:
request
- the object representing the http request- Returns:
- the service that will handle this request, or null if it cannot be routed
-
execute
Description copied from interface:Service
Executes the service, processing the HTTP request and generating a response.
-