Re: URL rewriting with PrettyFaces, URLMapping and pretty:link

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

#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