Hello All,

I am trying to write a filter that gets executed on every request going into
my web application and primarily before anything struts/tiles related as it
sets up the environment for the factory stuff that can load views based on a
custom factory.  Mine happens to be based on User-Agent and other things so
I want to set up those session attributes before it gets to
rendering/building those template pages.  Anyhow, I created a filter to do
this, configured it like this:

  <filter>
    <filter-name>User Agent Factory Filter</filter-name>
    <filter-class>filter.UserAgentFactoryFilter</filter-class>
    <init-param>
     <param-name>debug</param-name>
     <param-value>1</param-value>
   </init-param>
  </filter>

I then mapped it to ALL urls like this:

  <filter-mapping>
    <filter-name>User Agent Factory Filter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

I figured this would be it.  But, when I access the first page I get the
following:

-----------------------------
**SEAN** MappingFactorySet - KEY (null) for NAME (home)
insert page='/WEB-INF/views/default/navigation/siteTemplate.jsp'.
**SEAN** MappingFactorySet - KEY (null) for NAME
(/WEB-INF/views/default/navigation/head.jsp)
insert page='/WEB-INF/views/default/navigation/head.jsp'.
**SEAN** MappingFactorySet - KEY (null) for NAME
(/WEB-INF/views/default/navigation/top.jsp)
insert page='/WEB-INF/views/default/navigation/top.jsp'.
**SEAN** MappingFactorySet - KEY (null) for NAME
(/WEB-INF/views/default/navigation/left.jsp)
insert page='/WEB-INF/views/default/navigation/left.jsp'.
**SEAN** MappingFactorySet - KEY (null) for NAME
(/WEB-INF/views/default/home.jsp)
insert page='/WEB-INF/views/default/home.jsp'.
**SEAN** MappingFactorySet - KEY (null) for NAME
(/WEB-INF/views/default/navigation/right.jsp)
insert page='/WEB-INF/views/default/navigation/right.jsp'.
**SEAN** MappingFactorySet - KEY (null) for NAME
(/WEB-INF/views/default/navigation/bottom.jsp)
insert page='/WEB-INF/views/default/navigation/bottom.jsp'.
UserAgentFactoryFilter(ApplicationFilterConfig[name=User Agent Factory
Filter, filterClass=filter.UserAgentFactoryFilter]) Client appears to be
parlano
UserAgentFactoryFilter(ApplicationFilterConfig[name=User Agent Factory
Filter, filterClass=filter.UserAgentFactoryFilter]) Setting factory selector
string to 'netscape_default'
-----------------------------

As you can see the Factory is someone getting called before the Filter.
Now, the page I am viewing is a simple index.jsp page that contains the
following:

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<template:insert definition="home" flush="true" />

The only thing I can think of is that this is getting called before the
filter and therefor the tag library is getting executed before my filter
thus nullifying my goal for this filter.  Does anyone else know how else I
can set up this filter to do this or maybe even another way?  I was think of
putting it in my Action object all my actions subclass but that only gets
used when a /do/* action gets called which is not for jsp pages that use the
tiles template library.  Any help would be appreciated.

Sean


Reply via email to