getRequestURI returns 'index.jsp' not 'index.jsf'

Dear All,

I was just wondering: is it an accepted thing that...

FacesContext.getCurrentInstance().getExternalContext().getRequestURI()

...returns, say, 'index.jsp' even though the browser address line says 'index.jsf'? I assume this is because of the whole 'JSF is really a servlet' thing.

If I am looking to manipulate the request URI (say, to add another parameter on the end), is it accepted that I do...

getRequestURI().replace( ".jsp", ".jsf" );

...or is there a better approach?

[533 byte] By [kennardconsultinga] at [2007-10-2 9:29:28]
# 1
You can try using a filter.
Akash_Gangaa at 2007-7-16 23:36:01 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Akash,I'm sorry, could you elaborate on how that would work?Richard.
kennardconsultinga at 2007-7-16 23:36:01 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Sorry for the late response.

Have a filter code something similar to the below and make an entry in the web.xml for the filter. I am not very sure if this would help. Just give it a try.

public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain) throws IOException ,ServletException{

HttpServletRequest request=(HttpServletRequest)servletRequest;

if(request.getRequestURI().indexOf("Sample.jsf")!=-1){

// Do something

}

}

Akash_Gangaa at 2007-7-16 23:36:01 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hi, did you get this problem sorted?

I have the same trouble, I include a JSP page at the top of the JSF page that basically checks the user is logged in. If they are not, then it redirects to the login page appending the requested URI as a parameter.

The trouble is of course that the JSF page, accessed via account1.faces, is seen as a request for account1.jsp and once the user logs in again, is redirected to account1.jsp instead of .faces! And that doesnt work!!

Any ideas on how I can get what I presume is the faces Servlet request?

Looking at that filter suggested above I cant see how it would work? If it could be elaborated upon Id be grateful.

Thanks,

Rob.

groovyroba at 2007-7-16 23:36:01 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...