Question regarding pretty-config.xml and patterns…

Splash Forums PrettyFaces Users Question regarding pretty-config.xml and patterns…

This topic contains 7 replies, has 2 voices, and was last updated by  Christian Kaltepoth 6 years, 8 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #17853

    balteo
    Participant

    Hello,

    Here is the problem I am facing: I am trying to set the “view.locale.language” using a part of the url provided.

    When the user clicks the link: http://localhost:8080/jeanbaptistemartin/lang/en/desinscription, the “en” part is used as follows to set the locale:

    <url-mapping id=”desinscription”>

    <pattern value=”/lang/#{view.locale.language}/desinscription” />

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

    </url-mapping>

    However, I get the following exception on page load:

    **************************

    14 janv. 2011 11:26:42 com.sun.faces.lifecycle.Phase handleAfterPhase

    ATTENTION: JSF1053: (Listener: com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(), Phase ID: RESTORE_VIEW 1, View ID: /desinscription.xhtml) Exception thrown during phase-listener execution: com.ocpsoft.pretty.PrettyException: PrettyFaces: Exception occurred while processing <desinscription:#{view.locale.language}> for URL </lang/en/desinscription>

    14 janv. 2011 11:26:42 com.sun.faces.lifecycle.Phase handleAfterPhase

    ATTENTION: com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:79)

    com.ocpsoft.pretty.faces.beans.ParameterInjector.injectParameters(ParameterInjector.java:52)

    com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:97)

    com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)

    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)

    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)

    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

    javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)

    org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

    org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)

    org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:115)

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)

    org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)

    org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)

    org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)

    com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:107)

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)

    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    com.jeanbaptistemartin.util.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:61)

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)

    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    java.lang.Thread.run(Thread.java:662)

    **************************

    Can anyone please help?

    Thanks in advance,

    Julien.

    #20624

    Is this the full stacktrace? I think the “caused by” part of the exception is missing, or am I mistaken?

    And could you also post the relevant code of the bean named “view”?

    #20625

    balteo
    Participant

    Thanks Christian,

    I have included the full stacktrace.

    “view” is the jsf UIViewRoot. I am trying to set the locale.language on the UIViewRoot. Does that make sense?

    J.

    #20626

    Which version of PrettyFaces are you using? If I remember correctly PrettyFaces 3.1.0 should also add a “caused by” to this type of exception. See this post for an example.

    I don’t think it is possible to set the language of the UIViewRoot this way because the Locale class does not provide a setter for the language property.

    #20627

    balteo
    Participant

    You’re right Christian.

    I am now using my “root” bean as follows:

    **********

    /lang/#{accueilView.language}/desinscription

    **********

    As far as the stack trace is concerned, I am using one of the snapshot versions of 3.1.1. hence maybe the fact it is not showing the full stack trace.

    Thanks to you,

    Julien.

    #20628

    Perhaps it has something to do with your logging configuration?

    Of cause you can also inject the language into some bean (like you did) and then use the locale attribute of <f:view> to reference the correct locale.

    #20629

    balteo
    Participant

    Yes. By the way any release date for 3.1.1? (I know: I already asked the same question a while ago but I am eagerly awaiting this release…)

    Good luck to you both.

    Julien.

    #20630

    Good question! :-)

    We are currently working hard on the last remaining issue that causes major problems if you use non-ASCII characters in URLs. I really cannot give an exact date. :-(

    BTW: The next release will be called 3.2.0 as we have so many new cool features:

    https://github.com/ocpsoft/prettyfaces/blob/master/CHANGELOG.txt

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

Comments are closed.