Implicit navigation doesn't work, the navigation is relative to the root as opposed
to being absolute. This is a major headache not least in relation to the desire of
many to move from https to http. Have a google on Jan Luehe's code which
downshifts from https to http, specifically the MyFilter.java routine. What it looks
like to me is that you can access the ServletRequest via the @ManagedProperty
annotation (ServletRequest request) then do the stuff below and it should work.
I am way out of my comfort zone here, but if you play about with this I've an
a feeling it might work out ok.
[code]
public void doFilter(ServletRequest req, ServletResponse res,
...
HttpServletRequest httpReq = (HttpServletRequest) req;
...
String redirectUrl = "http://" + req.getServerName() + ":"
+ httpPort + httpReq.getRequestURI();
String queryString = httpReq.getQueryString();
if (queryString != null) {
redirectUrl += "?" + queryString;
}
((HttpServletResponse) res).sendRedirect(redirectUrl);
[/code]
The navigation handler stuff probably doesn't figure in this context but should!
[code]
FacesContext fc = FacesContext.getCurrentInstance();
NavigationHandler nav = fc.getApplication().getNavigationHandler();
nav.handleNavigation(fc, null, "loginExpired?faces-redirect=true");
fc.renderResponse();
[/code]
Note that you can do some useful things like this to clean your code up
(thanks for Ed Burns and his JSF 2.0 book):
[code]
@RequestScoped
public abstract class AbstractBackingBean {
@ManagedProperty(value = "#{facesContext}")
private FacesContext facesContext;
@ManagedProperty(value = "#{application}")
private ServletContext application;
@ManagedProperty(value = "#{requestScope}")
private Map<String, Object> requestMap;
@ManagedProperty(value = "#{sessionScope}")
private Map<String, Object> sessionMap;
@ManagedProperty(value = "#{view}")
private UIViewRoot viewRoot;
@ManagedProperty(value = "#{flash}")
private Flash flash;
@ManagedProperty(value = "#{session}")
private HttpSession session;
@ManagedProperty(value = "#{request}")
private ServletRequest request;
[/code]
Hopefully someone with more expertise in this area can piece this together
and help to arrive at a solution.
Regards,
Brendan.
[Message sent by forum member 'healeyb']
http://forums.java.net/jive/thread.jspa?messageID=472332