Distributed File System Example
A distributed file system component manages files based on the host address of the machine on which the file was created. The address is tracked in a context parameter named httpHost:
The file system component is invoked by SOAP clients through a service with a SOAP binding and by a web application component.
-
If a request comes through the SOAP binding, the context parameter is mapped to the TCP remote host header by the SOAP binding:
-
If the request originates from the web application, the parameter value is retrieved from the HTTP request and manually set by the servlet implementing the web application component:
String host = req.getRemoteHost(); MutableRequestContext mutableRequestContext = componentContext.createMutableRequestContext(); mutableRequestContext.setParameter("httpHost", String.class, host); componentContext.setRequestContext(mutableRequestContext);
The file system component retrieves the value of the context parameter as follows:
RequestContext requestContext = componentContext.getRequestContext(); String host requestContext.getParameter("httpHost", String.class);