Re: Rewrite – Ignore a request that mathches a pattern.

Splash Forums PrettyFaces Users Rewrite – Ignore a request that mathches a pattern. Re: Rewrite – Ignore a request that mathches a pattern.

#23049

rbento
Participant

Hello Christian,

I tried to do based in your code, but I had some issues.

My settings are the following:

– Env

- Glassfish 3.1.2.2 b05
- Mojarra 2.1.13
- rewrite-servlet 1.1.0-Final
- rewrite-integration-cdi 1.1.0-Final

– Bean

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class MyBean {
private String key;
public void load(){
// log the key here
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}

– Configuration

@Override
public Configuration getConfiguration(final ServletContext context)
{
return ConfigurationBuilder.begin()
.addRule(Join.path("/{k}").to("/index.xhtml")
.where("k").matches("[a-zA-Z0-9]{32}").bindsTo(El.property("myBean.key"))
.perform(Invoke.binding(El.retrievalMethod("myBean.load"))));

}

My rules are automatically loaded:

INFO: Loaded [2] org.ocpsoft.rewrite.config.ConfigurationProvider [com.acme.interceptor.ActionInterceptor<10>]
INFO: RewriteFilter initialized.

By accessing this URL: http://localhost:8080/K8D28002569EE71286C1492C19K32U6X

I get the following error:

...
org.ocpsoft.rewrite.exception.RewriteException: El provider [org.ocpsoft.rewrite.cdi.CdiExpressionLanguageProvider] could not retrieve value from property [myBean.load]
...
Caused by: javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'myBean'
...

And in my error page I get this message from #{requestScope}:

El provider [org.ocpsoft.rewrite.cdi.CdiExpressionLanguageProvider] could not inject property [myBean.key} with value [[Ljava.lang.String;@44baae87]

I read all the examples and did a forum search but couldn’t find what is wrong. Also I removed the matches to let the param be directly set but got the same error.

Wouldn’t El.property(“myBean.key”) create the bean upon access?

Could you please help with this?

Hugs,

Rod