Hello Andrew: 

The problem is CAS CustomHttpServletRequestWrapper manipulating request URI. 
The following are the details

Here are the main files I am using in my sample casclient application 

1. web.xml 
2. struts-config.xml 
3. CustomRequestProcessor.java 
4. WelcomeAction.java 
5. welcome.jsp 

1. web.xml 

<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";> 
<display-name>casapp</display-name> 
<filter> 
<filter-name>CAS Single Sign Out Filter</filter-name> 
<filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class> 
</filter> 
<filter-mapping> 

<filter-name>CAS Single Sign Out Filter</filter-name> 
<url-pattern>/*</url-pattern> 
</filter-mapping> 
<listener> 
<listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
 

</listener> 


<filter> 
<filter-name>CAS Authentication Filter</filter-name> 
<filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
 
<init-param> 
<param-name>casServerLoginUrl</param-name> 
<param-value>https://casserver.com/cas/login</param-value> 
</init-param> 
<init-param> 
<param-name>serverName</param-name> 
<param-value>http://localhost:9080</param-value> 
</init-param> 
</filter> 

<filter> 
<filter-name>CAS Validation Filter</filter-name> 
<filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
 
<init-param> 
<param-name>casServerUrlPrefix</param-name> 
<param-value>https://casserver.com/cas</param-value> 
</init-param> 
<init-param> 
<param-name>serverName</param-name> 
<param-value>http://localhost:9080</param-value> 
</init-param> 
</filter>       
<filter> 
<filter-name>CAS HttpServletRequest Wrapper Filter</filter-name> 
<filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>
 
</filter> 

<filter-mapping> 
<filter-name>CAS Authentication Filter</filter-name> 
<url-pattern>/*</url-pattern> 
</filter-mapping> 

<filter-mapping> 
<filter-name>CAS Validation Filter</filter-name> 
<url-pattern>/*</url-pattern> 
</filter-mapping> 
<filter-mapping> 
<filter-name>CAS HttpServletRequest Wrapper Filter</filter-name> 
<url-pattern>/*</url-pattern> 
</filter-mapping> 
<servlet> 
<servlet-name>action</servlet-name> 
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class> 
<init-param> 
<param-name>config</param-name> 
<param-value>/WEB-INF/struts-config.xml</param-value> 
</init-param> 
<load-on-startup>1</load-on-startup> 
</servlet> 
<servlet-mapping> 
<servlet-name>action</servlet-name> 
<url-pattern>/do/*</url-pattern> 
</servlet-mapping> 
<jsp-config> 
<taglib> 
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> 
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location> 
</taglib> 
<taglib> 
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri> 
<taglib-location>/WEB-INF/struts-html.tld</taglib-location> 
</taglib> 
<taglib> 
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri> 
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location> 
</taglib> 
<taglib> 
<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri> 
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location> 
</taglib> 
<taglib> 
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri> 
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location> 
</taglib> 
<taglib> 
<taglib-uri>/WEB-INF/casapp-functions.tld</taglib-uri> 
<taglib-location>/WEB-INF/casapp.tld</taglib-location> 
</taglib> 
</jsp-config> 
<welcome-file-list> 
<welcome-file>index.html</welcome-file> 
<welcome-file>index.htm</welcome-file> 
<welcome-file>index.jsp</welcome-file> 
<welcome-file>default.html</welcome-file> 
<welcome-file>default.htm</welcome-file> 
<welcome-file>default.jsp</welcome-file> 
</welcome-file-list> 
</web-app> 

2. struts-config.xml 

<?xml version="1.0" encoding="UTF-8" ?> 

<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" 
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";> 


<struts-config> 
<form-beans> 
</form-beans> 

<global-exceptions> 

</global-exceptions> 

<global-forwards> 
</global-forwards> 

<action-mappings> 



<action 
path="/Welcome" 
validate="false" 
input=".welcomeDef" 
scope="request" 
type="com.test.web.actions.WelcomeAction"> 
<forward name="success" path="/welcome.jsp"/> 
</action> 

</action-mappings> 
<controller maxFileSize="1G" processorClass="com.test.CustomRequestProcessor"/> 

</struts-config> 


3. CustomRequestProcessor.java 

public class CustomRequestProcessor 
extends TilesRequestProcessor 
{ 
protected String processPath(HttpServletRequest request, HttpServletResponse 
response) throws IOException 
{ 
request.setAttribute("request", request); 

return super.processPath(request, response); 
} 
} 

4. WelcomeAction.java 

public class WelcomeAction extends Action { 

public ActionForward execute(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) 
throws Exception { 
return mapping.findForward("success"); 
} 

} 

5. welcome.jsp 
<%@ include file="taglibs.jsp" %> 
<c:out value="${request.requestURI}"></c:out> 


If you notice I am setting request as an attribute in 
CustomRequestProcessor.java so that I can use it directly instead of using 
pageContext.request in welcome.jsp. 
If I remove the CAS configuartion in web.xml welcome.jsp prints 
"/casapp/do/Welcome" otherwise it prints "/casapp/welcome.jsp". 
So I am not understanding why requestURI value got changed when I add CAS 
configuration to web.xml. 

Can anyone help me on this? 

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to