Remote request dispatcher considerations
This topic presents some considerations of which we need to be aware when using remote request dispatcher.
- If an application expects parameters in certain encoding, the application should set character encoding, as in a normal include, before the remote request dispatch (RRD) occurs.
- ServletInputStream data of local server is not available to remote server. The local server parses POST data prior to sending the RRD request to the remote server and include parameters as request parameters. Multipart form data is inaccessible to remote server. An UnsupportedOperationException is created if the remote server attempts to obtain inputstream from the request.
- No access to original request reference on the remote server.
- Request and response wrappers created in the local server are not available in remote server. This cannot be done due to ServletRequestWrappers and WebSphere internal ServletRequest objects not implementing Serializable.
- Request attributes need to be serializable.
- Class definition of attributes need to be available in both local and remote servers.
- Request attributes are propagated to the remote server and back to the local server.
- HTTP Sessions
- We cannot have cross session access between different web applications when web applications are remote.
- When all web applications are in a local server, an application can share sessions across web applications by storing the session in a table that is accessible to multiple web applications. This is not possible with RRD and not recommended in local case either.
- Servlet Programming Model: We cannot access sessions in different Web applications.
- Normal programming model in local case as well as remote case.
- In local mode, application can cache away reference and share the session across the web applications, which is not feasible in RRD case.
- A session object stored as request attribute is not available on remote server as the Session class does not implement Serializable.
- Thread local variables that are set on the local server are not available on the remote server.
- Not all methods defined on ServletContext object are available for the RRD ServletContext object. See the SPI documentation for com.ibm.wsspi.rrd.context.RemoteServletContext for details.
- The remote server does not have access to output of local server when using RRD.
- Cookies and ServletRequestWrappers
If customer application wrappers the HttpServletRequest.getCookies method and returns additional cookies or removes cookies, the modified cookies are not sent to the remote server because javax.servlet.http.Cookie does not implement Serializable. Cookies from the original request headers are sent to the remote server.
Related concepts
Remote request dispatcher
Related tasks
Configure web applications to dispatch remote includes Configure web applications to service remote includes Task overview: Assembling applications using remote request dispatcher