struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saeed Iqbal <saee...@gmail.com>
Subject Re: Dealing / determining lost session in Struts application
Date Wed, 25 Nov 2009 05:38:18 GMT
Isnt it that you want try catch block instead of throw'ing exceptions to be
able to nicely handle errors.

On Wed, Nov 25, 2009 at 11:16 AM, Paul Benedict <pbenedict@apache.org>wrote:

> Dave is correct. In fact, that's not a kludge but a pretty official
> way of doing things.
>
> http://forums.sun.com/thread.jspa?forumID=427&threadID=523120
>
> Paul
>
> On Tue, Nov 24, 2009 at 12:38 PM, Kawczynski, David
> <david_kawczynski@merck.com> wrote:
> > How about this kludge:
> >
> > the filter checks session isNew()
> > and checks the referring domain -- if it's null or
> > not your own domain, send them to the login screen.
> > Otherwise send them to the session timeout screen.
> >
> >
> >> -----Original Message-----
> >> From: Himstedt, Maik (EXTERN: T-Systems on)
> >> [mailto:extern.maik.himstedt@volkswagen.de]
> >> Sent: Tuesday, November 24, 2009 11:29 AM
> >> To: user@struts.apache.org
> >> Subject: Dealing / determining lost session in Struts application
> >>
> >> Hi,
> >>
> >> I'm tasked with killing a bug related to session management
> >> and Struts 1.3.10 in a rather conventional JEE web
> >> application. The problem is that after the session times out,
> >> the application throws a rather ugly exception, something like:
> >>
> >> 2009-11-04 11:45:46,803 ERROR
> >> de.mypackage.ipad.util.hibernate.HibernateFilter - An
> >> Exception occured.
> >> javax.servlet.ServletException: BeanUtils.populate
> >>       at
> >> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
> >>       at
> >> org.apache.struts.action.RequestProcessor.processPopulate(Requ
> >> estProcessor.java:821)
> >>       at
> >> org.apache.struts.action.RequestProcessor.process(RequestProce
> >> ssor.java:254)
> >>       at
> >> org.apache.struts.action.ActionServlet.process(ActionServlet.j
> >> ava:1482)
> >>       at...
> >>
> >> What I understand is that after the session is gone, the
> >> internal Struts processing tries to put some data into
> >> session-stored objects. It does so with help of Apache
> >> BeanUtils and I'm aware that this will crash, of course. My
> >> goal is to present a page with a clean message that the
> >> session is gone and the user has to re-enter the application.
> >> Catching the ServletException at application level (via
> >> web.xml) is a bad idea because of the rather generic
> >> exception thrown. My current take is that I need a filter
> >> which is called before the Struts servlet is called and the
> >> filter checks the session beforehand via standard Java API
> >> (isNew()). For a new session the user is redirected to a
> >> descriptive error page. This might work if the user is
> >> already in the application and takes a break, but isNew()
> >> will return true at the first entry as well which is
> >> nonsense, of course.
> >>
> >> What is the best practice to deal with this problem for a
> >> Struts 1.3 application? Or is this not a standard problem and
> >> the cause might be something different?
> >>
> >>
> >> Mit freundlichen Grüßen
> >>
> >>
> >> Maik Himstedt
> >>
> >> T-Systems on site services GmbH
> >> Procurement Systems
> >> Telefon/phone: +49-5361-9-44026
> >> E-Mail: extern.maik.himstedt@volkswagen.de
> >> --------------------------------------------------------------
> >> ------------------
> >>
> >> Maik Himstedt
> >> Consultant
> >> Benzstraße 25a, 38446 Wolfsburg
> >> +49-5361-464 78-0 (Tel.)
> >> +49-5361-464 78-10 (Fax)
> >> E-Mail: maik.himstedt@t-systems.com
> >> Internet: http://www.t-systems-onsite.de
> >>
> >> Geschäftsführung: Stefan Kappe, Thomas Müller-Braun
> >> Handelsregister: Amtsgericht Berlin HRB 51336
> >> Sitz der Gesellschaft: Berlin
> >>
> > Notice:  This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
> Jersey, USA 08889), and/or its affiliates Direct contact information for
> affiliates is available at http://www.merck.com/contact/contacts.html)
> that may be confidential, proprietary copyrighted and/or legally privileged.
> It is intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and then
> delete it from your system.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Saeed Iqbal
CEO
http://www.iqbalconsulting.com
Struts - J2EE - Application Architects and Developers

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message