Laurie:

Here is my doFilter method - 

*begin*
public void doFilter( ServletRequest req, ServletResponse res, FilterChain 
chain)
        throws IOException, ServletException {
    
        HttpServletRequest httpReq = (HttpServletRequest)req;
        
        System.out.println("Req: "+httpReq.getRequestURL());

        // with this line - illegal state exception when submitting forms. 
without it, no crash.       
        String test = httpReq.getParameter("s");

        // some db processing clickstream analysis based on request parameters

*end*

Here is the stack trace of the crash:


java.lang.IllegalStateException: getInputStream() has already been called for 
this request
 at org.apache.catalina.connector.RequestBase.getReader(RequestBase.java:911)
 at 
org.apache.catalina.connector.RequestFacade.getReader(RequestFacade.java:212)
 at com.sfs.webapp.server.Service.getRequestProperties(Service.java:105)
 at com.sfs.webapp.server.Service.service(Service.java:265)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
 at 
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
 at 
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
 at java.security.AccessController.doPrivileged(Native Method)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
 at 
com.mycompany.filters.analysis.AnalysisFilter.doFilter(AnalysisFilter.java:114)the
 very bottom mycompany is my filter being processed. I am trying to attach this 
filter onto a web application (com.sfs.webapp.xxxxx above)  running here on the 
intranet. I guess it's the webapp that might be causing a crash inside it's 
getRequestProperties method? I'm assuming it's normal 
form processing though?

I don't have access to the "webapp" source either. Might pose a problem? :)

I dont need to post the web.xml configuration file since my filter is the ONLY 
configured filter on the server.

Thoughts? 

Thanks,
Paul


  _____  

From: Laurie Harper [mailto:[EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Tue, 06 Mar 2007 16:25:26 -0500
Subject: Re: [s1] Filters / State Exceptions

Without seeing your filter code and web.xml it's hard to be sure, but my 
  guess would be that you need to modify the order you apply your filters 
  in. Remember that, with a file upload, form parameters are transmitted 
  in the request body rather than as a query string. It sounds like 
  req.getParameter() is being intercepted by one of the filters in the 
  chain that precedes yours or something. Post your code, web.xml and full 
  stack trace if you still need help isolating the problem.
  
  L.
  
  Paul Saumets wrote:
  > As a side note,
  > 
  > My filter has a couple req.getParameter calls (which I think in-turn calls 
an InputStream somehow?) in it's doFilter method which seems to be causing the 
state exceptions later after a form is submitted.
  > 
  > Is there a way to avoid this or a way to ensure filters arn't processed 
when a form is submitted?
  > 
  > Regards,
  > Paul
  >   _____  
  > 
  > From: Paul Saumets [mailto:[EMAIL PROTECTED]
  > To: user@struts.apache.org
  > Sent: Tue, 06 Mar 2007 14:44:32 -0500
  > Subject: [s1] Filters / State Exceptions
  > 
  > Hey,
  >   
  >   I'm hoping someone here could give me some insight why I'm getting an 
IllegalStateException with my filter. 
  >   
  >   
  >   java.lang.IllegalStateException: getInputStream() has already been called 
for this request
  >   
  >   My filter calls InputStream in it's init method because it requires to 
read information from a config file.
  >   
  >   the doFilter method has absolutely no stream calls. The filter works fine 
until I submit a form. If I go to a page that has a form
  >   and submit I then receive the above state exception?
  >   
  >   Would anyone have any insight why this might be? 
  >   
  >   I'm going to get around this by dropping my config file and just using 
filter init-params in my web.xml file instead but I would 
  >   REALLY like to know why this was occuring just for some understanding.
  >   
  >   Regards,
  >   Paul
  >     
  
  
  ---------------------------------------------------------------------
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
    

Reply via email to