Promoting ClientUpgradeRequest and ClientUpgradeResponse to non-internal use

This commit is contained in:
Joakim Erdfelt 2012-11-07 06:05:36 -07:00
parent fc371fc7e6
commit 473ff032ae
5 changed files with 30 additions and 6 deletions

View File

@ -16,8 +16,9 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.client.internal;
package org.eclipse.jetty.websocket.client;
import java.net.CookieStore;
import java.net.HttpCookie;
import java.net.URI;
import java.util.HashSet;
@ -38,7 +39,6 @@ import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
public class ClientUpgradeRequest extends UpgradeRequest
{
private final static Logger LOG = Log.getLogger(ClientUpgradeRequest.class);
private static final String HEADER_VALUES_DELIM = "\"\\\n\r\t\f\b%+ ;=";
private static final Set<String> FORBIDDEN_HEADERS;
static
@ -59,6 +59,7 @@ public class ClientUpgradeRequest extends UpgradeRequest
}
private final String key;
private CookieStore cookieStore;
public ClientUpgradeRequest()
{
@ -189,8 +190,29 @@ public class ClientUpgradeRequest extends UpgradeRequest
return new String(B64Code.encode(bytes));
}
@Override
public List<HttpCookie> getCookies()
{
if (cookieStore != null)
{
return cookieStore.get(getRequestURI());
}
return super.getCookies();
}
public CookieStore getCookieStore()
{
return cookieStore;
}
public String getKey()
{
return key;
}
public void setCookieStore(CookieStore cookieStore)
{
this.cookieStore = cookieStore;
}
}

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.client.internal;
package org.eclipse.jetty.websocket.client;
import java.io.IOException;

View File

@ -29,6 +29,8 @@ import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.api.UpgradeResponse;
import org.eclipse.jetty.websocket.api.WebSocketConnection;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.ClientUpgradeResponse;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.WebSocketClientFactory;
import org.eclipse.jetty.websocket.client.masks.Masker;

View File

@ -25,7 +25,7 @@ import java.util.regex.Pattern;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.Utf8LineParser;
import org.eclipse.jetty.websocket.api.UpgradeException;
import org.eclipse.jetty.websocket.client.internal.ClientUpgradeResponse;
import org.eclipse.jetty.websocket.client.ClientUpgradeResponse;
/**
* Responsible for reading UTF8 Response Header lines and parsing them into a provided UpgradeResponse object.

View File

@ -38,8 +38,8 @@ import org.eclipse.jetty.websocket.api.UpgradeException;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.extensions.Extension;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.client.internal.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.internal.ClientUpgradeResponse;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.ClientUpgradeResponse;
import org.eclipse.jetty.websocket.client.internal.DefaultWebSocketClient;
import org.eclipse.jetty.websocket.common.AcceptHash;
import org.eclipse.jetty.websocket.common.events.EventDriver;