Extracting the parameter
Depends on your requirements:
- Service call from front end: Probably you could register a
@Replace
-Annotated ServiceTunnelServlet
-subclass and extract it from the request there.
- Alternatively, there also is a thread-local that keeps the request for service tunnel calls:
IHttpServletRoundtrip.CURRENT_HTTP_SERVLET_REQUEST
. If you can easily extract it from the URL or header: great
- REST call to your backend: Extract it in the appropriate Servlet
Storing the parameter
You can wrap method calls in a ServerRunContext, and pass properties along that you can extract at other locations! See the ServerRunContext#withProperty(String,String)
method.
You can create a new Context using the ServerRunContexts
helper methods.
Using it
This part you already seem to have solved: You can use a single registered Service or appropriate @Order
annotation to get the request and then dispatch them to the proper service based on the ID that you stored in the ServerRunContext.