On Thu, 4 Apr 2002 18:13:31 -0800
"Heath Chiavettone" <[EMAIL PROTECTED]> wrote:
> If you are using a Servlet 2.3 compliant application server, you could write
> a filter that does this automatically for you and apply the filter to the
> action servlet.
I have decided to take the filter approach. Here is what I have written, but this
code dies on line (0)
public class TestFilter implements Filter
{
private FilterConfig filterConfig;
public void doFilter (ServletRequest request,
ServletResponse response,
FilterChain chain)
{
try
{
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader("Cache-Control", "no-cache");
httpResponse.setHeader("Pragma", "no-cache");
httpResponse.setHeader("Expires", "-1");
chain.doFilter(request, response); --(0)
} catch (IOException io) {
System.out.println ("IOException ");
} catch (ServletException se) {
System.out.println ("ServletException");
}
}
The error I am getting is
2002-04-05 13:24:16 StandardWrapperValve[action]: Servlet.service() for servlet action
threw exception
java.lang.IllegalStateException: Cannot create a session after the response has been
committed
at
org.apache.catalina.connector.HttpRequestBase.doGetSession(HttpRequestBase.java)
at
org.apache.catalina.connector.HttpRequestBase.getSession(HttpRequestBase.java)
at
org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade.java)
at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequest
How can I make my filter work?
Cheers
Tony
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>