I am trying to rewrite a url for a conversation bean. so it should behave as follows:
localhost:8080/rest/test/20 should be openning localhost:8080/view_doc.jsf?cid=20
I am trying this:
@RewriteConfiguration
public class TestRewriteConfiguration extends HttpConfigurationProvider{
@Override
public int priority()
{
return 10;
}
@Override
public Configuration getConfiguration(final ServletContext context)
{
return ConfigurationBuilder.begin()
.addRule()
.when(Direction.isInbound().and(Path.matches("/rest/test/{doc_id}")))
.perform(Forward.to("/view_doc.jsf?cid={doc_id}"));
}
}
The problem with this is if the conversation is non-existant, then the page breaks.
now in seam there was a way to bind conversation with such restful urls. so if the conversation is non existant, then it would create it. whereas if it is existant then it would take you to the conversation.
how do you do it in java ee 6? any clue? Also let me know if there is a better way of achieving such things.
thanks in advance