URL rewriting with PrettyFaces, URLMapping and pretty:link

Splash Forums PrettyFaces Users URL rewriting with PrettyFaces, URLMapping and pretty:link

This topic contains 16 replies, has 4 voices, and was last updated by  jlgranda 4 years, 7 months ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #18673

    balteo
    Participant

    Hello,

    We have a JSF 2.x application that runs with PrettyFaces 3.3.3. We have a slight issue with URL rewriting which is as follows:

    The following pretty:link

    <a href="/lang/fr/galerie">Galerie</a>

    translates into this when the locale is English:

    <a href="/lang/en/galerie">Gallery</a>

    whereas I’d rather it were:

    <a href="/lang/en/gallery">Gallery</a>

    The problem is that the URLMapping only allows a hard-coded value.

    Can anyone please provide advice as to how to make sure the URLs are rewritten all over and that /lang/en/galerie no longer appears anywhere?

    Do I need to use Rewrite or will Pretty faces be sufficient?

    Regards,

    J.

    #22896

    Without seeing your configuration, I’m guessing that you would probably need to add another parameter to hold the internationalized value of your URL. We have been trying to gather ideas about this, but nobody seems to have the time to really sit down with us and figure out a good way to do it.

    i18n support is on the roadmap for Rewrite, but right now, neither will explicitly support this without you writing some custom code (it’s probably easier to do that with Rewrite, but it should still be possible with PrettyFaces.) It depends on which features of PrettyFaces you are using.

    #22897

    balteo
    Participant

    Hi Lincoln!

    I haven’t got that many URLs to i18n and I don’t mind using some custom code.

    I would like to use Rewrite. Can you give some pointers as to how to go about doing this?

    Regards,

    J.

    #22898

    You can try an approach like this:

    public class BundleTricksProvider extends HttpConfigurationProvider {

    @Override
    public Configuration getConfiguration(ServletContext context) {
    return ConfigurationBuilder.begin()
    // Locale Switch
    .addRule(Join.path("/{locale}/{page}.html").to("/{page}.xhtml")
    .where("page").matches(".*")
    .where("locale").bindsTo(PhaseBinding.to(El.property("#{languageSwitch.localeCode}")).after(PhaseId.RESTORE_VIEW)));
    }

    @Override
    public int priority() {
    return 10;
    }
    }

    From this article (near the bottom) – http://blog.eisele.net/2012/08/resource-bundle-tricks-and-best.html

    #22899

    balteo
    Participant

    I have implemented the following configuration:

    `@Override

    public Configuration getConfiguration(ServletContext context) {

    log.debug(“getConfiguration”);

    return ConfigurationBuilder.begin()

    .addRule(Join.path(“/lang/en/gallery”).to(“/lang/en/galerie”).withInboundCorrection())

    .addRule(Join.path(“/lang/en/biography”).to(“/lang/en/biographie”).withInboundCorrection())

    .addRule(Join.path(“/lang/en/newsletter-registration”).to(“/lang/en/inscription-newsletter”).withInboundCorrection())

    .addRule(Join.path(“/lang/en/contact”).to(“/lang/en/contact”).withInboundCorrection())//HERE

    .addRule(Join.path(“/lang/en/works-made-to-order”).to(“/lang/en/commandes-personnalisees”).withInboundCorrection())

    .addRule(Join.path(“/lang/en/links”).to(“/lang/en/liens”).withInboundCorrection());

    }`

    Unfortunately, the line marked //HERE throws an exception (see below). It seems that it does not like the fact that the rule maps the same URLs… Unfortunately, the English for “contact” is the same as the French for “contact”…

    If I remove the rule, the same error occurs.

    23 août 2012 20:47:31 com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
    GRAVE: Error Rendering View[/contact.xhtml]
    java.lang.NullPointerException
    at org.ocpsoft.rewrite.servlet.config.Path.evaluateHttp(Path.java:101)
    at org.ocpsoft.rewrite.servlet.config.HttpCondition.evaluate(HttpCondition.java:41)
    at org.ocpsoft.rewrite.servlet.config.rule.Join.evaluate(Join.java:139)
    at org.ocpsoft.rewrite.config.And.evaluate(And.java:55)
    at org.ocpsoft.rewrite.config.RuleBuilder.evaluate(RuleBuilder.java:101)
    at org.ocpsoft.rewrite.config.And.evaluate(And.java:55)
    at org.ocpsoft.rewrite.config.RuleBuilder.evaluate(RuleBuilder.java:101)
    at org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider.rewriteHttp(DefaultHttpRewriteProvider.java:62)
    at org.ocpsoft.rewrite.servlet.http.HttpRewriteProvider.rewrite(HttpRewriteProvider.java:44)
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.rewrite(HttpRewriteWrappedResponse.java:288)
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.encodeURL(HttpRewriteWrappedResponse.java:264)
    at com.sun.faces.context.ExternalContextImpl.encodeActionURL(ExternalContextImpl.java:514)
    at javax.faces.context.ExternalContextWrapper.encodeActionURL(ExternalContextWrapper.java:104)
    at com.sun.faces.renderkit.html_basic.FormRenderer.getActionStr(FormRenderer.java:235)
    at com.sun.faces.renderkit.html_basic.FormRenderer.encodeBegin(FormRenderer.java:135)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:424)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
    at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163)
    at org.ocpsoft.rewrite.faces.RewriteViewHandler.renderView(RewriteViewHandler.java:151)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:182)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:690)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:477)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    ̀

    #22900

    If the spellings are the same then what are you trying to accomplish by forwarding a URL to itself?

    #22901

    balteo
    Participant

    Here is what I get if I comment out the rule:

    DEBUG [21:21:47,940] (I18nProvider.java:17) - getConfiguration
    23 août 2012 21:21:47 com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
    GRAVE: Error Rendering View[/contact.xhtml]
    java.lang.NullPointerException
    at org.ocpsoft.rewrite.servlet.config.Path.evaluateHttp(Path.java:101)
    at org.ocpsoft.rewrite.servlet.config.HttpCondition.evaluate(HttpCondition.java:41)
    at org.ocpsoft.rewrite.servlet.config.rule.Join.evaluate(Join.java:139)
    at org.ocpsoft.rewrite.config.And.evaluate(And.java:55)
    at org.ocpsoft.rewrite.config.RuleBuilder.evaluate(RuleBuilder.java:101)
    at org.ocpsoft.rewrite.config.And.evaluate(And.java:55)
    at org.ocpsoft.rewrite.config.RuleBuilder.evaluate(RuleBuilder.java:101)
    at org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider.rewriteHttp(DefaultHttpRewriteProvider.java:62)
    at org.ocpsoft.rewrite.servlet.http.HttpRewriteProvider.rewrite(HttpRewriteProvider.java:44)
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.rewrite(HttpRewriteWrappedResponse.java:288)
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.encodeURL(HttpRewriteWrappedResponse.java:264)
    at com.sun.faces.context.ExternalContextImpl.encodeActionURL(ExternalContextImpl.java:514)
    at javax.faces.context.ExternalContextWrapper.encodeActionURL(ExternalContextWrapper.java:104)
    at com.sun.faces.renderkit.html_basic.FormRenderer.getActionStr(FormRenderer.java:235)
    at com.sun.faces.renderkit.html_basic.FormRenderer.encodeBegin(FormRenderer.java:135)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:424)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
    at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163)
    at org.ocpsoft.rewrite.faces.RewriteViewHandler.renderView(RewriteViewHandler.java:151)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:182)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:690)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:477)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    DEBUG [21:21:47,943] (ViewExpiredExceptionExceptionHandler.java:28) - getWrapped
    DEBUG [21:21:47,944] (ViewExpiredExceptionExceptionHandler.java:28) - getWrapped
    DEBUG [21:21:47,945] (ViewExpiredExceptionExceptionHandler.java:34) - handle
    DEBUG [21:21:47,945] (ViewExpiredExceptionExceptionHandler.java:28) - getWrapped
    DEBUG [21:21:47,946] (ViewExpiredExceptionExceptionHandler.java:28) - getWrapped
    23 août 2012 21:21:47 org.apache.catalina.core.ApplicationDispatcher invoke
    GRAVE: "Servlet.service()" pour la servlet Faces Servlet a lancé une exception
    java.lang.NullPointerException
    at org.ocpsoft.rewrite.servlet.config.Path.evaluateHttp(Path.java:101)
    at org.ocpsoft.rewrite.servlet.config.HttpCondition.evaluate(HttpCondition.java:41)
    at org.ocpsoft.rewrite.servlet.config.rule.Join.evaluate(Join.java:139)
    at org.ocpsoft.rewrite.config.And.evaluate(And.java:55)
    at org.ocpsoft.rewrite.config.RuleBuilder.evaluate(RuleBuilder.java:101)
    at org.ocpsoft.rewrite.config.And.evaluate(And.java:55)
    at org.ocpsoft.rewrite.config.RuleBuilder.evaluate(RuleBuilder.java:101)
    at org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider.rewriteHttp(DefaultHttpRewriteProvider.java:62)
    at org.ocpsoft.rewrite.servlet.http.HttpRewriteProvider.rewrite(HttpRewriteProvider.java:44)
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.rewrite(HttpRewriteWrappedResponse.java:288)
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.encodeURL(HttpRewriteWrappedResponse.java:264)
    at com.sun.faces.context.ExternalContextImpl.encodeActionURL(ExternalContextImpl.java:514)
    at javax.faces.context.ExternalContextWrapper.encodeActionURL(ExternalContextWrapper.java:104)
    at com.sun.faces.renderkit.html_basic.FormRenderer.getActionStr(FormRenderer.java:235)
    at com.sun.faces.renderkit.html_basic.FormRenderer.encodeBegin(FormRenderer.java:135)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:424)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
    at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163)
    at org.ocpsoft.rewrite.faces.RewriteViewHandler.renderView(RewriteViewHandler.java:151)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:182)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:690)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:477)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    23 août 2012 21:21:47 org.apache.catalina.core.StandardWrapperValve invoke
    GRAVE: Servlet.service() for servlet [default] in context with path [/jeanbaptistemartin] threw exception [null] with root cause
    java.lang.NullPointerException
    at org.ocpsoft.rewrite.servlet.config.Path.evaluateHttp(Path.java:101)
    at org.ocpsoft.rewrite.servlet.config.HttpCondition.evaluate(HttpCondition.java:41)
    at org.ocpsoft.rewrite.servlet.config.rule.Join.evaluate(Join.java:139)
    at org.ocpsoft.rewrite.config.And.evaluate(And.java:55)
    at org.ocpsoft.rewrite.config.RuleBuilder.evaluate(RuleBuilder.java:101)
    at org.ocpsoft.rewrite.config.And.evaluate(And.java:55)
    at org.ocpsoft.rewrite.config.RuleBuilder.evaluate(RuleBuilder.java:101)
    at org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider.rewriteHttp(DefaultHttpRewriteProvider.java:62)
    at org.ocpsoft.rewrite.servlet.http.HttpRewriteProvider.rewrite(HttpRewriteProvider.java:44)
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.rewrite(HttpRewriteWrappedResponse.java:288)
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.encodeURL(HttpRewriteWrappedResponse.java:264)
    at com.sun.faces.context.ExternalContextImpl.encodeActionURL(ExternalContextImpl.java:514)
    at javax.faces.context.ExternalContextWrapper.encodeActionURL(ExternalContextWrapper.java:104)
    at com.sun.faces.renderkit.html_basic.FormRenderer.getActionStr(FormRenderer.java:235)
    at com.sun.faces.renderkit.html_basic.FormRenderer.encodeBegin(FormRenderer.java:135)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:424)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
    at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163)
    at org.ocpsoft.rewrite.faces.RewriteViewHandler.renderView(RewriteViewHandler.java:151)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:182)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:690)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:477)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    DEBUG [21:21:47,953] (I18nProvider.java:17) - getConfiguration

    #22902

    What did you comment out?

    #22903

    Something is mis-configured now. You’re missing an initialization somewhere.

    #22904

    balteo
    Participant

    Hi Lincoln,

    Let me provide the full configuration:

    com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor:

    package com.jeanbaptistemartin.rewrite;

    import com.ocpsoft.pretty.faces.config.PrettyConfig;

    import com.ocpsoft.pretty.faces.config.mapping.UrlAction;

    import com.ocpsoft.pretty.faces.config.mapping.UrlMapping;

    import com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor;

    import javax.servlet.ServletContext;

    import org.apache.log4j.Logger;

    /**

    *

    * @author julien

    */

    public class PrettyFacesPostProcessor implements ConfigurationPostProcessor {

    private static transient Logger log = Logger.getLogger(PrettyFacesPostProcessor.class);

    @Override

    public PrettyConfig processConfiguration(ServletContext sc, PrettyConfig pc) {

    log.debug("processConfiguration");

    UrlAction rootAction = new UrlAction("#{accueilView.changeLocale}");

    UrlMapping biographieMapping = (UrlMapping) pc.getMappingById("biographieAction");

    biographieMapping.addAction(rootAction);

    UrlMapping commandesPersonnaliseesMapping = (UrlMapping) pc.getMappingById("commandesPersonnaliseesAction");

    commandesPersonnaliseesMapping.addAction(rootAction);

    UrlMapping contactMapping = (UrlMapping) pc.getMappingById("contactAction");

    contactMapping.getActions().add(0, rootAction);

    UrlMapping galerieMapping = (UrlMapping) pc.getMappingById("galerieAction");

    galerieMapping.getActions().add(0, rootAction);

    UrlMapping liensMapping = (UrlMapping) pc.getMappingById("liensAction");

    liensMapping.getActions().add(0, rootAction);

    UrlMapping sculptureMapping = (UrlMapping) pc.getMappingById("sculptureAction");

    sculptureMapping.getActions().add(0, rootAction);

    UrlMapping inscriptionNewsletterMapping = (UrlMapping) pc.getMappingById("inscriptionNewsletterAction");

    inscriptionNewsletterMapping.getActions().add(0, rootAction);

    return pc;

    }

    }

    org.ocpsoft.rewrite.config.ConfigurationProvider:

    package com.jeanbaptistemartin.rewrite;

    import javax.servlet.ServletContext;

    import org.apache.log4j.Logger;

    import org.ocpsoft.rewrite.config.Configuration;

    import org.ocpsoft.rewrite.config.ConfigurationBuilder;

    import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;

    import org.ocpsoft.rewrite.servlet.config.rule.Join;

    public class I18nProvider extends HttpConfigurationProvider {

    private static final Logger log = Logger.getLogger(I18nProvider.class);

    @Override

    public Configuration getConfiguration(ServletContext context) {

    log.debug("getConfiguration");

    return ConfigurationBuilder.begin()

    .addRule(Join.path("/lang/en/gallery").to("/lang/en/galerie").withInboundCorrection())

    .addRule(Join.path("/lang/en/biography").to("/lang/en/biographie").withInboundCorrection())

    .addRule(Join.path("/lang/en/newsletter-registration").to("/lang/en/inscription-newsletter").withInboundCorrection())

    //.addRule(Join.path("/lang/en/contact").to("/lang/en/contact").withInboundCorrection())

    .addRule(Join.path("/lang/en/works-made-to-order").to("/lang/en/commandes-personnalisees").withInboundCorrection())

    .addRule(Join.path("/lang/en/links").to("/lang/en/liens").withInboundCorrection());

    }

    @Override

    public int priority() {

    return 10;

    }

    }

    pretty-config.xml

    <?xml version="1.0" encoding="UTF-8"?>

    <pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.3"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.3

    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd">

    <url-mapping id="desinscription">

    <pattern value="/lang/#{accueilView.language}/desinscription" />

    <view-id>/desinscription.jsf</view-id>

    </url-mapping>

    <rewrite match="^/desinscriptionAbonne/([w-]+)$" substitute="/DesinscriptionAbonneServlet?abonneToken=$1" redirect="chain"/>

    <rewrite match="^/redirigeVersSculpture/(fr|en)/(d+)$" substitute="/RedirigeVersSculptureServlet?abonneLocale=$1&sculptureID=$2" redirect="chain"/>

    <rewrite match="/lang/(fr|en)/sculpture/(.+)-(d+)" substitute="/lang/$1/galerie/sculpture/$2-$3" redirect="301"/>

    </pretty-config>

    web.xml

    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"

    version="3.0" metadata-complete="false">

    <display-name>Site Jean-Baptiste Martin ${pom.version}</display-name>

    <context-param>

    <param-name>contextConfigLocation</param-name>

    <param-value>classpath:root-application-config.xml</param-value>

    </context-param>

    <context-param>

    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

    <param-value>.xhtml</param-value>

    </context-param>

    <context-param>

    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

    <param-value>server</param-value>

    </context-param>

    <context-param>

    <!-- todo change to false in prod -->

    <param-name>facelets.DEVELOPMENT</param-name>

    <param-value>true</param-value>

    </context-param>

    <context-param>

    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>

    <param-value>/WEB-INF/jbm.taglib.xml</param-value>

    </context-param>

    <context-param>

    <param-name>org.richfaces.LoadStyleStrategy</param-name>

    <param-value>NONE</param-value>

    </context-param>

    <context-param>

    <param-name>org.richfaces.enableControlSkinning</param-name>

    <param-value>false</param-value>

    </context-param>

    <context-param>

    <param-name>com.jeanbaptistemartin.static.url</param-name>

    <param-value>http://static.jeanbaptistemartin.com/sculptures</param-value>

    </context-param>

    <context-param>

    <param-name>com.jeanbaptistemartin.version</param-name>

    <param-value>${pom.version}</param-value>

    </context-param>

    <context-param>

    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>

    <param-value>true</param-value>

    </context-param>

    <context-param>

    <!-- todo change to Production in prod -->

    <param-name>javax.faces.PROJECT_STAGE</param-name>

    <param-value>Production</param-value>

    </context-param>

    <!-- todo comment in prod -->

    <!-- <context-param> <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>

    <param-value>1</param-value> </context-param> -->

    <context-param>

    <param-name>com.ocpsoft.pretty.BASE_PACKAGES</param-name>

    <param-value>com.jeanbaptistemartin.view,com.ocpsoft</param-value>

    </context-param>

    <listener>

    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>

    </listener>

    <listener>

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

    </listener>

    <listener>

    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>

    </listener>

    <listener>

    <listener-class>com.sun.faces.application.WebappLifecycleListener</listener-class>

    </listener>

    <servlet>

    <servlet-name>Faces Servlet</servlet-name>

    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

    <load-on-startup>1</load-on-startup>

    </servlet>

    <!-- <servlet> <servlet-name>CaptchaServlet</servlet-name> <servlet-class>com.jeanbaptistemartin.util.CaptchaServlet</servlet-class>

    </servlet> -->

    <servlet>

    <servlet-name>DesinscriptionAbonneServlet</servlet-name>

    <servlet-class>com.jeanbaptistemartin.util.DesinscriptionAbonneServlet</servlet-class>

    </servlet>

    <servlet>

    <servlet-name>RedirigeVersSculptureServlet</servlet-name>

    <servlet-class>com.jeanbaptistemartin.util.RedirigeVersSculptureServlet</servlet-class>

    </servlet>

    <servlet-mapping>

    <servlet-name>Faces Servlet</servlet-name>

    <url-pattern>*.jsf</url-pattern>

    </servlet-mapping>

    <context-param>

    <param-name>org.richfaces.CONTROL_SKINNING</param-name>

    <param-value>disable</param-value>

    </context-param>

    <filter>

    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>

    <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>

    </filter>

    <filter>

    <filter-name>Pretty Filter</filter-name>

    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>

    </filter>

    <filter-mapping>

    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>

    <url-pattern>/*</url-pattern>

    </filter-mapping>

    <filter-mapping>

    <filter-name>Pretty Filter</filter-name>

    <url-pattern>/*</url-pattern>

    <dispatcher>REQUEST</dispatcher>

    <dispatcher>FORWARD</dispatcher>

    <dispatcher>ERROR</dispatcher>

    </filter-mapping>

    <servlet-mapping>

    <servlet-name>DesinscriptionAbonneServlet</servlet-name>

    <url-pattern>/DesinscriptionAbonneServlet</url-pattern>

    </servlet-mapping>

    <servlet-mapping>

    <servlet-name>RedirigeVersSculptureServlet</servlet-name>

    <url-pattern>/RedirigeVersSculptureServlet</url-pattern>

    </servlet-mapping>

    <session-config>

    <session-timeout>30</session-timeout>

    <tracking-mode>COOKIE</tracking-mode>

    </session-config>

    <welcome-file-list>

    <welcome-file>accueil.xhtml</welcome-file>

    </welcome-file-list>

    <error-page>

    <exception-type>javax.faces.application.ViewExpiredException</exception-type>

    <location>/WEB-INF/include/error-pages/viewExpired.html</location>

    </error-page>

    <error-page>

    <error-code>404</error-code>

    <location>/WEB-INF/include/error-pages/404.html</location>

    </error-page>

    <error-page>

    <!-- todo: change to 500 in production -->

    <error-code>500</error-code>

    <location>/WEB-INF/include/error-pages/500.html</location>

    </error-page>

    <security-constraint>

    <display-name>jbmConstraint</display-name>

    <web-resource-collection>

    <web-resource-name>jbmAll</web-resource-name>

    <description />

    <url-pattern>/*</url-pattern>

    <http-method>GET</http-method>

    <http-method>POST</http-method>

    <http-method>HEAD</http-method>

    <http-method>PUT</http-method>

    <http-method>OPTIONS</http-method>

    <http-method>TRACE</http-method>

    <http-method>DELETE</http-method>

    </web-resource-collection>

    </security-constraint>

    <security-constraint>

    <display-name>jbmConstraint</display-name>

    <web-resource-collection>

    <web-resource-name>jbmAll</web-resource-name>

    <description />

    <url-pattern>/*</url-pattern>

    <http-method>GET</http-method>

    <http-method>POST</http-method>

    <http-method>HEAD</http-method>

    <http-method>PUT</http-method>

    <http-method>OPTIONS</http-method>

    <http-method>TRACE</http-method>

    <http-method>DELETE</http-method>

    </web-resource-collection>

    </security-constraint>

    <login-config>

    <auth-method>BASIC</auth-method>

    <realm-name>jbmRealm</realm-name>

    </login-config>

    </web-app>

    I can provide more info if required.

    Regards,

    Julien.

    #22905

    Actually, I found out why this error would occur. It seems that the form Action URL is somehow null, which would explain the nullpointer exception. Your configuration looks fine, but I have no idea how this would occur.

    org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.encodeURL(HttpRewriteWrappedResponse.java:264)
    at com.sun.faces.context.ExternalContextImpl.encodeActionURL(ExternalContextImpl.java:514)
    at javax.faces.context.ExternalContextWrapper.encodeActionURL(ExternalContextWrapper.java:104)

    // the form action URL is null by the time it gets to the Rewrite configuration.

    at com.sun.faces.renderkit.html_basic.FormRenderer.getActionStr(FormRenderer.java:235)
    at com.sun.faces.renderkit.html_basic.FormRenderer.encodeBegin(FormRenderer.java:135)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
    at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)

    Do you think you could debug this and see exactly what is going on? Or upload a maven project or arquillian test-case that reproduces this?

    Thanks,

    Lincoln

    #22906

    balteo
    Participant

    Hi Lincoln,

    I am going to try and debug it. Can you tell me where to set the breakpoints please?

    Regards,

    Julien.

    #22907

    I can’t tell you exactly, but start in Path.java line 101 when the URL is null and work your way backwards.

    #22908

    balteo
    Participant

    Thanks Lincoln,

    I’ll definitely find the time for this debugging session.

    Regards,

    Julien.

    #22909

    jlgranda
    Participant

    Hi everybody, I have similar problem. Rewrite no response por http://localhost:8080/glue.

    The provider

    public class AccessRewriteConfiguration extends HttpConfigurationProvider implements NonEnriching
    {
    @Override
    public Configuration getConfiguration(final ServletContext context)
    {
    return ConfigurationBuilder.begin()

    .addRule(Join.path("/").to("/pages/home.xhtml"))
    /*.addRule(Join.path("/projects/new").to("/pages/project/create.xhtml"))*/

    .addRule(Join.path("/signup").to("/pages/signup.xhtml"))
    .addRule(Join.path("/login").to("/pages/login.xhtml"))

    // 404 and Error
    .addRule(Join.path("/404").to("/pages/404.xhtml").perform(Response.setCode(404)))
    .addRule(Join.path("/error").to("/pages/error.xhtml"))

    // Authentication
    .defineRule()
    .when(Direction.isInbound().and(Path.matches("/logout")))
    .perform(Invoke.binding(El.retrievalMethod("authentication.logout"))
    .and(Redirect.temporary(context.getContextPath() + "/")))

    ;
    }

    @Override
    public int priority()
    {
    return 10;
    }

    }

    The pretty-config

    <pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.4.1
    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.4.1.xsd">

    <rewrite match=".*/" trailingSlash="remove"/>

    <!-- Content Pages -->
    <url-mapping id="home">
    <pattern value="/"></pattern>
    <view-id value="/pages/home.xhtml"></view-id>
    </url-mapping>

    <!--
    <url-mapping id="project-view">
    <pattern value="/p/#{projects.current.name}"></pattern>
    <view-id value="/pages/project/view.xhtml"></view-id>
    <action>#{projects.loadCurrent}</action>
    </url-mapping>

    <url-mapping id="project-create">
    <pattern value="/new-project"></pattern>
    <view-id value="/pages/project/create.xhtml"></view-id>
    </url-mapping>
    -->

    <!-- Begin Exception Mappings -->
    <url-mapping id="404">
    <pattern value="/404" />
    <view-id value="/pages/404.xhtml" />
    </url-mapping>
    <url-mapping id="error">
    <pattern value="/error" />
    <view-id value="/pages/error.xhtml" />
    </url-mapping>
    <!-- End Exception Mappings -->

    </pretty-config>

    I have request for home, login, signup, but / or 404 or error throw exception. I use Jboss AS 7.1.x and JSF4

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.

Comments are closed.