Spring security logout with prettyFaces

Splash Forums PrettyFaces Users Spring security logout with prettyFaces

This topic contains 4 replies, has 2 voices, and was last updated by  mika 10 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #18067



    i have a logout link, as follows:

    <pretty:link mappingId="logout">

    i made a mapping for the logout as follows:

    <url-mapping id=”logout”>

    <pattern value=”/logout” />

    <view-id value=”/app-context/j_spring_security_logout” />


    so that it will work fine with spring security and user will see a clean url called logout instead of seeing a link something like: j_spring_security_logout

    – idea is that i don’t want to hardcode the request context path in the pretty-config.xml file, i tried to read the request context path value from property file using spring, but it doesn’t seem to work, i think it will work if i moved the pretty-config.xml under the META-INF folder, will that be a problem for prettyFaces configuration ?

    – i have another idea to make a logout page which will be it’s only purpose is to forward the user to the link #{request.contextPath}/j_spring_security_logout

    with this solution, i can read the property from the property file using resource bundle for jsf, but how to do such forwarding with prettyFaces ?

    please advise.


    What do you mean with “applicationContext”. Do you refer to the context path of your webapp or do you mean something different? I don’t know much about Spring Security, that’s why I’m asking?

    If you refer to the context path of your application, you won’t have any problem, because the view-id from the PrettyFaces configuration is relative to the context path. So you don’t need to add the context path there.

    If the applicationContext is something different you have to add to the logout URL, you could use dynaview. Take a look at this example:

    <url-mapping id="logout">
    <pattern value="/logout" />
    <view-id value="#{logoutDynaviewBean.getViewId}" />

    public class LogoutDynaviewBean {

    public String getViewId() {

    String applicationContext = ....;

    return applicationContext + "/j_spring_security_logout";



    I hope this helps! :)




    application context is the request context path which is something like: /appName , got it ?


    OK, in this case you shouldn’t need it in the PrettyFaces configuration. Did you try:

    <url-mapping id="logout">
    <pattern value="/logout" />
    <view-id value="/j_spring_security_logout" />



    that’s worked very fine, thanks Christian.

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

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.