FilterDispatcherCompatWeblogic61public class FilterDispatcherCompatWeblogic61 extends FilterDispatcher When running Weblogic Server 6.1, this class should be
specified in web.xml instead of {@link FilterDispatcher}.
This class properly handles the weblogic.jar handling
of servlet filters. There is one serious incompatibility, and
that is that while {@link FilterDispatcher#init(FilterConfig)}
throws a {@link ServletException}, this class's method
{@link #setFilterConfig(FilterConfig)} does not throw
the exception. Since {@link #setFilterConfig(FilterConfig)}
invokes {@link FilterDispatcher#init(FilterConfig)}, the setter
must "swallow" the exception. This it does by logging the
exception as an error. |
Fields Summary |
---|
private static Log | log |
Methods Summary |
---|
public javax.servlet.FilterConfig | getFilterConfig()This method is required by Weblogic 6.1 SP4 because
they defined this as a required method just before
the Servlet 2.3 specification was finalized.
return super.getFilterConfig();
| protected javax.servlet.ServletContext | getServletContext(javax.servlet.http.HttpSession session)answers the servlet context.
Servlet 2.3 specifies that this can be retrieved from
the session. Unfortunately, weblogic.jar can only retrieve
the servlet context from the filter config. Hence, this
returns the servlet context from the singleton that was
setup by {@link #setFilterConfig(FilterConfig)}.
ServletContextSingleton singleton =
ServletContextSingleton.getInstance();
return singleton.getServletContext();
| public void | setFilterConfig(javax.servlet.FilterConfig filterConfig)dummy setter for {@link #filterConfig}; this method
sets up the {@link org.apache.struts2.config.ServletContextSingleton} with
the servlet context from the filter configuration.
This is needed by Weblogic Server 6.1 because it
uses a slightly obsolete Servlet 2.3-minus spec
whose {@link Filter} interface requires this method.
try {
init(filterConfig);
} catch (ServletException se) {
log.error("Couldn't set the filter configuration in this filter", se);
}
ServletContextSingleton singleton = ServletContextSingleton.getInstance();
singleton.setServletContext(filterConfig.getServletContext());
|
|