Well you go down the chain create the result and then back up the chain.
So when going back up the response should already be committed.

see: https://struts.apache.org/docs/writing-interceptors.html

//modified code from above link to clarify
    public String intercept(ActionInvocation invocation) throws Exception {
       //do stuff before response, going down the chain
       String result = invocation.invoke();
       //do stuff after response, going back up the chain, can't do what
you seem to be trying to do here...
       return result;
    }

That aside, "Cannot create a session" isn't a good message because you
shouldn't be trying to create a session at all! It's part of the containers
responsibility to do that. You just ask for it. So the real cause of the
issue might be something else.

On Wed, Jan 6, 2016 at 11:41 AM, Greg Lindholm <greg.lindh...@gmail.com>
wrote:

> Inside an Interceptor I'm getting an exception
>
> java.lang.IllegalStateException: Cannot create a session after the response
> has been committed
> I have access to the ActionInvocation as this is passed into doIntercept()
> public String doIntercept(ActionInvocation invocation) throws Exception
>
> My question is: from the ActionInvocation how do I find out if the response
> has been committed?
>
> Can I get the HttpServletResponse? So I can call response.isCommitted() ?
>
> How?
>
> Thanks,
> Greg
>

Reply via email to