You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pe...@apache.org on 2011/03/30 21:03:55 UTC

svn commit: r1087045 - /wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java

Author: pete
Date: Wed Mar 30 19:03:54 2011
New Revision: 1087045

URL: http://svn.apache.org/viewvc?rev=1087045&view=rev
Log:
enable overriding of server name in MockHttpServletRequest. this is useful for applications where the content of the web request's 'Host' header matters.

Modified:
    wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java

Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java?rev=1087045&r1=1087044&r2=1087045&view=diff
==============================================================================
--- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java (original)
+++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java Wed Mar 30 19:03:54 2011
@@ -184,6 +184,8 @@ public class MockHttpServletRequest impl
 
 	private String scheme = "http";
 
+	private String serverName = "localhost";
+
 	private int serverPort = 80;
 
 	/**
@@ -840,7 +842,7 @@ public class MockHttpServletRequest impl
 	/**
 	 * Get the remote host.
 	 * 
-	 * @return Always localhost
+	 * @return Return 'localhost' by default
 	 */
 	public String getRemoteHost()
 	{
@@ -955,11 +957,21 @@ public class MockHttpServletRequest impl
 	/**
 	 * Get the server name.
 	 * 
-	 * @return Always localhost
+	 * @return by default returns 'localhost'
 	 */
 	public String getServerName()
 	{
-		return "localhost";
+		return serverName;
+	}
+
+	/**
+	 * Set the server name.
+	 * 
+	 *@param serverName content of 'Host' header
+	 */
+	public void setServerName(final String serverName)
+	{
+		this.serverName = serverName;
 	}
 
 	/**