struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JP Cafaro <jcafar...@gmail.com>
Subject Wildcard matching problem!
Date Fri, 16 Jul 2010 15:17:30 GMT
I'm having some issues with wildcard mapping.  I wanted to catch all 
attempts to visit anything behind "/secure".

   <constant name="struts.enable.SlashesInActionNames" value="true"/>
    <package name="my-secure-url" extends="my-secure" namespace="/secure**">
        <action name="*">
            <interceptor-ref name="secureStack"/>
               <result>/authenticate/login-page</result>
         </action>
    </package>

This works if I try to visit "/secure/anything/anything/etc" and if I'm 
not logged in, I get directed to the login page.  However if I just 
logged in and I'm at 
"http://localhost:8080/Struts2NewChapter8/secure/admin-portfolio" and I 
click a link to 
"http://localhost:8080/Struts2NewChapter8/secure/update/update-account-form", 
for example, I get errors that look like this:
[code]    
WARNING: Error setting expression '0' with value '/secure/update'
ognl.InappropriateExpressionException: Inappropriate OGNL expression: 0
    at ognl.SimpleNode.setValueBody(SimpleNode.java:312)
    at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
    at ognl.SimpleNode.setValue(SimpleNode.java:301)
    at ognl.Ognl.setValue(Ognl.java:737)
    at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:198)
    at 
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:161)
    at 
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:149)
    at 
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:155)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
    at 
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
interceptors.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:92)
    at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at 
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    at 
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
    at 
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    at 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Unknown Source)
[/code]
Here's my simple intercept method if you're curious:
[code]    
public String intercept( ActionInvocation actionInvocation ) throws 
Exception {

        System.out.println("Intercepting");
        
        
        Map session = actionInvocation.getInvocationContext().getSession();
                
        
        User user = (User) session.get( Struts2PortfolioConstants.USER );
        
        if (user == null)
        {
            return Action.LOGIN;
        }
        
        
        else {
                
            Action action = ( Action ) actionInvocation.getAction();
            
            if (action instanceof UserAware)
            {
                ((UserAware)action).setUser(user);
            }
            System.out.println("Logged in: interceptor");
            return actionInvocation.invoke();
        }

    }
[/code]


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message