Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 20217 invoked from network); 23 Jun 2009 08:42:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jun 2009 08:42:10 -0000 Received: (qmail 68174 invoked by uid 500); 23 Jun 2009 08:42:19 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 68126 invoked by uid 500); 23 Jun 2009 08:42:19 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 68116 invoked by uid 99); 23 Jun 2009 08:42:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jun 2009 08:42:19 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of poulwiel@gmail.com designates 209.85.217.218 as permitted sender) Received: from [209.85.217.218] (HELO mail-gx0-f218.google.com) (209.85.217.218) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jun 2009 08:42:08 +0000 Received: by gxk18 with SMTP id 18so5791967gxk.11 for ; Tue, 23 Jun 2009 01:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=pvWSvrIYNmVmU+hAg7qW5/e7x2VlJFIRS9zYdQNqACg=; b=oai+t57w0YtIi8QRWafKz+QWM7UXoN7yg6eSyHz4M98Q4uJdmmehCwUW8xUDp83NNr FfNZ/cr5LVhUAX5AOHLlKpgiofVTrP0IY6NrJfytgneTSVZlXKwi7ECdi+DFvbc9Gv25 XuzINBizlsh8Qfg+FyYpT37n2lHf1F8zygUAM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=TUfYSrLX/d6w38/52Iyb2l6jtcnfwJnN3fXIH+Mgm+9PDy79RogOUyuY5DkwIZmFHQ 3zD3Mds31suZdA3c8c3Y30b7VuipQfeZRb8P4eaOGPFdCTl1EKrKptYgv7SU5s2YDKCB xwPH73rFmtBVq8pmkJgWXxG3N6qcR140teDBE= MIME-Version: 1.0 Received: by 10.90.93.17 with SMTP id q17mr6065316agb.50.1245746508179; Tue, 23 Jun 2009 01:41:48 -0700 (PDT) In-Reply-To: <20090623013319.GA24486@jtkpc.cmp.uea.ac.uk> References: <20090623013319.GA24486@jtkpc.cmp.uea.ac.uk> Date: Tue, 23 Jun 2009 06:41:48 -0200 Message-ID: <5e5424000906230141u7275e06fvc4ef2e51855d13f4@mail.gmail.com> Subject: Re: Exceptions thrown by constructor different from those thown by execute() ? From: =?ISO-8859-2?Q?Pawe=B3_Wielgus?= To: Struts Users Mailing List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Jan, i'm not going into details of your solution but interceptors are a way better tool for that job, search the list for authentication subjects. You can also use libraries like acegi or similiar. Best greetings, Pawel Wielgus. 2009/6/22, Jan T. Kim : > Dear All, > > I'm trying to use exceptions to make sure a user is logged in, using > struts 2.1.6. My idea is > > * a subclass of ActionSupport that checks that a user is logged > in, and throws a NotLoggedInException if that's not the case > > * all other action handlers are subclasses of that subclass > > * use a global exception mapping to map the NotLoggedInException > to a suitable login action > > I can't seem to get this to work, I get a 500 response with a stack > trace, saying "Unable to instantiate Action". If I arrange for the > constructor to complete without an exception and for the execute() > method to throw a NotLoggedInException, I get to the login action as > I intend. > > So it seems that only exceptions thrown by execute(), but not those > thrown by constructors, are handled as specified by the exception > mappings (at least the global ones) -- is that right? And if so, why > is that? > > Or do you thing I've just made some silly mistake here? > > Best regards, Jan > -- > +- Jan T. Kim -------------------------------------------------------+ > | email: j.kim@uea.ac.uk | > | WWW: http://www.cmp.uea.ac.uk/people/jtk | > *-----=< hierarchical systems are for files, not for humans >=-----* > > --------------------------------------------------------------------- > 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