illegal state exception
hi friends,
whenever i use filters i am getting this exception. please help me here. thanks
code]HTTP Status 500 -
--
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:599)
org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:163)
org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:122)
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115)
org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:190)
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
org.apache.jsp.protected_.hello_jsp._jspService(hello_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
filters.ActionByTimeFilter.doFilter(ActionByTimeFilter.java:100)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
--
Apache Tomcat/5.0.28[/code]
i am always getting this error
[1784 byte] By [
bobza] at [2007-10-3 0:48:40]

my filter file ...i never used anything as we discussed above
package filters;
import java.io.IOException;
import java.util.HashSet;
import java.util.StringTokenizer;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
//import org.apache.log4j.Logger;
/**
* Mantis issue 1762 : To implement the warning before logging out functionality.
* @author psbabu
*/
public class ActionByTimeFilter implements Filter {
private final static String DEFAULT_SCRIPT_URL = "/jscript/throwpopup.js";
private final static String DELIMITER_CHAR = ",";
//private final static Logger log = Logger.getLogger(ActionByTimeFilter.class);
private FilterConfig config;
private String scriptUrl;
private HashSet exclusivePages;
/**
* @param DEFAULT_SCRIPT_URL
* @param DELIMITER_CHAR
* @param log
* @param config
* @param scriptUrl
* @param exclusivePages
*/
public void init(FilterConfig config) throws ServletException {
//log.info("Entering a method");
this.config = config;
String scriptUrl = this.config.getInitParameter("checktimer-script-url");
//log.assertLog((scriptUrl!=null), "String scriptUrl = null");
this.scriptUrl = (scriptUrl != null) ? scriptUrl : DEFAULT_SCRIPT_URL;
/**
* @param exclusiveListPages specifies the param value of "exclusive-pages-of-checkingtimer"
*/
///String exclusiveListPages = this.config.getInitParameter("exclusive-pages-of-checkingtimer");
//log.assertLog((exclusiveListPages!=null), "String exclusiveListPages = null");
//if (exclusiveListPages != null && exclusiveListPages.length() > 0) {
//this.exclusivePages = populateExclusivePages(exclusiveListPages);
//}
//log.debug("Initialize parameters in web.xml: checktimer-script-url = " + scriptUrl
//+ "; exclusive-pages-of-checkingtimer.size = " + exclusivePages);
/*if (log.isInfoEnabled()) {
log.info("Setting initialize parameters: checktimer-script-url = " + this.scriptUrl
+ "; exclusive-pages-of-checkingtimer.size = " + this.exclusivePages.size());
log.info("Exiting the method");
} */
}
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpReq = null;
if (req instanceof HttpServletRequest) {
httpReq = (HttpServletRequest) req;
String status = (String) httpReq.getAttribute("checktimerStatus");
RequestDispatcher rd = httpReq.getRequestDispatcher(scriptUrl);
rd.include(req, res);
httpReq.setAttribute("checktimerStatus", "inserted");
//log.debug("The script throwpopup.js "
//+ (String) req.getAttribute("servletname"));
} else {
//log.warn("The check timer filter is runnig out of servlet context");
}
chain.doFilter(req, res);
}
public void destroy() {
this.config = null;
this.exclusivePages = null;
}
/*private HashSet populateExclusivePages(String exclusiveListPages) {
HashSet exclusiveSet = null;
if (exclusiveListPages != null && exclusiveListPages.length() > 0) {
exclusiveSet = new HashSet();
//log.assertLog((exclusiveSet!=null), "HashSet exclusiveSet = null");
StringTokenizer tokenizer = new StringTokenizer(exclusiveListPages.trim(), DELIMITER_CHAR);
//log.assertLog((tokenizer!=null), "StringTokenizer tokenizer = null");
while (tokenizer.hasMoreTokens()) {
exclusiveSet.add(tokenizer.nextToken());
}
}
return exclusiveSet;
}*/
}
bobza at 2007-7-14 17:43:42 >
