You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2010/02/17 20:20:47 UTC

svn commit: r911149 - in /incubator/wookie/trunk: src-tests/org/apache/wookie/tests/functional/ProxyTest.java src/org/apache/wookie/proxy/ProxyServlet.java

Author: scottbw
Date: Wed Feb 17 19:20:47 2010
New Revision: 911149

URL: http://svn.apache.org/viewvc?rev=911149&view=rev
Log:
Added a small hack for proxified URLs encoded using JQuery - see WOOKIE-118

Modified:
    incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java
    incubator/wookie/trunk/src/org/apache/wookie/proxy/ProxyServlet.java

Modified: incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java?rev=911149&r1=911148&r2=911149&view=diff
==============================================================================
--- incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java (original)
+++ incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java Wed Feb 17 19:20:47 2010
@@ -151,6 +151,13 @@
 	}
 	
 	@Test
+	public void getWithJQueryEncodedParameters(){
+		String url = PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+VALID_SITE_URL+"&x=y";
+		assertEquals(200,send(url,"GET"));
+		assertEquals(500,send(url,"POST")); // This URL doesn't support POST
+	}
+	
+	@Test
 	public void postWithMixedQueryAndParameters() throws Exception{
 		HttpClient client = new HttpClient();
 		List<String> authPrefs =  new ArrayList<String>(2);

Modified: incubator/wookie/trunk/src/org/apache/wookie/proxy/ProxyServlet.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/proxy/ProxyServlet.java?rev=911149&r1=911148&r2=911149&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/proxy/ProxyServlet.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/proxy/ProxyServlet.java Wed Feb 17 19:20:47 2010
@@ -222,6 +222,11 @@
 				if(idx>-1){
 					// reconstruct the path to be proxied by removing the reference to this servlet
 					endPointURL=proxiedEndPointURL.toString().substring(idx+4,proxiedEndPointURL.toString().length());
+					// fix initial querystring component - this is a hack for JQuery support. See WOOKIE-118 for
+					// more information about this.
+					if (endPointURL.contains("&") && !endPointURL.contains("?")){
+						endPointURL = endPointURL.replaceFirst("&", "?");
+					}
 				}
 			}