Re: Problem with PrettyFaces and Primefaces

Splash Forums PrettyFaces Users Problem with PrettyFaces and Primefaces Re: Problem with PrettyFaces and Primefaces

#20262

kency
Participant

Hi Lincoln i have new problem with PrettyFaces when redirect on servlet

in pretty-config.xml i config my admincp login.xmhtl page follow:

`<url-mapping id=”adminlogin”>

<pattern value=”/admin/login” />

<view-id>/faces/admin/login.xhtml</view-id>

</url-mapping>`

but in servlet i filter when user not login into admin but type url into index.xhtml of admincp it will be redirect to login.xhtml

when it redirect true url is : http://localhost/admin/login

but it not redirect such link above , it redirect to http://localhost/admin/admin/login

===========================================

i was change servlet Filter User login follow:

============================================

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
LoginController controller = (LoginController) req.getSession().getAttribute("loginController");
if (controller == null || !controller.isLoggedIn()) {

if(!req.getRequestURI().endsWith("admin/login")){
res.sendRedirect("admin/login");

}else {
chain.doFilter(request, response);
}

} else {

chain.doFilter(request, response);
}

}

======================================

in web.xml i was config for servlet filter

<filter>
<filter-name>userLoginFilter</filter-name>
<filter-class>com.mcgraw.controller.UserLoginFilter</filter-class>
<init-param>
<param-name>loginPage</param-name>
<param-value>/login.xhtml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>userLoginFilter</filter-name>
<url-pattern>/admin/*</url-pattern>
<url-pattern>*.jsf</url-pattern>

</filter-mapping>

how can i solve it?

Thank you

Best Regards