Hello,
I'm trying to make a custom form work. I'm using a Facelet page in
combination with container's form authentication, but instead of posting
to j_security_check I'm authenticating with Servlet 3.0's
request.login(). So far so good.
The next step is redirecting the user to the originally requested page,
for which I've tried the approach described in the following questions
on StackOverflow:
http://stackoverflow.com/questions/5144186/redirect-to-protected-resource-or-original-saved-request-after-servlet-3-0-https
http://stackoverflow.com/questions/8024344/user-login-with-jsf-2-0
http://stackoverflow.com/questions/5815649/how-to-implement-redirect-to-login-page-with-java-ee-6-glassfish
But I never get the original URL using
"javax.servlet.forward.request_uri" when CODI is enabled. I guess this
may depend on CODI refreshing the request to append the windowId parameter.
XHTML excerpt (login.xhtml):
<h:form>
BLA<h:outputText
value="#{requestScope['javax.servlet.forward.request_uri']}" />BLA
BLA<h:outputText
value="#{requestScope['javax.servlet.include.request_uri']}" />BLA
<p:inputText id="username" value="#{loginBean.username}"/>
<p:password id="password" feedback="true" minLength="0"
value="#{loginBean.password}"/>
<h:commandButton value="Login" action="#{loginBean.login}"/>
</h:form>
web.xml excerpt:
<login-config>
<auth-method>FORM</auth-method>
<realm-name>file</realm-name>
<form-login-config>
<form-login-page>/login.jsf</form-login-page>
<form-error-page>/login.jsf</form-error-page>
</form-login-config>
</login-config>
Any ideas?
I'm on GlassFish 3.1.1 bundled with Netbeans 7.0.1 (Mojarra 2.1.3, and
the following on the server output INFO: [Started] MyFaces CODI
(Extensions CDI) Core v1.0.1 Used CDI implementation: Weld v20110404-1554).
I've also noticed that, once I've added CODI's jars to the project, I
have a lot of the following on the server log:
WARNING: PWC4011: Unable to set request character encoding to UTF-8 from
context /WebApplication1, because request parameters have already been
read, or ServletRequest.getReader() has already been called
Thank you,
Salvo
--