Reply To: Prettyfaces or rewrite integration with jersey

Splash Forums PrettyFaces Users Prettyfaces or rewrite integration with jersey Reply To: Prettyfaces or rewrite integration with jersey

#27333

What “other behavior in jersey context” do you mean? The missing context path?

If you want to redirect to a PrettyFaces URL, you have to do two things:

First you need to build the target URL. You can either use PrettyURLBuilder or simple string concatenation for this. Using PrettyURLBuilder will require more code, but in this case you can change the URL pattern at a single place. Using string concatenation is usually much simpler, but you have to take care that the URL structure matches the one from the mapping.

When you have the target URL, you will have to send the redirect. You can use HttpServletContext#sendRedirect() for this. This works fine in most of the cases. Especially in Servlets. If you want to redirect from a JAX-RS resource, you can also use Response#temporaryRedirect() instead, which is more in line with the JAX-RS programming model.

If you use an absolute URL (which is always the case if you are using PrettyURLBuilder) you will have to make sure to add the context path of the application. Not sure how Response#temporaryRedirect() handles this though.

Hope this helps.