Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,26 @@ public void setVersion(HttpVersion httpVersion)
request.version(httpVersion);
}

/**
* @return the metadata this request has been tagged with
* @see Request#getTag()
*/
public Object getTag()
{
return request.getTag();
}

/**
* <p>Tags this request with the given metadata tag.</p>

* @param tag the metadata to tag the request with
* @see Request#tag(Object)
*/
public void tag(Object tag)
{
request.tag(tag);
}

public void listener(Request.Listener listener)
{
request.onRequestListener(listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;

import org.eclipse.jetty.client.Request;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.websocket.api.ExtensionConfig;
Expand All @@ -35,13 +36,19 @@
*/
public final class ClientUpgradeRequest implements UpgradeRequest
{
/**
* ABNF from RFC 2616, RFC 822, and RFC 6455 specified characters requiring quoting.
*/
public static final String ABNF_REQUIRED_QUOTING = "\"'\\\n\r\t\f\b%+ ;=";

private final List<String> subProtocols = new ArrayList<>(1);
private final List<ExtensionConfig> extensions = new ArrayList<>(1);
private final List<HttpCookie> cookies = new ArrayList<>(1);
private final Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
private final URI requestURI;
private long timeout;
private String httpVersion;
private Object tag;

/**
* @deprecated use {@link #ClientUpgradeRequest(URI)} instead.
Expand Down Expand Up @@ -349,9 +356,24 @@ public long getTimeout()
}

/**
* ABNF from RFC 2616, RFC 822, and RFC 6455 specified characters requiring quoting.
* <p>Tags this request with the given metadata tag.</p>

* @param tag the metadata to tag the request with
* @see Request#tag(Object)
*/
public static final String ABNF_REQUIRED_QUOTING = "\"'\\\n\r\t\f\b%+ ;=";
public void tag(Object tag)
{
this.tag = tag;
}

/**
* @return the metadata this request has been tagged with
* @see Request#getTag()
*/
public Object getTag()
{
return tag;
}

public static String joinValues(List<String> values)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public JettyClientUpgradeRequest(WebSocketCoreClient coreClient, ClientUpgradeRe
if (httpVersionString != null)
setVersion(HttpVersion.fromString(httpVersionString));

// Copy the tag if it exists.
Object tag = request.getTag();
if (tag != null)
tag(tag);

timeout(request.getTimeout(), TimeUnit.MILLISECONDS);
}

Expand Down