@@ -212,8 +212,6 @@ public class Ajax extends GQuery { | |||
settings.setDataString(dataString); | |||
settings.setContentType(contentType); | |||
} | |||
System.out.println(settings.getDataString()); | |||
if ("GET".equals(settings.getType()) && settings.getDataString() != null) { | |||
url += (url.contains("?") ? "&" : "?") + settings.getDataString(); |
@@ -26,6 +26,7 @@ import com.google.gwt.user.server.Base64Utils; | |||
public class AjaxTransportJre implements AjaxTransport { | |||
private static String localDomain = null; | |||
private static CookieManager cookieManager = CookieManager.getInstance(); | |||
public static void enableCORS(String domain) { | |||
@@ -96,7 +97,6 @@ public class AjaxTransportJre implements AjaxTransport { | |||
if (s.getUsername() != null && s.getPassword() != null) { | |||
c.setRequestProperty ("Authorization", "Basic " + Base64Utils.toBase64((s.getUsername() + ":" + s.getPassword()).getBytes())); | |||
} | |||
System.err.println("SET COOK"); | |||
cookieManager.setCookies(c); | |||
boolean isCORS = cors && localDomain != null && !s.getUrl().contains(localDomain); | |||
@@ -144,7 +144,6 @@ public class AjaxTransportJre implements AjaxTransport { | |||
if (isCORS && !localDomain.equals(c.getHeaderField("Access-Control-Allow-Origin"))) { | |||
code = 0; | |||
} | |||
System.err.println(c.getResponseCode()); | |||
BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream())); | |||
String inputLine; | |||
@@ -155,8 +154,6 @@ public class AjaxTransportJre implements AjaxTransport { | |||
in.close(); | |||
cookieManager.storeCookies(c); | |||
return new ResponseJre(code, c.getResponseMessage(), response.toString(), c.getHeaderFields()); | |||
} | |||
} |
@@ -3,7 +3,6 @@ package com.google.gwt.query.vm; | |||
import java.io.IOException; | |||
import java.net.URL; | |||
import java.net.URLConnection; | |||
import java.net.URLEncoder; | |||
import java.text.DateFormat; | |||
import java.text.SimpleDateFormat; | |||
import java.util.Date; | |||
@@ -39,6 +38,10 @@ public class CookieManager { | |||
return cookieManager; | |||
} | |||
public void clear() { | |||
store.clear(); | |||
} | |||
public void removeDomainCookies(String domain) { | |||
store.remove(domain); | |||
} | |||
@@ -52,7 +55,11 @@ public class CookieManager { | |||
} | |||
} | |||
public void setDomcainCookieProp(String host, String name, String prop, String value) { | |||
public void setDomcainCookie(String host, String name, String value) { | |||
setDomcainCookieProperty(host, name, name, value); | |||
} | |||
public void setDomcainCookieProperty(String host, String name, String prop, String value) { | |||
String domain = getDomainFromHost(host); | |||
Map<String, Map<String, String>> domainStore = store.get(domain); | |||
if (domainStore == null) { | |||
@@ -169,7 +176,6 @@ public class CookieManager { | |||
} | |||
try { | |||
conn.setRequestProperty(COOKIE, cookieStringBuffer.toString()); | |||
System.err.println(">>> SET cookie: " + COOKIE + " " + cookieStringBuffer.toString()); | |||
} catch (java.lang.IllegalStateException ise) { | |||
IOException ioe = | |||
new IOException( | |||
@@ -180,6 +186,7 @@ public class CookieManager { | |||
} | |||
private String getDomainFromHost(String host) { | |||
host = host.toLowerCase().replaceFirst("https?://", "").replaceAll("[/?:].*$", ""); | |||
if (host.indexOf(DOT) != host.lastIndexOf(DOT)) { | |||
return host.substring(host.indexOf(DOT) + 1); | |||
} else { |