Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2013-07-15 09:52:45 +0000
committerSimone Bordet2013-07-23 13:53:35 +0000
commit52b805697aa541e2bcf573ad133e3f692bfe4d61 (patch)
tree7f13992a4686f14e49822da5e24b35ec5fa95b3e /jetty-spdy/spdy-http-common/src/main/java/org/eclipse/jetty/spdy/http
parent64a8811a5b2d22eb0717e3a7bb0fb960c553635a (diff)
downloadorg.eclipse.jetty.project-52b805697aa541e2bcf573ad133e3f692bfe4d61.tar.gz
org.eclipse.jetty.project-52b805697aa541e2bcf573ad133e3f692bfe4d61.tar.xz
org.eclipse.jetty.project-52b805697aa541e2bcf573ad133e3f692bfe4d61.zip
Moved HTTPSPDYHeader into its own module, for use by a SPDY HttpClientTransport implementation.
Diffstat (limited to 'jetty-spdy/spdy-http-common/src/main/java/org/eclipse/jetty/spdy/http')
-rw-r--r--jetty-spdy/spdy-http-common/src/main/java/org/eclipse/jetty/spdy/http/HTTPSPDYHeader.java82
1 files changed, 82 insertions, 0 deletions
diff --git a/jetty-spdy/spdy-http-common/src/main/java/org/eclipse/jetty/spdy/http/HTTPSPDYHeader.java b/jetty-spdy/spdy-http-common/src/main/java/org/eclipse/jetty/spdy/http/HTTPSPDYHeader.java
new file mode 100644
index 0000000000..18634d0884
--- /dev/null
+++ b/jetty-spdy/spdy-http-common/src/main/java/org/eclipse/jetty/spdy/http/HTTPSPDYHeader.java
@@ -0,0 +1,82 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.spdy.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jetty.spdy.api.SPDY;
+
+/**
+ * <p>{@link HTTPSPDYHeader} defines the SPDY headers that are not also HTTP headers,
+ * such as <tt>method</tt>, <tt>version</tt>, etc. or that are treated differently
+ * by the SPDY protocol, such as <tt>host</tt>.</p>
+ */
+public enum HTTPSPDYHeader
+{
+ METHOD("method", ":method"),
+ URI("url", ":path"),
+ VERSION("version", ":version"),
+ SCHEME("scheme", ":scheme"),
+ HOST("host", ":host"),
+ STATUS("status", ":status");
+
+ public static HTTPSPDYHeader from(short version, String name)
+ {
+ switch (version)
+ {
+ case SPDY.V2:
+ return Names.v2Names.get(name);
+ case SPDY.V3:
+ return Names.v3Names.get(name);
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ private final String v2Name;
+ private final String v3Name;
+
+ private HTTPSPDYHeader(String v2Name, String v3Name)
+ {
+ this.v2Name = v2Name;
+ Names.v2Names.put(v2Name, this);
+ this.v3Name = v3Name;
+ Names.v3Names.put(v3Name, this);
+ }
+
+ public String name(short version)
+ {
+ switch (version)
+ {
+ case SPDY.V2:
+ return v2Name;
+ case SPDY.V3:
+ return v3Name;
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ private static class Names
+ {
+ private static final Map<String, HTTPSPDYHeader> v2Names = new HashMap<>();
+ private static final Map<String, HTTPSPDYHeader> v3Names = new HashMap<>();
+ }
+}

Back to the top