IBM WebSphere Portal 8.5: User assistance for adminstrators |
Use the Request and Response tabs to define a fine-grained control over HTTP headers, HTTP cookies, and filters. Filters provide a programmatic control over content during the request and response phases of the interaction between IBM® WebSphere® Portal and the web application.
Specify the allowed (propagated) or blocked headers in the requests and responses to and from the content provider. By default, the Web Application Bridge propagates all the client-side headers. The client-side headers are present in the request that is received from the browser. The Web Application Bridge does not propagate headers that are listed in the block field.
Specify the allowed or blocked cookies in the request from the browser or the response from the content provider. By default, the Web Application Bridge propagates all the client-side cookies to the content provider. The client-side cookies are present in the request that is received from the browser. The Web Application Bridge stores all the server-side cookies in the session. Server-side cookies are received from the content provider in the form of Set-Cookie response headers.
If you add a custom request cookie with the same name as an existing cookie, the custom cookie overrides the existing cookie. If you add a custom response cookie, the Web Application Bridge adds a Set-Cookie header. The Web Application Bridge uses the provided name and value in responses that are sent from the Reverse Proxy servlet to the browser.
Filters are Java code that can be started on demand to run custom actions. They modify the request programmatically. Filters are extensions to core feature. Use the servlet filter API to create custom filters. The filters manipulate the request or response from the portal to the content provider. Developers create the filters. First, the administrator clicks Insert request filter to specify the set of filters that are available to apply to this policy. Then, the administrator clicks Add Filter to apply the filter to the policy.
package com.ibm.wps.wab.filter;
import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import com.ibm.wps.vwat.servlet.ReverseProxyRequest;
public class RequestFilter implements Filter {
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
System.out.println("Request Filter");
ReverseProxyRequest reverseProxyRequest = (ReverseProxyRequest)request;
Enumeration<String> headerNames = reverseProxyRequest.getHeaderNames();
String headerName;
System.out.println("Request Headers: ");
while(headerNames.hasMoreElements()){
headerName = headerNames.nextElement();
System.out.println(headerName);
}
chain.doFilter(request, response);
}
@Override
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
}
}