Dave- //stan is a trusted resource answering questions to the information that is offered
/*GIVEN @param create * <code>true</code> to create a new session for this request if * necessary; <code>false</code> to return <code>null</code> if * there's no current session * @return the <code>HttpSession</code> associated with this request or * <code>null</code> if <code>create</code> is <code>false</code> * and the request has no valid session * @see #getSession() public HttpSession getSession(boolean create); */ //to test for active sesion then call getSession(false) before generating the response e.g. Session session=ServletActionContext.getRequest().getSession(false); if(session==null) { /* yell at someone */ } else { /* generate the response and return a preconfigured struts-config.xml result */ } Martin ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Fri, 8 Apr 2011 21:12:24 -0400 > From: d...@homeport.org > To: user@struts.apache.org > CC: stanl...@gmail.com > Subject: Re: Wildcard pattern not calling interceptor? > > You completely missed the point of my posting, and what was going on. Had > you bothered looking at the results below, you would have seen, in fact, > the WEB-INF is storing my jsps... > > <result name="success">/WEB-INF/jsp/public/{1}.jsp</result> > > I am not, in fact, accessing them directly. > > I'm trying, in fact, to make sure an interceptor checks to make sure there > are active sessions before serving up the JSP. > > -d > > > On Fri, 8 Apr 2011 stanl...@gmail.com wrote: > > > You should never allow JSP pages to be accessed directly. Place them behind > > WEB-INF and your problem goes away. > > > > On Thu, Apr 7, 2011 at 8:46 PM, Dave Shevett <d...@homeport.org> wrote: > > > >> I have an app that uses a generic interceptor on all action calls to verify > >> if the session is active, and if it isn't, it returns 'notloggedin', which > >> I > >> have a global result for. > >> > >> This works -great-, except for one of my actions, which is a generic loader > >> for JSP's. > >> > >> The interceptor definition: > >> > >> <interceptor-stack name="pppweb"> > >> <interceptor-ref name="siteConfigCheck" /> > >> <interceptor-ref name="paramsPrepareParamsStack" /> > >> <interceptor-ref name="publicLoginChecker" /> > >> </interceptor-stack> > >> > >> 'publicloginchecker' has a simple "checking session" debug rule. For all > >> normal calls that have an action mapped, it always says it's checking the > >> session. But many of my actions I have a SUCCESS entry that does somethign > >> like this: > >> > >> <result name="success" type="redirectAction">public/MyHome</result> > >> > >> And I have a generic JSP catcher: > >> > >> <action name="public/*" class="com.stonekeep.congo.web.WebActions"> > >> <interceptor-ref name="pppweb"/> > >> <result name="success">/WEB-INF/jsp/public/{1}.jsp</result> > >> <result name="input">/WEB-INF/jsp/public/{1}.jsp</result> > >> </action> > >> > >> Last but not least, I have a global results entry: > >> <result name="notloggedin" type="redirectAction">public/Welcome</result> > >> > >> All of this works just spiffily. The JSP's render, all is well, EXCEPT in > >> the case where I hit a JSP directly via public/SomeJspName. In this > >> situation, the JSP renders, but hte interceptor does not trigger. This > >> results in odd behaviour for folks who have had a session timeout, or are > >> hitting random URLs for JSP pages. They see the page, it has no session > >> content. > >> > >> Help? > >> > >> -dave > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >> For additional commands, e-mail: user-h...@struts.apache.org > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >