juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject [4/4] incubator-juneau git commit: Add HTTP header classes.
Date Sat, 06 May 2017 16:24:39 GMT
Add HTTP header classes.

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/fa4736b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/fa4736b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/fa4736b6

Branch: refs/heads/master
Commit: fa4736b6df552a5fd4dc624b51d4ae7431dbfcda
Parents: de98f18
Author: JamesBognar <jamesbognar@apache.org>
Authored: Sat May 6 12:24:28 2017 -0400
Committer: JamesBognar <jamesbognar@apache.org>
Committed: Sat May 6 12:24:28 2017 -0400

----------------------------------------------------------------------
 .../juneau/https/AcceptExtensionsTest.java      |  18 +-
 .../java/org/apache/juneau/BeanContext.java     |   2 +-
 .../java/org/apache/juneau/http/Accept.java     | 220 +++++++--------
 .../org/apache/juneau/http/AcceptCharset.java   |  82 ++++++
 .../org/apache/juneau/http/AcceptEncoding.java  | 181 +++++-------
 .../org/apache/juneau/http/AcceptLanguage.java  | 110 ++++++++
 .../org/apache/juneau/http/AcceptRanges.java    |  69 +++++
 .../main/java/org/apache/juneau/http/Age.java   |  64 +++++
 .../main/java/org/apache/juneau/http/Allow.java |  72 +++++
 .../org/apache/juneau/http/Authorization.java   |  78 ++++++
 .../org/apache/juneau/http/CacheControl.java    | 102 +++++++
 .../java/org/apache/juneau/http/Connection.java | 106 +++++++
 .../java/org/apache/juneau/http/Constants.java  |  21 ++
 .../org/apache/juneau/http/ContentEncoding.java |  74 +++++
 .../apache/juneau/http/ContentEncodingEnum.java |  34 +++
 .../org/apache/juneau/http/ContentLanguage.java |  78 ++++++
 .../org/apache/juneau/http/ContentLength.java   |  67 +++++
 .../org/apache/juneau/http/ContentLocation.java |  72 +++++
 .../org/apache/juneau/http/ContentRange.java    | 126 +++++++++
 .../org/apache/juneau/http/ContentType.java     |  58 ++--
 .../main/java/org/apache/juneau/http/Date.java  |  83 ++++++
 .../main/java/org/apache/juneau/http/ETag.java  |  58 ++++
 .../org/apache/juneau/http/EntityValidator.java |  72 +++++
 .../java/org/apache/juneau/http/Expect.java     |  73 +++++
 .../java/org/apache/juneau/http/Expires.java    |  80 ++++++
 .../main/java/org/apache/juneau/http/From.java  |  72 +++++
 .../java/org/apache/juneau/http/HeaderDate.java |  51 ++++
 .../juneau/http/HeaderEntityValidator.java      |  47 ++++
 .../juneau/http/HeaderEntityValidatorArray.java |  55 ++++
 .../java/org/apache/juneau/http/HeaderEnum.java |  70 +++++
 .../org/apache/juneau/http/HeaderInteger.java   |  59 ++++
 .../apache/juneau/http/HeaderRangeArray.java    |  74 +++++
 .../org/apache/juneau/http/HeaderString.java    |  72 +++++
 .../apache/juneau/http/HeaderStringArray.java   |  80 ++++++
 .../java/org/apache/juneau/http/HeaderUri.java  |  62 +++++
 .../main/java/org/apache/juneau/http/Host.java  |  75 +++++
 .../java/org/apache/juneau/http/IfMatch.java    |  90 ++++++
 .../org/apache/juneau/http/IfModifiedSince.java |  92 +++++++
 .../org/apache/juneau/http/IfNoneMatch.java     |  95 +++++++
 .../java/org/apache/juneau/http/IfRange.java    |  95 +++++++
 .../apache/juneau/http/IfUnmodifiedSince.java   |  66 +++++
 .../org/apache/juneau/http/LastModified.java    |  74 +++++
 .../java/org/apache/juneau/http/Location.java   |  63 +++++
 .../org/apache/juneau/http/MaxForwards.java     |  65 +++++
 .../java/org/apache/juneau/http/Pragma.java     |  71 +++++
 .../apache/juneau/http/ProxyAuthenticate.java   |  58 ++++
 .../apache/juneau/http/ProxyAuthorization.java  |  60 ++++
 .../main/java/org/apache/juneau/http/Range.java | 136 +++++++++
 .../java/org/apache/juneau/http/Referer.java    |  65 +++++
 .../java/org/apache/juneau/http/RetryAfter.java |  94 +++++++
 .../java/org/apache/juneau/http/Server.java     |  65 +++++
 .../org/apache/juneau/http/StringRange.java     | 276 +++++++++++++++++++
 .../main/java/org/apache/juneau/http/TE.java    |  97 +++++++
 .../java/org/apache/juneau/http/Trailer.java    |  65 +++++
 .../apache/juneau/http/TransferEncoding.java    |  64 +++++
 .../java/org/apache/juneau/http/TypeRange.java  | 276 -------------------
 .../java/org/apache/juneau/http/Upgrade.java    |  84 ++++++
 .../java/org/apache/juneau/http/UserAgent.java  |  60 ++++
 .../main/java/org/apache/juneau/http/Vary.java  |  78 ++++++
 .../main/java/org/apache/juneau/http/Via.java   | 115 ++++++++
 .../java/org/apache/juneau/http/Warning.java    | 123 +++++++++
 .../org/apache/juneau/http/WwwAuthenticate.java |  56 ++++
 .../java/org/apache/juneau/internal/Cache.java  |  81 ++++++
 .../org/apache/juneau/internal/DateUtils.java   | 186 +++++++++++++
 .../org/apache/juneau/internal/StringUtils.java |  16 ++
 .../java/org/apache/juneau/xml/XmlParser.java   |   1 +
 66 files changed, 4939 insertions(+), 545 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core-test/src/test/java/org/apache/juneau/https/AcceptExtensionsTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/https/AcceptExtensionsTest.java b/juneau-core-test/src/test/java/org/apache/juneau/https/AcceptExtensionsTest.java
index be8b0f0..6a7b0d3 100644
--- a/juneau-core-test/src/test/java/org/apache/juneau/https/AcceptExtensionsTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/https/AcceptExtensionsTest.java
@@ -32,7 +32,7 @@ public class AcceptExtensionsTest {
 		MediaTypeRange mr;
 		
 		accept = Accept.forString("text/json");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("text/json", mr);
 		assertTextEquals("text/json", mr.getMediaType());
 		assertObjectEquals("{}", mr.getMediaType().getParameters());
@@ -40,7 +40,7 @@ public class AcceptExtensionsTest {
 		assertObjectEquals("{}", mr.getExtensions());
 
 		accept = Accept.forString("foo,bar");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("foo", mr);
 		assertTextEquals("foo", mr.getMediaType());
 		assertObjectEquals("{}", mr.getMediaType().getParameters());
@@ -48,7 +48,7 @@ public class AcceptExtensionsTest {
 		assertObjectEquals("{}", mr.getExtensions());
 
 		accept = Accept.forString(" foo , bar ");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("foo", mr);
 		assertTextEquals("foo", mr.getMediaType());
 		assertObjectEquals("{}", mr.getMediaType().getParameters());
@@ -56,7 +56,7 @@ public class AcceptExtensionsTest {
 		assertObjectEquals("{}", mr.getExtensions());
 
 		accept = Accept.forString("text/json;a=1;q=0.9;b=2");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("text/json;a=1;q=0.9;b=2", mr);
 		assertTextEquals("text/json;a=1", mr.getMediaType());
 		assertObjectEquals("{a:['1']}", mr.getMediaType().getParameters());
@@ -64,7 +64,7 @@ public class AcceptExtensionsTest {
 		assertObjectEquals("{b:['2']}", mr.getExtensions());
 		
 		accept = Accept.forString("text/json;a=1;a=2;q=0.9;b=3;b=4");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("text/json;a=1;a=2;q=0.9;b=3;b=4", mr);
 		assertTextEquals("text/json;a=1;a=2", mr.getMediaType());
 		assertObjectEquals("{a:['1','2']}", mr.getMediaType().getParameters());
@@ -72,7 +72,7 @@ public class AcceptExtensionsTest {
 		assertObjectEquals("{b:['3','4']}", mr.getExtensions());
 
 		accept = Accept.forString("text/json;a=1");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("text/json;a=1", mr);
 		assertTextEquals("text/json;a=1", mr.getMediaType());
 		assertObjectEquals("{a:['1']}", mr.getMediaType().getParameters());
@@ -80,7 +80,7 @@ public class AcceptExtensionsTest {
 		assertObjectEquals("{}", mr.getExtensions());
 
 		accept = Accept.forString("text/json;a=1;");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("text/json;a=1", mr);
 		assertTextEquals("text/json;a=1", mr.getMediaType());
 		assertObjectEquals("{a:['1']}", mr.getMediaType().getParameters());
@@ -88,7 +88,7 @@ public class AcceptExtensionsTest {
 		assertObjectEquals("{}", mr.getExtensions());
 		
 		accept = Accept.forString("text/json;q=0.9");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("text/json;q=0.9", mr);
 		assertTextEquals("text/json", mr.getMediaType());
 		assertObjectEquals("{}", mr.getMediaType().getParameters());
@@ -96,7 +96,7 @@ public class AcceptExtensionsTest {
 		assertObjectEquals("{}", mr.getExtensions());
 
 		accept = Accept.forString("text/json;q=0.9;");
-		mr = accept.getMediaRanges().get(0);
+		mr = accept.asRanges().get(0);
 		assertTextEquals("text/json;q=0.9", mr);
 		assertTextEquals("text/json", mr.getMediaType());
 		assertObjectEquals("{}", mr.getMediaType().getParameters());

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
index c5df1d1..33c1165 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
@@ -942,7 +942,7 @@ public class BeanContext extends Context {
 	 * If <jk>null</jk>, the system default locale is assumed.
 	 * @param timeZone The bean session timezone.
 	 * Typically used by time-sensitive {@link PojoSwap PojoSwaps} to provide timezone-specific output.
-	 * If <jk>null</jk> the system default timezone is assumed on {@link Date} objects, or the
+	 * If <jk>null</jk> the system default timezone is assumed on {@link java.util.Date} objects, or the
 	 * 	locale specified on {@link Calendar} objects are used.
 	 * @param mediaType The session media type (e.g. <js>"application/json"</js>).
 	 * @return A new session object.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/Accept.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/Accept.java b/juneau-core/src/main/java/org/apache/juneau/http/Accept.java
index 5fabc73..48aa91a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/http/Accept.java
+++ b/juneau-core/src/main/java/org/apache/juneau/http/Accept.java
@@ -12,24 +12,29 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.http;
 
+import static org.apache.juneau.http.Constants.*;
+
 import java.util.*;
-import java.util.concurrent.*;
 
 import org.apache.juneau.internal.*;
 
 /**
- * Represents a parsed <code>Accept:</code> HTTP header.
+ * Represents a parsed <l>Accept</l> HTTP request header.
  * <p>
- * The formal RFC2616 header field definition is as follows:
+ * Content-Types that are acceptable for the response.
+ *
+ * <h6 class='figure'>Example</h6>
  * <p class='bcode'>
- * 	14.1 Accept
+ * 	Accept: text/plain
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
  *
- * 	The Accept request-header field can be used to specify certain media
- * 	types which are acceptable for the response. Accept headers can be
- * 	used to indicate that the request is specifically limited to a small
- * 	set of desired types, as in the case of a request for an in-line
- * 	image.
+ * The Accept request-header field can be used to specify certain media types which are acceptable for the response.
+ * Accept headers can be used to indicate that the request is specifically limited to a small set of desired types, as
+ * in the case of a request for an in-line image.
  *
+ * <p class='bcode'>
  * 	 Accept         = "Accept" ":
  * 							#( media-range [ accept-params ] )
  *
@@ -39,122 +44,111 @@ import org.apache.juneau.internal.*;
  * 							) *( ";" parameter )
  * 	 accept-params  = ";" "q" "=" qvalue *( accept-extension )
  * 	 accept-extension = ";" token [ "=" ( token | quoted-string ) ]
- *
- * 	The asterisk "*" character is used to group media types into ranges,
- * 	with "* /*" indicating all media types and "type/*" indicating all
- * 	subtypes of that type. The media-range MAY include media type
- * 	parameters that are applicable to that range.
- *
- * 	Each media-range MAY be followed by one or more accept-params,
- * 	beginning with the "q" parameter for indicating a relative quality
- * 	factor. The first "q" parameter (if any) separates the media-range
- * 	parameter(s) from the accept-params. Quality factors allow the user
- * 	or user agent to indicate the relative degree of preference for that
- * 	media-range, using the qvalue scale from 0 to 1 (section 3.9). The
- * 	default value is q=1.
- *
- * 	Note: Use of the "q" parameter name to separate media type
- * 	parameters from Accept extension parameters is due to historical
- * 	practice. Although this prevents any media type parameter named
- * 	"q" from being used with a media range, such an event is believed
- * 	to be unlikely given the lack of any "q" parameters in the IANA
- * 	media type registry and the rare usage of any media type
- * 	parameters in Accept. Future media types are discouraged from
- * 	registering any parameter named "q".
- *
- * 	The example
- *
- * 		Accept: audio/*; q=0.2, audio/basic
- *
- * 	SHOULD be interpreted as "I prefer audio/basic, but send me any audio
- * 	type if it is the best available after an 80% mark-down in quality."
- *
- * 	If no Accept header field is present, then it is assumed that the
- * 	client accepts all media types. If an Accept header field is present,
- * 	and if the server cannot send a response which is acceptable
- * 	according to the combined Accept field value, then the server SHOULD
- * 	send a 406 (not acceptable) response.
- *
- * 	A more elaborate example is
- *
- * 	    Accept: text/plain; q=0.5, text/html,
- * 	            text/x-dvi; q=0.8, text/x-c
- *
- * 	Verbally, this would be interpreted as "text/html and text/x-c are
- * 	the preferred media types, but if they do not exist, then send the
- * 	text/x-dvi entity, and if that does not exist, send the text/plain
- * 	entity."
- *
- * 	Media ranges can be overridden by more specific media ranges or
- * 	specific media types. If more than one media range applies to a given
- * 	type, the most specific reference has precedence. For example,
- *
- * 	    Accept: text/ *, text/html, text/html;level=1, * /*
- *
- * 	have the following precedence:
- *
- * 	    1) text/html;level=1
- * 	    2) text/html
- * 	    3) text/*
- * 	    4) * /*
- *
- * 	The media type quality factor associated with a given type is
- * 	determined by finding the media range with the highest precedence
- * 	which matches that type. For example,
- *
- * 	    Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1,
- * 	            text/html;level=2;q=0.4, * /*;q=0.5
- *
- * 	would cause the following values to be associated:
- *
- * 	    text/html;level=1         = 1
- * 	    text/html                 = 0.7
- * 	    text/plain                = 0.3
- * 	    image/jpeg                = 0.5
- * 	    text/html;level=2         = 0.4
- * 	    text/html;level=3         = 0.7
- *
- * 	   Note: A user agent might be provided with a default set of quality
- * 	   values for certain media ranges. However, unless the user agent is
- * 	   a closed system which cannot interact with other rendering agents,
- * 	   this default set ought to be configurable by the user.
  * </p>
+ * <p>
+ * The asterisk "*" character is used to group media types into ranges, with "* /*" indicating all media types and
+ * "type/*" indicating all subtypes of that type.
+ * The media-range MAY include media type parameters that are applicable to that range.
+ * <p>
+ * Each media-range MAY be followed by one or more accept-params, beginning with the "q" parameter for indicating a
+ * relative quality factor.
+ * The first "q" parameter (if any) separates the media-range parameter(s) from the accept-params.
+ * Quality factors allow the user or user agent to indicate the relative degree of preference for that media-range,
+ * using the qvalue scale from 0 to 1 (section 3.9).
+ * The default value is q=1.
+ * <p>
+ * Note: Use of the "q" parameter name to separate media type parameters from Accept extension parameters is due to
+ * historical practice.
+ * Although this prevents any media type parameter named "q" from being used with a media range, such an event is
+ * believed to be unlikely given the lack of any "q" parameters in the IANA
+ * media type registry and the rare usage of any media type parameters in Accept.
+ * Future media types are discouraged from registering any parameter named "q".
+ * <p>
+ * The example
+ * <p class='bcode'>
+ * 	Accept: audio/*; q=0.2, audio/basic
+ * </p>
+ * <p>
+ * SHOULD be interpreted as "I prefer audio/basic, but send me any audio type if it is the best available after an 80%
+ * mark-down in quality."
+ * <p>
+ * If no Accept header field is present, then it is assumed that the client accepts all media types.
+ * <p>
+ * If an Accept header field is present, and if the server cannot send a response which is acceptable according to the
+ * combined Accept field value, then the server SHOULD send a 406 (not acceptable) response.
+ * <p>
+ * A more elaborate example is
+ * <p class='bcode'>
+ * 	Accept: text/plain; q=0.5, text/html,
+ * 	        text/x-dvi; q=0.8, text/x-c
+ * </p>
+ * <p>
+ * Verbally, this would be interpreted as "text/html and text/x-c are the preferred media types, but if they do not
+ * exist, then send the
+ * text/x-dvi entity, and if that does not exist, send the text/plain entity."
+ * <p>
+ * Media ranges can be overridden by more specific media ranges or specific media types.
+ * If more than one media range applies to a given type, the most specific reference has precedence.
+ * For example,
+ * <p class='bcode'>
+ * 	Accept: text/ *, text/html, text/html;level=1, * /*
+ * </p>
+ * <p>
+ * have the following precedence:
+ * <ol>
+ * 	<li>text/html;level=1
+ * 	<li>text/html
+ * 	<li>text/*
+ * 	<li>* /*
+ * </ol>
+ * <p>
+ * The media type quality factor associated with a given type is determined by finding the media range with the highest
+ * precedence which matches that type.
+ * For example,
+ * <p class='bcode'>
+ * 	Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1,
+ * 	        text/html;level=2;q=0.4, * /*;q=0.5
+ * </p>
+ * <p>
+ * would cause the following values to be associated:
+ * <p class='bcode'>
+ * 	text/html;level=1         = 1
+ * 	text/html                 = 0.7
+ * 	text/plain                = 0.3
+ * 	image/jpeg                = 0.5
+ * 	text/html;level=2         = 0.4
+ * 	text/html;level=3         = 0.7
+ * </p>
+ * <p>
+ * Note: A user agent might be provided with a default set of quality values for certain media ranges.
+ * However, unless the user agent is a closed system which cannot interact with other rendering agents, this default
+ * set ought to be configurable by the user.
  */
 public final class Accept {
 
-	private static final boolean nocache = Boolean.getBoolean("juneau.http.Accept.nocache");
-	private static final ConcurrentHashMap<String,Accept> cache = new ConcurrentHashMap<String,Accept>();
-
-	private final MediaTypeRange[] mediaRanges;
-	private final List<MediaTypeRange> mediaRangesList;
+	private static final Cache<String,Accept> cache = new Cache<String,Accept>(NOCACHE, CACHE_MAX_SIZE);
 
 	/**
 	 * Returns a parsed <code>Accept</code> header.
 	 *
-	 * @param s The <code>Accept</code> header string.
+	 * @param value The <code>Accept</code> header string.
 	 * @return The parsed <code>Accept</code> header, or <jk>null</jk> if the string was null.
 	 */
-	public static Accept forString(String s) {
-		if (s == null)
+	public static Accept forString(String value) {
+		if (value == null)
 			return null;
-
-		// Prevent OOM in case of DDOS
-		if (cache.size() > 1000)
-			cache.clear();
-
-		while (true) {
-			Accept a = cache.get(s);
-			if (a != null)
-				return a;
-			a = new Accept(s);
-			if (nocache)
-				return a;
-			cache.putIfAbsent(s, a);
-		}
+		Accept a = cache.get(value);
+		if (a == null)
+			a = cache.put(value, new Accept(value));
+		return a;
 	}
 
-	private Accept(String raw) {
-		this.mediaRanges = MediaTypeRange.parse(raw);
+
+	private final MediaTypeRange[] mediaRanges;
+	private final List<MediaTypeRange> mediaRangesList;
+
+	private Accept(String value) {
+		this.mediaRanges = MediaTypeRange.parse(value);
 		this.mediaRangesList = Collections.unmodifiableList(Arrays.asList(mediaRanges));
 	}
 
@@ -165,7 +159,7 @@ public final class Accept {
 	 *
 	 * @return An unmodifiable list of media ranges.
 	 */
-	public List<MediaTypeRange> getMediaRanges() {
+	public List<MediaTypeRange> asRanges() {
 		return mediaRangesList;
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/AcceptCharset.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/AcceptCharset.java b/juneau-core/src/main/java/org/apache/juneau/http/AcceptCharset.java
new file mode 100644
index 0000000..3792104
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/AcceptCharset.java
@@ -0,0 +1,82 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+import static org.apache.juneau.http.Constants.*;
+
+import org.apache.juneau.internal.*;
+
+/**
+ * Represents a parsed <l>Accept-Charset</l> HTTP request header.
+ * <p>
+ * Character sets that are acceptable.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Accept-Charset: utf-8
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Accept-Charset request-header field can be used to indicate what character sets are acceptable for the response.
+ * <p>
+ * This field allows clients capable of understanding more comprehensive or special- purpose character sets to signal
+ * that capability to a server which is capable of representing documents in those character sets.
+ * <p class='bcode'>
+ * 	Accept-Charset = "Accept-Charset" ":"
+ * 	                 1#( ( charset | "*" )[ ";" "q" "=" qvalue ] )
+ * </p>
+ * <p>
+ * Character set values are described in section 3.4. Each charset MAY be given an associated quality value which
+ * represents the user's preference for that charset.
+ * The default value is q=1.
+ * An example is...
+ * <p class='bcode'>
+ * 	Accept-Charset: iso-8859-5, unicode-1-1;q=0.8
+ * </p>
+ * <p>
+ * The special value "*", if present in the Accept-Charset field, matches every character set (including ISO-8859-1)
+ * which is not mentioned elsewhere in the Accept-Charset field.
+ * <p>
+ * If no "*" is present in an Accept-Charset field, then all character sets not explicitly mentioned get a quality
+ * value of 0, except for ISO-8859-1, which gets a quality value of 1 if not explicitly mentioned.
+ * <p>
+ * If no Accept-Charset header is present, the default is that any character set is acceptable.
+ * <p>
+ * If an Accept-Charset header is present, and if the server cannot send a response which is acceptable according to
+ * the Accept-Charset header, then the server SHOULD send an error response with the 406 (not acceptable) status code,
+ * though the sending of an unacceptable response is also allowed.
+ */
+public final class AcceptCharset extends HeaderRangeArray {
+
+	private static final Cache<String,AcceptCharset> cache = new Cache<String,AcceptCharset>(NOCACHE, CACHE_MAX_SIZE);
+
+	/**
+	 * Returns a parsed <code>Accept-Charset</code> header.
+	 *
+	 * @param value The <code>Accept-Charset</code> header string.
+	 * @return The parsed <code>Accept-Charset</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static AcceptCharset forString(String value) {
+		if (value == null)
+			return null;
+		AcceptCharset a = cache.get(value);
+		if (a == null)
+			a = cache.put(value, new AcceptCharset(value));
+		return a;
+	}
+
+	private AcceptCharset(String value) {
+		super(value);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/AcceptEncoding.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/AcceptEncoding.java b/juneau-core/src/main/java/org/apache/juneau/http/AcceptEncoding.java
index 8d83401..1502e57 100644
--- a/juneau-core/src/main/java/org/apache/juneau/http/AcceptEncoding.java
+++ b/juneau-core/src/main/java/org/apache/juneau/http/AcceptEncoding.java
@@ -12,142 +12,91 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.http;
 
-import java.util.*;
-import java.util.concurrent.*;
+import static org.apache.juneau.http.Constants.*;
 
 import org.apache.juneau.internal.*;
 
 /**
- * Represents a parsed <code>Accept-Encoding:</code> HTTP header.
+ * Represents a parsed <l>Accept-Encoding</l> HTTP request header.
  * <p>
- * The formal RFC2616 header field definition is as follows:
- * <p class='bcode'>
- * 	The Accept-Encoding request-header field is similar to Accept, but restricts
- * 	the content-codings (section 3.5) that are acceptable in the response.
- *
- * 		Accept-Encoding  = "Accept-Encoding" ":"
- * 		                   1#( codings [ ";" "q" "=" qvalue ] )
- * 		codings          = ( content-coding | "*" )
- *
- * 	Examples of its use are:
- *
- * 		Accept-Encoding: compress, gzip
- * 		Accept-Encoding:
- * 		Accept-Encoding: *
- * 		Accept-Encoding: compress;q=0.5, gzip;q=1.0
- * 		Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0
- *
- * 	A server tests whether a content-coding is acceptable, according to an
- * 	Accept-Encoding field, using these rules:
+ * List of acceptable encodings.
  *
- * 	   1. If the content-coding is one of the content-codings listed in
- * 	      the Accept-Encoding field, then it is acceptable, unless it is
- * 	      accompanied by a qvalue of 0. (As defined in section 3.9, a
- * 	      qvalue of 0 means "not acceptable.")
- * 	   2. The special "*" symbol in an Accept-Encoding field matches any
- * 	      available content-coding not explicitly listed in the header
- * 	      field.
- * 	   3. If multiple content-codings are acceptable, then the acceptable
- * 	      content-coding with the highest non-zero qvalue is preferred.
- * 	   4. The "identity" content-coding is always acceptable, unless
- * 	      specifically refused because the Accept-Encoding field includes
- * 	      "identity;q=0", or because the field includes "*;q=0" and does
- * 	      not explicitly include the "identity" content-coding. If the
- * 	      Accept-Encoding field-value is empty, then only the "identity"
- * 	      encoding is acceptable.
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Accept-Encoding: gzip, deflate
+ * </p>
  *
- * 	If an Accept-Encoding field is present in a request, and if the server cannot
- * 	send a response which is acceptable according to the Accept-Encoding header,
- * 	then the server SHOULD send an error response with the 406 (Not Acceptable) status code.
+ * <h6 class='topic'>RFC2616 Specification</h6>
  *
- * 	If no Accept-Encoding field is present in a request, the server MAY assume
- * 	that the client will accept any content coding. In this case, if "identity"
- * 	is one of the available content-codings, then the server SHOULD use the "identity"
- * 	content-coding, unless it has additional information that a different content-coding
- * 	is meaningful to the client.
+ * The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings (section 3.5) that are acceptable in the response.
  *
- * 	      Note: If the request does not include an Accept-Encoding field,
- * 	      and if the "identity" content-coding is unavailable, then
- * 	      content-codings commonly understood by HTTP/1.0 clients (i.e.,
- * 	      "gzip" and "compress") are preferred; some older clients
- * 	      improperly display messages sent with other content-codings.  The
- * 	      server might also make this decision based on information about
- * 	      the particular user-agent or client.
- * 	      Note: Most HTTP/1.0 applications do not recognize or obey qvalues
- * 	      associated with content-codings. This means that qvalues will not
- * 	      work and are not permitted with x-gzip or x-compress.
+ * <p class='bcode'>
+ * 	Accept-Encoding  = "Accept-Encoding" ":"
+ * 	                   1#( codings [ ";" "q" "=" qvalue ] )
+ * 	codings          = ( content-coding | "*" )
  * </p>
+ * <p>
+ * Examples of its use are:
+ * <p class='bcode'>
+ * 	Accept-Encoding: compress, gzip
+ * 	Accept-Encoding:
+ * 	Accept-Encoding: *
+ * 	Accept-Encoding: compress;q=0.5, gzip;q=1.0
+ * 	Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0
+ * </p>
+ * <p>
+ * A server tests whether a content-coding is acceptable, according to an Accept-Encoding field, using these rules:
+ * <ol>
+ * 	<li>If the content-coding is one of the content-codings listed in the Accept-Encoding field, then it is
+ * 		acceptable, unless it is accompanied by a qvalue of 0.
+ * 		(As defined in section 3.9, a qvalue of 0 means "not acceptable.")
+ * 	<li>The special "*" symbol in an Accept-Encoding field matches any available content-coding not explicitly listed
+ * 		in the header field.
+ * 	<li>If multiple content-codings are acceptable, then the acceptable content-coding with the highest non-zero
+ * 		qvalue is preferred.
+ * 	<li>The "identity" content-coding is always acceptable, unless specifically refused because the Accept-Encoding
+ * 		field includes "identity;q=0", or because the field includes "*;q=0" and does not explicitly include the
+ * 		"identity" content-coding.
+ * 		If the Accept-Encoding field-value is empty, then only the "identity" encoding is acceptable.
+ * </ol>
+ * <p>
+ * If an Accept-Encoding field is present in a request, and if the server cannot send a response which is acceptable
+ * according to the Accept-Encoding header, then the server SHOULD send an error response with the 406 (Not Acceptable)
+ * status code.
+ * <p>
+ * If no Accept-Encoding field is present in a request, the server MAY assume that the client will accept any content
+ * coding.
+ * In this case, if "identity" is one of the available content-codings, then the server SHOULD use the "identity"
+ * content-coding, unless it has additional information that a different content-coding is meaningful to the client.
+ * <p>
+ * Note: If the request does not include an Accept-Encoding field, and if the "identity" content-coding is unavailable,
+ * then content-codings commonly understood by HTTP/1.0 clients (i.e.,"gzip" and "compress") are preferred; some older
+ * clients improperly display messages sent with other content-codings.
+ * The server might also make this decision based on information about the particular user-agent or client.
+ * <p>
+ * Note: Most HTTP/1.0 applications do not recognize or obey qvalues associated with content-codings.
+ * This means that qvalues will not work and are not permitted with x-gzip or x-compress.
  */
-public final class AcceptEncoding {
-
-	private static final boolean nocache = Boolean.getBoolean("juneau.http.AcceptEncoding.nocache");
-	private static final ConcurrentHashMap<String,AcceptEncoding> cache = new ConcurrentHashMap<String,AcceptEncoding>();
+public final class AcceptEncoding extends HeaderRangeArray {
 
-	private final TypeRange[] typeRanges;
-	private final List<TypeRange> typeRangesList;
+	private static final Cache<String,AcceptEncoding> cache = new Cache<String,AcceptEncoding>(NOCACHE, CACHE_MAX_SIZE);
 
 	/**
 	 * Returns a parsed <code>Accept-Encoding</code> header.
 	 *
-	 * @param s The <code>Accept-Encoding</code> header string.
+	 * @param value The <code>Accept-Encoding</code> header string.
 	 * @return The parsed <code>Accept-Encoding</code> header, or <jk>null</jk> if the string was null.
 	 */
-	public static AcceptEncoding forString(String s) {
-		if (s == null)
+	public static AcceptEncoding forString(String value) {
+		if (value == null)
 			return null;
-
-		// Prevent OOM in case of DDOS
-		if (cache.size() > 1000)
-			cache.clear();
-
-		while (true) {
-			AcceptEncoding a = cache.get(s);
-			if (a != null)
-				return a;
-			a = new AcceptEncoding(s);
-			if (nocache)
-				return a;
-			cache.putIfAbsent(s, a);
-		}
-	}
-
-	private AcceptEncoding(String raw) {
-		this.typeRanges = TypeRange.parse(raw);
-		this.typeRangesList = Collections.unmodifiableList(Arrays.asList(typeRanges));
-	}
-
-	/**
-	 * Returns the list of the types ranges that make up this header.
-	 * <p>
-	 * The types ranges in the list are sorted by their q-value in descending order.
-	 *
-	 * @return An unmodifiable list of type ranges.
-	 */
-	public List<TypeRange> getTypeRanges() {
-		return typeRangesList;
-	}
-
-	/**
-	 * Given a list of content codings, returns the best match for this <code>Accept-Encoding</code> header.
-	 * <p>
-	 *
-	 * @param contentCodings The codings to match against.
-	 * @return The index into the array of the best match, or <code>-1</code> if no suitable matches could be found.
-	 */
-	public int findMatch(String[] contentCodings) {
-
-		// Type ranges are ordered by 'q'.
-		// So we only need to search until we've found a match.
-		for (TypeRange mr : typeRanges)
-			for (int i = 0; i < contentCodings.length; i++)
-				if (mr.matches(contentCodings[i]))
-					return i;
-
-		return -1;
+		AcceptEncoding a = cache.get(value);
+		if (a == null)
+			a = cache.put(value, new AcceptEncoding(value));
+		return a;
 	}
 
-	@Override /* Object */
-	public String toString() {
-		return StringUtils.join(typeRanges, ',');
+	private AcceptEncoding(String value) {
+		super(value);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/AcceptLanguage.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/AcceptLanguage.java b/juneau-core/src/main/java/org/apache/juneau/http/AcceptLanguage.java
new file mode 100644
index 0000000..654abf7
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/AcceptLanguage.java
@@ -0,0 +1,110 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+import static org.apache.juneau.http.Constants.*;
+
+import org.apache.juneau.internal.*;
+
+/**
+ * Represents a parsed <l>Accept-Language</l> HTTP request header.
+ * <p>
+ * List of acceptable human languages for response.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Accept-Language: en-US
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Accept-Language request-header field is similar to Accept, but restricts the set of natural languages that are
+ * preferred as a response to the request.
+ * Language tags are defined in section 3.10.
+ *
+ * <p class='bcode'>
+ * 	Accept-Language = "Accept-Language" ":"
+ * 	                  1#( language-range [ ";" "q" "=" qvalue ] )
+ * 	language-range  = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
+ * </p>
+ * <p>
+ * Each language-range MAY be given an associated quality value which represents an estimate of the user's preference
+ * for the languages specified by that range.
+ * The quality value defaults to "q=1".
+ * For example...
+ * <p class='bcode'>
+ * 	Accept-Language: da, en-gb;q=0.8, en;q=0.7
+ * </p>
+ * <p>
+ * ...would mean: "I prefer Danish, but will accept British English and other types of English."
+ * <p>
+ * A language-range matches a language-tag if it exactly equals the tag, or if it exactly equals a prefix of the tag
+ * such that the first tag character following the prefix is "-".
+ * <p>
+ * The special range "*", if present in the Accept-Language field, matches every tag not matched by any other range
+ * present in the Accept-Language field.
+ * <p>
+ * Note: This use of a prefix matching rule does not imply that language tags are assigned to languages in such a way
+ * that it is always true that if a user understands a language with a certain
+ * tag, then this user will also understand all languages with tags for which this tag is a prefix.
+ * The prefix rule simply allows the use of prefix tags if this is the case.
+ * <p>
+ * The language quality factor assigned to a language-tag by the Accept-Language field is the quality value of the
+ * longest language- range in the field that matches the language-tag.
+ * <p>
+ * If no language- range in the field matches the tag, the language quality factor assigned is 0.
+ * <p>
+ * If no Accept-Language header is present in the request, the server SHOULD assume that all languages are equally
+ * acceptable.
+ * <p>
+ * If an Accept-Language header is present, then all languages which are assigned a quality factor greater than 0 are
+ * acceptable.
+ * <p>
+ * It might be contrary to the privacy expectations of the user to send an Accept-Language header with the complete
+ * linguistic preferences of the user in every request.
+ * For a discussion of this issue, see section 15.1.4.
+ * <p>
+ * As intelligibility is highly dependent on the individual user, it is recommended that client applications make the
+ * choice of linguistic preference available to the user.
+ * If the choice is not made available, then the Accept-Language header field MUST NOT be given in the request.
+ * <p>
+ * Note: When making the choice of linguistic preference available to the user, we remind implementors of the fact that
+ * users are not familiar with the details of language matching as described above, and should provide appropriate
+ * guidance.
+ * As an example, users might assume that on selecting "en-gb", they will be served any kind of English document if
+ * British English is not available.
+ * A user agent might suggest in such a case to add "en" to get the best matching behavior.
+ */
+public final class AcceptLanguage extends HeaderRangeArray {
+
+	private static final Cache<String,AcceptLanguage> cache = new Cache<String,AcceptLanguage>(NOCACHE, CACHE_MAX_SIZE);
+
+	/**
+	 * Returns a parsed <code>Accept-Language</code> header.
+	 *
+	 * @param value The <code>Accept-Language</code> header string.
+	 * @return The parsed <code>Accept-Language</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static AcceptLanguage forString(String value) {
+		if (value == null)
+			return null;
+		AcceptLanguage a = cache.get(value);
+		if (a == null)
+			a = cache.put(value, new AcceptLanguage(value));
+		return a;
+	}
+
+	private AcceptLanguage(String raw) {
+		super(raw);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/AcceptRanges.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/AcceptRanges.java b/juneau-core/src/main/java/org/apache/juneau/http/AcceptRanges.java
new file mode 100644
index 0000000..eeb4aea
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/AcceptRanges.java
@@ -0,0 +1,69 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Accept-Range</l> HTTP response header.
+ * <p>
+ * What partial content range types this server supports via byte serving.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Accept-Ranges: bytes
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Accept-Ranges response-header field allows the server to indicate its acceptance of range requests for a
+ * resource:
+ * <p class='bcode'>
+ * 	Accept-Ranges     = "Accept-Ranges" ":" acceptable-ranges
+ * 	acceptable-ranges = 1#range-unit | "none"
+ * </p>
+ * <p>
+ * Origin servers that accept byte-range requests MAY send...
+ * <p class='bcode'>
+ * 	Accept-Ranges: bytes
+ * </p>
+ * <p>
+ * ...but are not required to do so.
+ * <p>
+ * Clients MAY generate byte-range requests without having received this header for the resource involved.
+ * <p>
+ * Range units are defined in section 3.12.
+ * <p>
+ * Servers that do not accept any kind of range request for a resource MAY send...
+ * <p class='bcode'>
+ * 	Accept-Ranges: none
+ * </p>
+ * <p>
+ * ...to advise the client not to attempt a range request.
+ */
+public final class AcceptRanges extends HeaderString {
+
+	/**
+	 * Returns a parsed <code>Accept-Ranges</code> header.
+	 *
+	 * @param value The <code>Accept-Ranges</code> header string.
+	 * @return The parsed <code>Accept-Ranges</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static AcceptRanges forString(String value) {
+		if (value == null)
+			return null;
+		return new AcceptRanges(value);
+	}
+
+	private AcceptRanges(String value) {
+		super(value);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/Age.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/Age.java b/juneau-core/src/main/java/org/apache/juneau/http/Age.java
new file mode 100644
index 0000000..1e4aec5
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/Age.java
@@ -0,0 +1,64 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Age</l> HTTP response header.
+ * <p>
+ * The age the object has been in a proxy cache in seconds.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Age: 12
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Age response-header field conveys the sender's estimate of the amount of time since the response (or its
+ * revalidation) was generated at the origin server.
+ * A cached response is "fresh" if its age does not exceed its freshness lifetime.
+ * Age values are calculated as specified in section 13.2.3.
+ *
+ * <p class='bcode'>
+ * 	Age = "Age" ":" age-value
+ * 	age-value = delta-seconds
+ * </p>
+ * <p>
+ * Age values are non-negative decimal integers, representing time in seconds.
+ * <p>
+ * If a cache receives a value larger than the largest positive integer it can represent, or if any of its age
+ * calculations overflows, it MUST transmit an Age header with a value of 2147483648 (2^31).
+ * <p>
+ * An HTTP/1.1 server that includes a cache MUST include an Age header field in every response generated from its own
+ * cache.
+ * <p>
+ * Caches SHOULD use an arithmetic type of at least 31 bits of range.
+ */
+public final class Age extends HeaderInteger {
+
+	/**
+	 * Returns a parsed <code>Age</code> header.
+	 *
+	 * @param value The <code>Age</code> header string.
+	 * @return The parsed <code>Age</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static Age forString(String value) {
+		if (value == null)
+			return null;
+		return new Age(value);
+	}
+
+	private Age(String value) {
+		super(value);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/Allow.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/Allow.java b/juneau-core/src/main/java/org/apache/juneau/http/Allow.java
new file mode 100644
index 0000000..67dbc80
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/Allow.java
@@ -0,0 +1,72 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Allow</l> HTTP response header.
+ * <p>
+ * Valid methods for a specified resource. To be used for a 405 Method not allowed.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Allow: GET, HEAD
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Allow entity-header field lists the set of methods supported by the resource identified by the Request-URI.
+ * The purpose of this field is strictly to inform the recipient of valid methods associated with the resource.
+ * An Allow header field MUST be present in a 405 (Method Not Allowed) response.
+ *
+ * <p class='bcode'>
+ * 	Allow   = "Allow" ":" #Method
+ * </p>
+ * <p>
+ * Example of use:
+ * <p class='bcode'>
+ * 	Allow: GET, HEAD, PUT
+ * </p>
+ * <p>
+ * This field cannot prevent a client from trying other methods.
+ * However, the indications given by the Allow header field value SHOULD be followed.
+ * <p>
+ * The actual set of allowed methods is defined by the origin server at the time of each request.
+ * <p>
+ * The Allow header field MAY be provided with a PUT request to recommend the methods to be supported by the new or
+ * modified resource.
+ * <p>
+ * The server is not required to support these methods and SHOULD include an Allow header in the response giving the
+ * actual supported methods.
+ * <p>
+ * A proxy MUST NOT modify the Allow header field even if it does not understand all the methods specified, since the
+ * user agent might
+ * have other means of communicating with the origin server.
+ */
+public final class Allow extends HeaderStringArray {
+
+	/**
+	 * Returns a parsed <code>Allow</code> header.
+	 *
+	 * @param value The <code>Allow</code> header string.
+	 * @return The parsed <code>Allow</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static Allow forString(String value) {
+		if (value == null)
+			return null;
+		return new Allow(value);
+	}
+
+	private Allow(String value) {
+		super(value);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/Authorization.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/Authorization.java b/juneau-core/src/main/java/org/apache/juneau/http/Authorization.java
new file mode 100644
index 0000000..530bd4d
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/Authorization.java
@@ -0,0 +1,78 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Authorization</l> HTTP request header.
+ * <p>
+ * Authentication credentials for HTTP authentication.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * A user agent that wishes to authenticate itself with a server--usually, but not necessarily, after receiving a 401
+ * response--does so by including an Authorization request-header field with the request.
+ * <p>
+ * The Authorization field value consists of credentials containing the authentication information of the user agent for
+ * the realm of the resource being requested.
+ *
+ * <p class='bcode'>
+ * 	Authorization  = "Authorization" ":" credentials
+ * </p>
+ * <p>
+ * HTTP access authentication is described in "HTTP Authentication: Basic and Digest Access Authentication".
+ * <p>
+ * If a request is authenticated and a realm specified, the same credentials SHOULD be valid for all other requests
+ * within this realm (assuming that the authentication scheme itself does not require otherwise, such as credentials
+ * that vary according to a challenge value or using synchronized clocks).
+ * <p>
+ * When a shared cache (see section 13.7) receives a request containing an Authorization field, it MUST NOT return the
+ * corresponding response as a reply to any other request, unless one of the following specific exceptions holds:
+ * <ol>
+ * 	<li>If the response includes the "s-maxage" cache-control directive, the cache MAY use that response in replying
+ * 		to a subsequent request.
+ * 		But (if the specified maximum age has passed) a proxy cache MUST first revalidate it with the origin
+ * 		server, using the request-headers from the new request to allow the origin server to authenticate the new
+ * 		request.
+ * 		(This is the defined behavior for s-maxage.)
+ * 		If the response includes "s-maxage=0", the proxy MUST always revalidate it before re-using it.
+ * 	<li>If the response includes the "must-revalidate" cache-control directive, the cache MAY use that response in
+ * 		replying to a subsequent request.
+ * 		But if the response is stale, all caches MUST first revalidate it with the origin server, using the
+ * 		request-headers from the new request to allow the origin server to authenticate the new request.
+ * 	<li>If the response includes the "public" cache-control directive, it MAY be returned in reply to any subsequent
+ * 		request.
+ * </ol>
+ */
+public final class Authorization extends HeaderString {
+
+	/**
+	 * Returns a parsed <code>Authorization</code> header.
+	 *
+	 * @param value The <code>Authorization</code> header string.
+	 * @return The parsed <code>Authorization</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static Authorization forString(String value) {
+		if (value == null)
+			return null;
+		return new Authorization(value);
+	}
+
+	private Authorization(String value) {
+		super(value);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/CacheControl.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/CacheControl.java b/juneau-core/src/main/java/org/apache/juneau/http/CacheControl.java
new file mode 100644
index 0000000..27a67a2
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/CacheControl.java
@@ -0,0 +1,102 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Cache-Control</l> HTTP request header.
+ * <p>
+ * Used to specify directives that must be obeyed by all caching mechanisms along the request-response chain.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Cache-Control: no-cache
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Cache-Control general-header field is used to specify directives that MUST be obeyed by all caching mechanisms
+ * along the request/response chain.
+ * The directives specify behavior intended to prevent caches from adversely interfering with the request or response.
+ * These directives typically override the default caching algorithms.
+ * Cache directives are unidirectional in that the presence of a directive in a request does not imply that the same
+ * directive is to be given in the response.
+ * <p>
+ * Note that HTTP/1.0 caches might not implement Cache-Control and might only implement Pragma: no-cache (see section
+ * 14.32).
+ * <p>
+ * Cache directives MUST be passed through by a proxy or gateway application, regardless of their significance to that
+ * application, since the directives might be applicable to all recipients along the request/response chain.
+ * It is not possible to specify a cache- directive for a specific cache.
+ *
+ * <p class='bcode'>
+ * 	Cache-Control   = "Cache-Control" ":" 1#cache-directive
+ * 	cache-directive = cache-request-directive
+ * 	     | cache-response-directive
+ * 	cache-request-directive =
+ * 	       "no-cache"                          ; Section 14.9.1
+ * 	     | "no-store"                          ; Section 14.9.2
+ * 	     | "max-age" "=" delta-seconds         ; Section 14.9.3, 14.9.4
+ * 	     | "max-stale" [ "=" delta-seconds ]   ; Section 14.9.3
+ * 	     | "min-fresh" "=" delta-seconds       ; Section 14.9.3
+ * 	     | "no-transform"                      ; Section 14.9.5
+ * 	     | "only-if-cached"                    ; Section 14.9.4
+ * 	     | cache-extension                     ; Section 14.9.6
+ * 	cache-response-directive =
+ * 	       "public"                               ; Section 14.9.1
+ * 	     | "private" [ "=" <"> 1#field-name <"> ] ; Section 14.9.1
+ * 	     | "no-cache" [ "=" <"> 1#field-name <"> ]; Section 14.9.1
+ * 	     | "no-store"                             ; Section 14.9.2
+ * 	     | "no-transform"                         ; Section 14.9.5
+ * 	     | "must-revalidate"                      ; Section 14.9.4
+ * 	     | "proxy-revalidate"                     ; Section 14.9.4
+ * 	     | "max-age" "=" delta-seconds            ; Section 14.9.3
+ * 	     | "s-maxage" "=" delta-seconds           ; Section 14.9.3
+ * 	     | cache-extension                        ; Section 14.9.6
+ * 	cache-extension = token [ "=" ( token | quoted-string ) ]
+ * </p>
+ * <p>
+ * When a directive appears without any 1#field-name parameter, the directive applies to the entire request or response.
+ * When such a directive appears with a 1#field-name parameter, it applies only to the named field or fields, and not
+ * to the rest of the request or response. This mechanism supports extensibility; implementations of future versions
+ * of the HTTP protocol might apply these directives to header fields not defined in HTTP/1.1.
+ * <p>
+ * The cache-control directives can be broken down into these general categories:
+ * <ul>
+ * 	<li>Restrictions on what are cacheable; these may only be imposed by the origin server.
+ * 	<li>Restrictions on what may be stored by a cache; these may be imposed by either the origin server or the user
+ * 		agent.
+ * 	<li>Modifications of the basic expiration mechanism; these may be imposed by either the origin server or the
+ * 		user agent.
+ * 	<li>Controls over cache revalidation and reload; these may only be imposed by a user agent.
+ * 	<li>Control over transformation of entities.
+ * 	<li>Extensions to the caching system.
+ * </ul>
+ */
+public final class CacheControl extends HeaderString {
+
+	/**
+	 * Returns a parsed <code>Cache-Control</code> header.
+	 *
+	 * @param value The <code>Cache-Control</code> header string.
+	 * @return The parsed <code>Cache-Control</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static CacheControl forString(String value) {
+		if (value == null)
+			return null;
+		return new CacheControl(value);
+	}
+
+	private CacheControl(String value) {
+		super(value);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/Connection.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/Connection.java b/juneau-core/src/main/java/org/apache/juneau/http/Connection.java
new file mode 100644
index 0000000..2eaec3a
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/Connection.java
@@ -0,0 +1,106 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Connection</l> HTTP request header.
+ * <p>
+ * Control options for the current connection and list of hop-by-hop request fields.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Connection: keep-alive
+ * 	Connection: Upgrade
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Connection general-header field allows the sender to specify options that are desired for that particular
+ * connection and MUST NOT be communicated by proxies over further connections.
+ * <p>
+ * The Connection header has the following grammar:
+ * <p class='bcode'>
+ * 	Connection = "Connection" ":" 1#(connection-token)
+ * 	connection-token  = token
+ * </p>
+ * <p>
+ * HTTP/1.1 proxies MUST parse the Connection header field before a message is forwarded and, for each connection-token
+ * in this field, remove any header field(s) from the message with the same name as the connection-token.
+ * Connection options are signaled by the presence of a connection-token in the Connection header field, not by any
+ * corresponding additional header field(s), since the additional header field may not be sent if there are no
+ * parameters associated with that connection option.
+ * <p>
+ * Message headers listed in the Connection header MUST NOT include end-to-end headers, such as Cache-Control.
+ * <p>
+ * HTTP/1.1 defines the "close" connection option for the sender to signal that the connection will be closed after
+ * completion of the response.
+ * For example...
+ * <p class='bcode'>
+ * 	Connection: close
+ * </p>
+ * <p>
+ * ...in either the request or the response header fields indicates that the connection SHOULD NOT be considered
+ * `persistent' (section 8.1) after the current request/response is complete.
+ * <p>
+ * HTTP/1.1 applications that do not support persistent connections MUST include the "close" connection option in
+ * every message.
+ * <p>
+ * A system receiving an HTTP/1.0 (or lower-version) message that includes a Connection header MUST, for each
+ * connection-token in this field, remove and ignore any header field(s) from the message with the same name as the
+ * connection-token.
+ * This protects against mistaken forwarding of such header fields by pre-HTTP/1.1 proxies.
+ * See section 19.6.2.
+ */
+public final class Connection extends HeaderString {
+
+	/**
+	 * Returns a parsed <code>Connection</code> header.
+	 *
+	 * @param value The <code>Connection</code> header string.
+	 * @return The parsed <code>Connection</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static Connection forString(String value) {
+		if (value == null)
+			return null;
+		return new Connection(value);
+	}
+
+
+	private Connection(String value) {
+		super(value);
+	}
+
+	/**
+	 * Returns <jk>true</jk> if the header value is <code>close</code>.
+	 * @return <jk>true</jk> if the header value is <code>close</code>.
+	 */
+	public boolean isClose() {
+		return eqIC("close");
+	}
+
+	/**
+	 * Returns <jk>true</jk> if the header value is <code>keep-alive</code>.
+	 * @return <jk>true</jk> if the header value is <code>keep-alive</code>.
+	 */
+	public boolean isKeepAlive() {
+		return eqIC("keep-alive");
+	}
+
+	/**
+	 * Returns <jk>true</jk> if the header value is <code>upgrade</code>.
+	 * @return <jk>true</jk> if the header value is <code>upgrade</code>.
+	 */
+	public boolean isUpgrade() {
+		return eqIC("upgrade");
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/Constants.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/Constants.java b/juneau-core/src/main/java/org/apache/juneau/http/Constants.java
new file mode 100644
index 0000000..7f31635
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/Constants.java
@@ -0,0 +1,21 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Constants used by classes in this package.
+ */
+public class Constants {
+	static boolean NOCACHE = Boolean.getBoolean("juneau.http.cache.disable");
+	static int CACHE_MAX_SIZE = Integer.getInteger("juneau.http.cache.maxSize", 1000);
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/ContentEncoding.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/ContentEncoding.java b/juneau-core/src/main/java/org/apache/juneau/http/ContentEncoding.java
new file mode 100644
index 0000000..bb92921
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/ContentEncoding.java
@@ -0,0 +1,74 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Content-Encoding</l> HTTP response header.
+ * <p>
+ * The type of encoding used on the data.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Content-Encoding: gzip
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Content-Encoding entity-header field is used as a modifier to the media-type.
+ * When present, its value indicates what additional content codings have been applied to the entity-body, and thus
+ * what decoding mechanisms must be applied in order to obtain the media-type referenced by the Content-Type header
+ * field.
+ * Content-Encoding is primarily used to allow a document to be compressed without losing the identity of its
+ * underlying media type.
+ * <p class='bcode'>
+ * 	Content-Encoding  = "Content-Encoding" ":" 1#content-coding
+ * </p>
+ * <p>
+ * Content codings are defined in section 3.5. An example of its use is...
+ * <p class='bcode'>
+ * 	Content-Encoding: gzip
+ * </p>
+ * <p>
+ * The content-coding is a characteristic of the entity identified by the Request-URI.
+ * Typically, the entity-body is stored with this encoding and is only decoded before rendering or analogous usage.
+ * However, a non-transparent proxy MAY modify the content-coding if the new coding is known to be acceptable to the
+ * recipient, unless the "no-transform" cache-control directive is present in the message.
+ * <p>
+ * If the content-coding of an entity is not "identity", then the response MUST include a Content-Encoding
+ * entity-header (section 14.11) that lists the non-identity content-coding(s) used.
+ * <p>
+ * If the content-coding of an entity in a request message is not acceptable to the origin server, the server SHOULD
+ * respond with a status code of 415 (Unsupported Media Type).
+ * <p>
+ * If multiple encodings have been applied to an entity, the content codings MUST be listed in the order in which they
+ * were applied.
+ * Additional information about the encoding parameters MAY be provided.
+ */
+public final class ContentEncoding extends HeaderEnum<ContentEncodingEnum> {
+
+	/**
+	 * Returns a parsed <code>Content-Encoding</code> header.
+	 *
+	 * @param value The <code>Content-Encoding</code> header string.
+	 * @return The parsed <code>Content-Encoding</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static ContentEncoding forString(String value) {
+		if (value == null)
+			return null;
+		return new ContentEncoding(value);
+	}
+
+	private ContentEncoding(String value) {
+		super(value, ContentEncodingEnum.class, ContentEncodingEnum.OTHER);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/ContentEncodingEnum.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/ContentEncodingEnum.java b/juneau-core/src/main/java/org/apache/juneau/http/ContentEncodingEnum.java
new file mode 100644
index 0000000..e44329a
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/ContentEncodingEnum.java
@@ -0,0 +1,34 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents the possible values for a <code>Content-Encoding</code> header.
+ */
+public enum ContentEncodingEnum {
+
+	/** Content-Encoding: gzip */
+	GZIP,
+
+	/** Content-Encoding: compress */
+	COMPRESS,
+
+	/** Content-Encoding: deflate */
+	DEFLATE,
+
+	/** Content-Encoding: identity */
+	IDENTITY,
+
+	/** Unknown value */
+	OTHER;
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/ContentLanguage.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/ContentLanguage.java b/juneau-core/src/main/java/org/apache/juneau/http/ContentLanguage.java
new file mode 100644
index 0000000..bfebcbe
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/ContentLanguage.java
@@ -0,0 +1,78 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Content-Language</l> HTTP response header.
+ * <p>
+ * The natural language or languages of the intended audience for the enclosed content.
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Content-Language: da
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Content-Language entity-header field describes the natural language(s) of the intended audience for the
+ * enclosed entity.
+ * Note that this might not be equivalent to all the languages used within the entity-body.
+ * <p class='bcode'>
+ * 	Content-Language  = "Content-Language" ":" 1#language-tag
+ * </p>
+ * <p>
+ * Language tags are defined in section 3.10.
+ * The primary purpose of Content-Language is to allow a user to identify and differentiate entities according to the
+ * user's own preferred language.
+ * Thus, if the body content is intended only for a Danish-literate audience, the appropriate field is...
+ * <p class='bcode'>
+ * 	Content-Language: da
+ * </p>
+ * <p>
+ * If no Content-Language is specified, the default is that the content is intended for all language audiences.
+ * This might mean that the sender does not consider it to be specific to any natural language, or that the sender
+ * does not know for which language it is intended.
+ * <p>
+ * Multiple languages MAY be listed for content that is intended for multiple audiences.
+ * For example, a rendition of the "Treaty of Waitangi," presented simultaneously in the original Maori and English
+ * versions, would call for...
+ * <p class='bcode'>
+ * 	Content-Language: mi, en
+ * </p>
+ * <p>
+ * However, just because multiple languages are present within an entity does not mean that it is intended for
+ * multiple linguistic audiences.
+ * An example would be a beginner's language primer, such as "A First Lesson in Latin," which is clearly intended to
+ * be used by an English-literate audience.
+ * In this case, the Content-Language would properly only include "en".
+ * <p>
+ * Content-Language MAY be applied to any media type -- it is not limited to textual documents.
+ */
+public final class ContentLanguage extends HeaderStringArray {
+
+	/**
+	 * Returns a parsed <code>Content-Language</code> header.
+	 *
+	 * @param value The <code>Content-Language</code> header string.
+	 * @return The parsed <code>Content-Language</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static ContentLanguage forString(String value) {
+		if (value == null)
+			return null;
+		return new ContentLanguage(value);
+	}
+
+	private ContentLanguage(String value) {
+		super(value);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/fa4736b6/juneau-core/src/main/java/org/apache/juneau/http/ContentLength.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/http/ContentLength.java b/juneau-core/src/main/java/org/apache/juneau/http/ContentLength.java
new file mode 100644
index 0000000..9cb8959
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/http/ContentLength.java
@@ -0,0 +1,67 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                                                              *
+// *                                                                                                                         *
+// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+// *                                                                                                                         *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the License.                                              *
+// ***************************************************************************************************************************
+package org.apache.juneau.http;
+
+/**
+ * Represents a parsed <l>Content-Length</l> HTTP request/response header.
+ * <p>
+ * The length of the response body in octets (8-bit bytes).
+ *
+ * <h6 class='figure'>Example</h6>
+ * <p class='bcode'>
+ * 	Content-Length: 348
+ * </p>
+ *
+ * <h6 class='topic'>RFC2616 Specification</h6>
+ *
+ * The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to
+ * the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the
+ * request been a GET.
+ * <p class='bcode'>
+ * 	Content-Length    = "Content-Length" ":" 1*DIGIT
+ * </p>
+ * <p>
+ * An example is...
+ * <p class='bcode'>
+ * 	Content-Length: 3495
+ * </p>
+ * <p>
+ * Applications SHOULD use this field to indicate the transfer-length of the message-body, unless this is prohibited by
+ * the rules in section 4.4.
+ * <p>
+ * Any Content-Length greater than or equal to zero is a valid value.
+ * Section 4.4 describes how to determine the length of a message-body if a Content-Length is not given.
+ * <p>
+ * Note that the meaning of this field is significantly different from the corresponding definition in MIME, where it is
+ * an optional field used within the "message/external-body" content-type.
+ * In HTTP, it SHOULD be sent whenever the message's length can be determined prior to being transferred, unless this is
+ * prohibited by the rules in section 4.4.
+ */
+public final class ContentLength extends HeaderInteger {
+
+	/**
+	 * Returns a parsed <code>Content-Length</code> header.
+	 *
+	 * @param value The <code>Content-Length</code> header string.
+	 * @return The parsed <code>Content-Length</code> header, or <jk>null</jk> if the string was null.
+	 */
+	public static ContentLength forString(String value) {
+		if (value == null)
+			return null;
+		return new ContentLength(value);
+	}
+
+	private ContentLength(String value) {
+		super(value);
+	}
+}



Mime
View raw message