You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/05/25 20:02:24 UTC

svn commit: r541740 - in /incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket: behavior/HeaderContributor.java protocol/http/request/WebRequestCodingStrategy.java protocol/http/servlet/ServletWebRequest.java

Author: almaw
Date: Fri May 25 11:02:22 2007
New Revision: 541740

URL: http://svn.apache.org/viewvc?view=rev&rev=541740
Log:
WICKET-540 - ServletWebRequest.getContextPath() ignores ContextPath as set by user (accesses HttpServletRequest directly)

Modified:
    incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/behavior/HeaderContributor.java
    incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java
    incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/servlet/ServletWebRequest.java

Modified: incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/behavior/HeaderContributor.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/behavior/HeaderContributor.java?view=diff&rev=541740&r1=541739&r2=541740
==============================================================================
--- incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/behavior/HeaderContributor.java (original)
+++ incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/behavior/HeaderContributor.java Fri May 25 11:02:22 2007
@@ -222,16 +222,10 @@
 				{
 					if (path == null)
 					{
-						String contextPath = Application.get().getApplicationSettings()
-								.getContextPath();
+						String contextPath = ((WebRequestCycle)RequestCycle.get()).getWebRequest().getContextPath();
 						if (contextPath == null)
 						{
-							contextPath = ((WebRequestCycle)RequestCycle.get()).getWebRequest()
-									.getContextPath();
-							if (contextPath == null)
-							{
-								contextPath = "";
-							}
+							contextPath = "";
 						}
 						AppendingStringBuffer b = new AppendingStringBuffer();
 						b.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
@@ -319,17 +313,12 @@
 				public Object getObject(Component component)
 				{
 					if (path == null)
-					{
-						String contextPath = Application.get().getApplicationSettings()
+					{					
+						String contextPath = ((WebRequestCycle)RequestCycle.get()).getWebRequest()
 								.getContextPath();
 						if (contextPath == null)
 						{
-							contextPath = ((WebRequestCycle)RequestCycle.get()).getWebRequest()
-									.getContextPath();
-							if (contextPath == null)
-							{
-								contextPath = "";
-							}
+							contextPath = "";
 						}
 						AppendingStringBuffer b = new AppendingStringBuffer();
 						b.append("<script type=\"text/javascript\" src=\"");

Modified: incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java?view=diff&rev=541740&r1=541739&r2=541740
==============================================================================
--- incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java Fri May 25 11:02:22 2007
@@ -818,15 +818,10 @@
 			final WebRequest request = ((WebRequestCycle)requestCycle).getWebRequest();
 			if (request != null)
 			{
-				String contextPath = Application.get().getApplicationSettings().getContextPath();
+				String contextPath = ((WebRequestCycle)RequestCycle.get()).getWebRequest().getContextPath();
 				if (contextPath == null)
 				{
-					contextPath = ((WebRequestCycle)RequestCycle.get()).getWebRequest()
-							.getContextPath();
-					if (contextPath == null)
-					{
-						contextPath = "";
-					}
+					contextPath = "";
 				}
 				if (!contextPath.equals("/"))
 				{

Modified: incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/servlet/ServletWebRequest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/servlet/ServletWebRequest.java?view=diff&rev=541740&r1=541739&r2=541740
==============================================================================
--- incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/servlet/ServletWebRequest.java (original)
+++ incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/protocol/http/servlet/ServletWebRequest.java Fri May 25 11:02:22 2007
@@ -27,6 +27,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import wicket.Application;
 import wicket.WicketRuntimeException;
 import wicket.protocol.http.WebRequest;
 import wicket.util.lang.Bytes;
@@ -65,7 +66,8 @@
 	 */
 	public String getContextPath()
 	{
-		return httpServletRequest.getContextPath();
+		String contextPath = Application.get().getApplicationSettings().getContextPath();
+		return contextPath != null ? contextPath : httpServletRequest.getContextPath();
 	}
 
 	/**