Hi Greg, I seem to recall that this is not the best way to handle the session and generally speaking, it always better to abstract as much as possible http's details
I could be wrong, but It would be better if your action implements a specific interface (SessionAware or HttpSessionAware) Twitter :http://www.twitter.com/m_cucchiara G+ :https://plus.google.com/107903711540963855921 Linkedin :http://www.linkedin.com/in/mauriziocucchiara VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara Maurizio Cucchiara On 6 February 2014 14:14, Greg Lindholm <greg.lindh...@gmail.com> wrote: > I have an Interceptor that wants to put something in the session after the > action has executed. > > But if the session doesn't already exist I get an exception: > > java.lang.IllegalStateException: Cannot create a session after the response > has been committed > How can I determine if the session already exists from within an > Interceptor? > > public String doIntercept(ActionInvocation invocation) throws Exception > { > String result = invocation.invoke(); > Map<String, Object> session = > invocation.getInvocationContext().getSession(); > session.put(key, value); // throws exception if session doesn't exist > return result; > } > > Thanks > Greg >