juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject [1/3] incubator-juneau git commit: New Accept/AcceptEncoding/ContentType classes.
Date Tue, 02 May 2017 01:11:46 GMT
Repository: incubator-juneau
Updated Branches:
  refs/heads/master 2ebf5ca86 -> c3609d051


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
index 43f5324..08cc539 100644
--- a/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
@@ -18,6 +18,7 @@ import java.lang.reflect.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.serializer.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java b/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
index f64b271..a1f00a0 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
@@ -21,6 +21,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.transform.*;
 import org.apache.juneau.transforms.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/parser/ParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/ParserBuilder.java b/juneau-core/src/main/java/org/apache/juneau/parser/ParserBuilder.java
index bb397dd..bdf3cf3 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/ParserBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/ParserBuilder.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.parser.ParserContext.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.json.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java b/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java
index 3dd0dc7..47cfc44 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java
@@ -16,7 +16,7 @@ import java.util.*;
 import java.util.concurrent.*;
 
 import org.apache.juneau.*;
-import org.apache.juneau.internal.*;
+import org.apache.juneau.http.*;
 
 /**
  * Represents a group of {@link Parser Parsers} that can be looked up by media type.
@@ -66,9 +66,12 @@ import org.apache.juneau.internal.*;
 public final class ParserGroup {
 
 	// Maps Content-Type headers to matches.
-	private final Map<String,ParserMatch> cache = new ConcurrentHashMap<String,ParserMatch>();
+	private final ConcurrentHashMap<String,ParserMatch> cache = new ConcurrentHashMap<String,ParserMatch>();
 
-	final Parser[] parsers;
+	private final MediaType[] mediaTypes;            // List of media types
+	private final List<MediaType> mediaTypesList;
+	private final Parser[] mediaTypeParsers;
+	private final List<Parser> parsers;
 	private final PropertyStore propertyStore;
 
 	/**
@@ -82,7 +85,20 @@ public final class ParserGroup {
 	 */
 	public ParserGroup(PropertyStore propertyStore, Parser[] parsers) {
 		this.propertyStore = PropertyStore.create(propertyStore);
-		this.parsers = ArrayUtils.reverse(parsers);
+		this.parsers = Collections.unmodifiableList(new ArrayList<Parser>(Arrays.asList(parsers)));
+
+		List<MediaType> lmt = new ArrayList<MediaType>();
+		List<Parser> l = new ArrayList<Parser>();
+		for (Parser p : parsers) {
+			for (MediaType m: p.getMediaTypes()) {
+				lmt.add(m);
+				l.add(p);
+			}
+		}
+
+		this.mediaTypes = lmt.toArray(new MediaType[lmt.size()]);
+		this.mediaTypesList = Collections.unmodifiableList(lmt);
+		this.mediaTypeParsers = l.toArray(new Parser[l.size()]);
 	}
 
 	/**
@@ -96,8 +112,15 @@ public final class ParserGroup {
 		if (pm != null)
 			return pm;
 
-		MediaType mt = MediaType.forString(contentTypeHeader);
-		return getParserMatch(mt);
+		ContentType ct = ContentType.forString(contentTypeHeader);
+		int match = ct.findMatch(mediaTypes);
+
+		if (match >= 0) {
+			pm = new ParserMatch(mediaTypes[match], mediaTypeParsers[match]);
+			cache.putIfAbsent(contentTypeHeader, pm);
+		}
+
+		return cache.get(contentTypeHeader);
 	}
 
 	/**
@@ -107,20 +130,7 @@ public final class ParserGroup {
 	 * @return The parser and media type that matched the media type, or <jk>null</jk> if no match was made.
 	 */
 	public ParserMatch getParserMatch(MediaType mediaType) {
-		ParserMatch pm = cache.get(mediaType.toString());
-		if (pm != null)
-			return pm;
-
-		for (Parser p : parsers) {
-			for (MediaType a2 : p.getMediaTypes()) {
-				if (mediaType.matches(a2)) {
-					pm = new ParserMatch(a2, p);
-					cache.put(mediaType.toString(), pm);
-					return pm;
-				}
-			}
-		}
-		return null;
+		return getParserMatch(mediaType.toString());
 	}
 
 	/**
@@ -150,15 +160,10 @@ public final class ParserGroup {
 	 * <p>
 	 * Entries are ordered in the same order as the parsers in the group.
 	 *
-	 * @return The list of media types.
+	 * @return An unmodifiable list of media types.
 	 */
 	public List<MediaType> getSupportedMediaTypes() {
-		List<MediaType> l = new ArrayList<MediaType>();
-		for (Parser p : parsers)
-			for (MediaType mt : p.getMediaTypes())
-				if (! l.contains(mt))
-					l.add(mt);
-		return l;
+		return mediaTypesList;
 	}
 
 	/**
@@ -172,12 +177,11 @@ public final class ParserGroup {
 	}
 
 	/**
-	 * Returns a copy of the parsers in this group.
-	 * This method returns a new array each time so is somewhat expensive.
+	 * Returns the parsers in this group.
 	 *
-	 * @return A new array containing the parsers in this group.
+	 * @return An unmodifiable list of parsers in this group.
 	 */
-	public Parser[] getParsers() {
-		return ArrayUtils.reverse(parsers);
+	public List<Parser> getParsers() {
+		return parsers;
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java b/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
index ac44c84..06383a9 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
@@ -13,11 +13,13 @@
 package org.apache.juneau.parser;
 
 import static org.apache.juneau.BeanContext.*;
+import static org.apache.juneau.internal.CollectionUtils.*;
 import static org.apache.juneau.parser.ParserContext.*;
 
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 
 /**
  * Builder class for creating instances of {@link ParserGroup}.
@@ -52,7 +54,8 @@ public class ParserGroupBuilder {
 	 * @param copyFrom The parser group that we're copying settings and parsers from.
 	 */
 	public ParserGroupBuilder(ParserGroup copyFrom) {
-		this.parsers = new ArrayList<Object>(Arrays.asList(copyFrom.parsers));
+		this.parsers = new ArrayList<Object>();
+		addReverse(parsers, copyFrom.getParsers());
 		this.propertyStore = copyFrom.createPropertyStore();
 	}
 
@@ -63,7 +66,7 @@ public class ParserGroupBuilder {
 	 * @return This object (for method chaining).
 	 */
 	public ParserGroupBuilder append(Class<?>...p) {
-		parsers.addAll(Arrays.asList(p));
+		addReverse(parsers, p);
 		return this;
 	}
 
@@ -74,7 +77,7 @@ public class ParserGroupBuilder {
 	 * @return This object (for method chaining).
 	 */
 	public ParserGroupBuilder append(Parser...p) {
-		parsers.addAll(Arrays.asList(p));
+		addReverse(parsers, p);
 		return this;
 	}
 
@@ -85,7 +88,7 @@ public class ParserGroupBuilder {
 	 * @return This object (for method chaining).
 	 */
 	public ParserGroupBuilder append(List<Parser> p) {
-		parsers.addAll(p);
+		addReverse(parsers, p);
 		return this;
 	}
 
@@ -117,6 +120,7 @@ public class ParserGroupBuilder {
 				throw new RuntimeException("Could not instantiate parser " + c.getName(), e);
 			}
 		}
+		Collections.reverse(l);
 		return new ParserGroup(propertyStore, l.toArray(new Parser[l.size()]));
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/parser/ParserMatch.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/ParserMatch.java b/juneau-core/src/main/java/org/apache/juneau/parser/ParserMatch.java
index a08c07a..64a8aec 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/ParserMatch.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/ParserMatch.java
@@ -12,7 +12,7 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.parser;
 
-import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 
 /**
  * Represents a parser and media type that matches an HTTP <code>Content-Type</code> header value.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/parser/ParserSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/ParserSession.java b/juneau-core/src/main/java/org/apache/juneau/parser/ParserSession.java
index ea20042..5704dce 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/ParserSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/ParserSession.java
@@ -20,6 +20,7 @@ import java.nio.charset.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java b/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
index 1006307..922b8b5 100644
--- a/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
@@ -42,7 +42,7 @@ import org.apache.juneau.transform.*;
  * </ul>
  */
 @Consumes("text/plain")
-public final class PlainTextParser extends ReaderParser {
+public class PlainTextParser extends ReaderParser {
 
 	/** Default parser, all default settings.*/
 	public static final PlainTextParser DEFAULT = new PlainTextParser(PropertyStore.create());

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java b/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java
index febd91f..bb60f4c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java
@@ -15,6 +15,7 @@ package org.apache.juneau.plaintext;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.parser.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java b/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
index b49380f..6c0bd31 100644
--- a/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
@@ -41,7 +41,7 @@ import org.apache.juneau.transform.*;
  * </ul>
  */
 @Produces("text/plain")
-public final class PlainTextSerializer extends WriterSerializer {
+public class PlainTextSerializer extends WriterSerializer {
 
 	/** Default serializer, all default settings.*/
 	public static final PlainTextSerializer DEFAULT = new PlainTextSerializer(PropertyStore.create());

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java
index d56aee6..c91c1ba 100644
--- a/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java
@@ -15,6 +15,7 @@ package org.apache.juneau.plaintext;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.serializer.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java b/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java
index c92a861..a323caa 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java
@@ -19,6 +19,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.soap.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
index 32bf3d3..fe9858b 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
@@ -18,6 +18,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 
 /**
  * Builder class for building instances of serializers.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java
index 33fad70..9d0ffee 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java
@@ -16,7 +16,7 @@ import java.util.*;
 import java.util.concurrent.*;
 
 import org.apache.juneau.*;
-import org.apache.juneau.internal.*;
+import org.apache.juneau.http.*;
 
 /**
  * Represents a group of {@link Serializer Serializers} that can be looked up by media type.
@@ -61,9 +61,12 @@ import org.apache.juneau.internal.*;
 public final class SerializerGroup {
 
 	// Maps Accept headers to matching serializers.
-	private final Map<String,SerializerMatch> cache = new ConcurrentHashMap<String,SerializerMatch>();
+	private final ConcurrentHashMap<String,SerializerMatch> cache = new ConcurrentHashMap<String,SerializerMatch>();
 
-	final Serializer[] serializers;
+	private final MediaType[] mediaTypes;
+	private final List<MediaType> mediaTypesList;
+	private final Serializer[] mediaTypeSerializers;
+	private final List<Serializer> serializers;
 	private final PropertyStore propertyStore;
 
 	/**
@@ -77,7 +80,20 @@ public final class SerializerGroup {
 	 */
 	public SerializerGroup(PropertyStore propertyStore, Serializer[] serializers) {
 		this.propertyStore = PropertyStore.create(propertyStore);
-		this.serializers = ArrayUtils.reverse(serializers);
+		this.serializers = Collections.unmodifiableList(new ArrayList<Serializer>(Arrays.asList(serializers)));
+
+		List<MediaType> lmt = new ArrayList<MediaType>();
+		List<Serializer> l = new ArrayList<Serializer>();
+		for (Serializer s : serializers) {
+			for (MediaType m: s.getMediaTypes()) {
+				lmt.add(m);
+				l.add(s);
+			}
+		}
+
+		this.mediaTypes = lmt.toArray(new MediaType[lmt.size()]);
+		this.mediaTypesList = Collections.unmodifiableList(lmt);
+		this.mediaTypeSerializers = l.toArray(new Serializer[l.size()]);
 	}
 
 	/**
@@ -116,30 +132,14 @@ public final class SerializerGroup {
 		if (sm != null)
 			return sm;
 
-		MediaRange[] mr = MediaRange.parse(acceptHeader);
-		if (mr.length == 0)
-			mr = MediaRange.parse("*/*");
-
-		Map<Float,SerializerMatch> m = null;
-
-		for (MediaRange a : mr) {
-			for (Serializer s : serializers) {
-				for (MediaType a2 : s.getMediaTypes()) {
-					float q = a.matches(a2);
-					if (q == 1) {
-						sm = new SerializerMatch(a2, s);
-						cache.put(acceptHeader, sm);
-						return sm;
-					} else if (q > 0) {
-						if (m == null)
-							m = new TreeMap<Float,SerializerMatch>(Collections.reverseOrder());
-						m.put(q, new SerializerMatch(a2, s));
-					}
-				}
-			}
+		Accept a = Accept.forString(acceptHeader);
+		int match = a.findMatch(mediaTypes);
+		if (match >= 0) {
+			sm = new SerializerMatch(mediaTypes[match], mediaTypeSerializers[match]);
+			cache.putIfAbsent(acceptHeader, sm);
 		}
 
-		return (m == null ? null : m.values().iterator().next());
+		return cache.get(acceptHeader);
 	}
 
 	/**
@@ -180,15 +180,10 @@ public final class SerializerGroup {
 	 * <p>
 	 * Entries are ordered in the same order as the serializers in the group.
 	 *
-	 * @return The list of media types.
+	 * @return An unmodifiable list of media types.
 	 */
 	public List<MediaType> getSupportedMediaTypes() {
-		List<MediaType> l = new ArrayList<MediaType>();
-		for (Serializer s : serializers)
-			for (MediaType mt : s.getMediaTypes())
-				if (! l.contains(mt))
-					l.add(mt);
-		return l;
+		return mediaTypesList;
 	}
 
 	/**
@@ -203,11 +198,10 @@ public final class SerializerGroup {
 
 	/**
 	 * Returns a copy of the serializers in this group.
-	 * This method returns a new array each time so is somewhat expensive.
 	 *
-	 * @return A new array containing the serializers in this group.
+	 * @return An unmodifiable list of serializers in this group.
 	 */
-	public Serializer[] getSerializers() {
-		return ArrayUtils.reverse(serializers);
+	public List<Serializer> getSerializers() {
+		return serializers;
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
index 7c572d2..a4fe6e7 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
@@ -14,10 +14,12 @@ package org.apache.juneau.serializer;
 
 import static org.apache.juneau.BeanContext.*;
 import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.internal.CollectionUtils.*;
 
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 
 /**
  * Builder class for creating instances of {@link SerializerGroup}.
@@ -52,7 +54,8 @@ public class SerializerGroupBuilder {
 	 * @param copyFrom The serializer group that we're copying settings and serializers from.
 	 */
 	public SerializerGroupBuilder(SerializerGroup copyFrom) {
-		this.serializers = new ArrayList<Object>(Arrays.asList(copyFrom.serializers));
+		this.serializers = new ArrayList<Object>();
+		addReverse(serializers, copyFrom.getSerializers());
 		this.propertyStore = copyFrom.createPropertyStore();
 	}
 
@@ -63,7 +66,7 @@ public class SerializerGroupBuilder {
 	 * @return This object (for method chaining).
 	 */
 	public SerializerGroupBuilder append(Class<?>...s) {
-		serializers.addAll(Arrays.asList(s));
+		addReverse(serializers, s);
 		return this;
 	}
 
@@ -74,7 +77,7 @@ public class SerializerGroupBuilder {
 	 * @return This object (for method chaining).
 	 */
 	public SerializerGroupBuilder append(Serializer...s) {
-		serializers.addAll(Arrays.asList(s));
+		addReverse(serializers, s);
 		return this;
 	}
 
@@ -85,7 +88,7 @@ public class SerializerGroupBuilder {
 	 * @return This object (for method chaining).
 	 */
 	public SerializerGroupBuilder append(List<Serializer> s) {
-		serializers.addAll(s);
+		addReverse(serializers, s);
 		return this;
 	}
 
@@ -117,6 +120,7 @@ public class SerializerGroupBuilder {
 				throw new RuntimeException("Could not instantiate serializer " + c.getName(), e);
 			}
 		}
+		Collections.reverse(l);
 		return new SerializerGroup(propertyStore, l.toArray(new Serializer[l.size()]));
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerMatch.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerMatch.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerMatch.java
index 05e6a7a..19536eb 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerMatch.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerMatch.java
@@ -12,7 +12,7 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.serializer;
 
-import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 
 /**
  * Represents a serializer and media type that matches an HTTP <code>Accept</code> header value.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java
index 498113b..8164c3c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java
@@ -20,6 +20,7 @@ import java.lang.reflect.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.transform.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java b/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java
index 9a5c79e..21d5f9c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java
@@ -18,6 +18,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.utils.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
index 5cbbac9..7436ddc 100644
--- a/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.soap.SoapXmlSerializerContext.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.xml.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java
index b53f5b7..c852379 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonParser.java
@@ -19,6 +19,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.parser.*;
 import org.apache.juneau.transform.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
index 694a97e..ef29a73 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.uon.UonParserContext.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.parser.*;
 import org.apache.juneau.urlencoding.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java
index bf2334b..a5ba78d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonParserSession.java
@@ -19,6 +19,7 @@ import java.lang.reflect.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.parser.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java
index aef3f64..16317d6 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializer.java
@@ -20,6 +20,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.transform.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
index ae6c748..2106637 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.uon.UonSerializerContext.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.urlencoding.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
index 742d0da..1e3b68c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
@@ -19,6 +19,7 @@ import java.lang.reflect.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.serializer.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
index f20b590..119c9c1 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
@@ -19,6 +19,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.parser.*;
 import org.apache.juneau.transform.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
index b9ec130..07c4a71 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.uon.UonParserContext.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.uon.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
index 44bfc4b..a31768c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
@@ -17,6 +17,7 @@ import java.lang.reflect.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.uon.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
index eb7ef87..a93ca54 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
@@ -22,6 +22,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.transform.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
index 7f8b00a..e795a48 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
@@ -15,6 +15,7 @@ package org.apache.juneau.urlencoding;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.uon.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
index 3f3c47e..1802dc2 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
@@ -16,6 +16,7 @@ import java.lang.reflect.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.uon.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/utils/StringMessage.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/StringMessage.java b/juneau-core/src/main/java/org/apache/juneau/utils/StringMessage.java
index f7403f1..72e3d1e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/StringMessage.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/StringMessage.java
@@ -16,6 +16,7 @@ import java.io.*;
 import java.text.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 
 /**
  * An encapsulated MessageFormat-style string and arguments.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/utils/StringObject.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/StringObject.java b/juneau-core/src/main/java/org/apache/juneau/utils/StringObject.java
index 04b7c99..169d20e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/StringObject.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/StringObject.java
@@ -15,6 +15,7 @@ package org.apache.juneau.utils;
 import java.io.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.serializer.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
index 7830163..5213c9c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
@@ -23,6 +23,7 @@ import javax.xml.stream.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.parser.*;
 import org.apache.juneau.transform.*;
 import org.apache.juneau.xml.annotation.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
index 6074bb3..2f48757 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
@@ -20,6 +20,7 @@ import javax.xml.stream.*;
 import javax.xml.stream.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.parser.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserSession.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserSession.java
index 0cb6aba..ff216bd 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParserSession.java
@@ -23,6 +23,7 @@ import javax.xml.stream.*;
 import javax.xml.stream.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.parser.*;
 import org.apache.juneau.xml.annotation.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
index 68031de..a84d41f 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
@@ -26,6 +26,7 @@ import javax.xml.validation.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.xml.annotation.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializerBuilder.java
index d22e1bd..4af4739 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializerBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializerBuilder.java
@@ -15,6 +15,7 @@ package org.apache.juneau.xml;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 
 /**
  * Builder class for building instances of XML Schema serializers.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
index ad04449..c16fcba 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
@@ -23,6 +23,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.transform.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
index 5203001..dfdef5a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.xml.XmlSerializerContext.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.serializer.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
index 723c492..36b481a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
@@ -20,6 +20,7 @@ import java.lang.reflect.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.serializer.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-core/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/overview.html b/juneau-core/src/main/javadoc/overview.html
index 8d2da27..6cfe84b 100644
--- a/juneau-core/src/main/javadoc/overview.html
+++ b/juneau-core/src/main/javadoc/overview.html
@@ -5736,7 +5736,8 @@
 	
 	<h5 class='toc'>What's new in each release</h5>
 	<ul class='toc'>
-		<li><p><a class='doclink' href='#6.2.0'>6.2.0 (TBD)</a></p>
+		<li><p><a class='doclink' href='#6.2.0'>6.2.1 (TBD)</a></p>
+		<li><p><a class='doclink' href='#6.2.0'>6.2.0 (Apr 28, 2017)</a></p>
 		<li><p><a class='doclink' href='#6.1.0'>6.1.0 (Feb 25, 2017)</a></p>
 		<li><p><a class='doclink' href='#6.0.1'>6.0.1 (Jan 3, 2017)</a></p>
 		<li><p><a class='doclink' href='#6.0.0'>6.0.0 (Oct 3, 2016)</a></p>
@@ -5804,8 +5805,50 @@
 
 
 	<!-- ======================================================================================================== -->
+	<a id="6.2.1"></a>
+	<h3 class='topic' onclick='toggle(this)'>6.2.1 (TBD)</h3>
+	<div class='topic'>
+		<p>
+		</p>
+
+		<h6 class='topic'>org.apache.juneau</h6>
+		<ul class='spaced-list'>
+			<li>New package:  {@link org.apache.juneau.http}.
+			<ul>
+				<li>{@link org.apache.juneau.http.Accept}
+				<li>{@link org.apache.juneau.http.AcceptEncoding}
+				<li>{@link org.apache.juneau.http.ContentType}
+			</ul>
+		</ul>
+
+		<h6 class='topic'>org.apache.juneau.rest</h6>
+		<ul class='spaced-list'>
+			<li>The following object types can now be specified as unannotated arguments on REST Java methods:
+			<ul>
+				<li>{@link org.apache.juneau.http.Accept}
+				<li>{@link org.apache.juneau.http.AcceptEncoding}
+				<li>{@link org.apache.juneau.http.ContentType}
+			</ul>
+			<li>New methods on {@link org.apache.juneau.rest.RestRequest}:
+			<ul>
+				<li>{@link org.apache.juneau.rest.RestRequest#getAcceptHeader() getAcceptHeader()}
+				<li>{@link org.apache.juneau.rest.RestRequest#getAcceptEncodingHeader() getAcceptEncodingHeader()}
+				<li>{@link org.apache.juneau.rest.RestRequest#getContentTypeHeader() getContentTypeHeader()}
+			</ul>
+		</ul>
+
+		<h6 class='topic'>org.apache.juneau.rest.client</h6>
+		<ul class='spaced-list'>
+		</ul>
+
+		<h6 class='topic'>org.apache.juneau.microservice</h6>
+		<ul class='spaced-list'>
+		</ul>
+	</div>
+
+	<!-- ======================================================================================================== -->
 	<a id="6.2.0"></a>
-	<h3 class='topic' onclick='toggle(this)'>6.2.0 (TBD)</h3>
+	<h3 class='topic' onclick='toggle(this)'>6.2.0 (Apr 28, 2017)</h3>
 	<div class='topic'>
 		<p>
 			Juneau 6.2.0 is a major update.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
index e3ffcc8..c12b2c7 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
@@ -41,6 +41,7 @@ import org.apache.http.impl.client.*;
 import org.apache.http.impl.conn.*;
 import org.apache.http.protocol.*;
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.parser.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java
----------------------------------------------------------------------
diff --git a/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java b/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java
index fed973b..645155b 100644
--- a/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java
+++ b/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java
@@ -25,6 +25,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.ext.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.parser.*;
 import org.apache.juneau.rest.annotation.*;
@@ -165,7 +166,7 @@ public class BaseProvider implements MessageBodyReader<Object>, MessageBodyWrite
 		if (headers.containsKey("Accept-Language") && headers.get("Accept-Language") != null) {
 			String h = String.valueOf(headers.get("Accept-Language"));
 			if (h != null) {
-				MediaRange[] mr = MediaRange.parse(h);
+				MediaTypeRange[] mr = MediaTypeRange.parse(h);
 				if (mr.length > 0)
 					return toLocale(mr[0].getMediaType().getType());
 			}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/HeadersResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/HeadersResource.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/HeadersResource.java
new file mode 100644
index 0000000..e5a6265
--- /dev/null
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/HeadersResource.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.rest.test;
+
+import org.apache.juneau.*;
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.encoders.*;
+import org.apache.juneau.http.*;
+import org.apache.juneau.plaintext.*;
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.annotation.*;
+
+/**
+ * JUnit automated testcase resource.
+ */
+@RestResource(
+	path="/testHeaders",
+	serializers=HeadersResource.PlainTextAnythingSerializer.class,
+	parsers=HeadersResource.PlainTextAnythingParser.class,
+	encoders=HeadersResource.IdentityAnythingEncoder.class
+)
+public class HeadersResource extends RestServletDefault {
+	private static final long serialVersionUID = 1L;
+
+	//====================================================================================================
+	// Basic tests
+	//====================================================================================================
+	@RestMethod(name="GET", path="/accept")
+	public String accept(Accept accept) {
+		return accept.toString();
+	}
+
+	@RestMethod(name="GET", path="/acceptEncoding")
+	public String acceptEncoding(AcceptEncoding acceptEncoding) {
+		System.err.println(acceptEncoding);
+		return acceptEncoding.toString();
+	}
+
+	@RestMethod(name="GET", path="/contentType")
+	public String contentType(ContentType contentType) {
+		return contentType.toString();
+	}
+
+	@Produces("*/*")
+	public static class PlainTextAnythingSerializer extends PlainTextSerializer {
+		public PlainTextAnythingSerializer(PropertyStore propertyStore) {
+			super(propertyStore);
+		}
+	}
+
+	@Consumes("*/*")
+	public static class PlainTextAnythingParser extends PlainTextParser {
+		public PlainTextAnythingParser(PropertyStore propertyStore) {
+			super(propertyStore);
+		}
+	}
+
+	public static class IdentityAnythingEncoder extends IdentityEncoder {
+		@Override /* Encoder */
+		public String[] getCodings() {
+			return new String[]{"*"};
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java
index 34a18eb..f6846eb 100644
--- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java
@@ -35,6 +35,7 @@ import org.apache.juneau.rest.labels.*;
 		GroupsResource.class,
 		GzipResource.TestGzipOff.class,
 		GzipResource.TestGzipOn.class,
+		HeadersResource.class,
 		HtmlPropertiesResource.class,
 		InheritanceResource.TestEncoders.class,
 		InheritanceResource.TestTransforms.class,

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java
index 6ce05c3..26e0a05 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java
@@ -234,10 +234,6 @@ public class GzipTest extends RestTestcase {
 		r = c.doGet(url).acceptEncoding("mycoding;q=0.8,*;q=0.6");
 		assertEquals("foo", decompress(r.getInputStream()));
 
-		// Should match identity
-		r = c.doGet(url).acceptEncoding("*;q=0.8,myencoding;q=0.6");
-		assertEquals("foo", r.getResponseAsString());
-
 		// Shouldn't match
 		try {
 			c.doGet(url+"?noTrace=true").acceptEncoding("identity;q=0").connect();

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/HeadersTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/HeadersTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/HeadersTest.java
new file mode 100644
index 0000000..1a96e47
--- /dev/null
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/HeadersTest.java
@@ -0,0 +1,56 @@
+// ***************************************************************************************************************************
+// * 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.rest.test;
+
+import static org.junit.Assert.*;
+
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+public class HeadersTest extends RestTestcase {
+
+	private static String URL = "/testHeaders";
+
+	//====================================================================================================
+	// Basic tests
+	//====================================================================================================
+
+	@Test
+	public void testAccept() throws Exception {
+		RestClient client = TestMicroservice.DEFAULT_CLIENT;
+
+		assertEquals("text/foo", client.doGet(URL + "/accept").accept("text/foo").getResponseAsString());
+		assertEquals("text/foo+bar", client.doGet(URL + "/accept").accept("text/foo+bar").getResponseAsString());
+		assertEquals("text/*", client.doGet(URL + "/accept").accept("text/*").getResponseAsString());
+		assertEquals("*/foo", client.doGet(URL + "/accept").accept("*/foo").getResponseAsString());
+
+		assertEquals("text/foo", client.doGet(URL + "/accept").accept("text/foo;q=1.0").getResponseAsString());
+		assertEquals("text/foo;q=0.9", client.doGet(URL + "/accept").accept("text/foo;q=0.9").getResponseAsString());
+		assertEquals("text/foo;x=X;q=0.9;y=Y", client.doGet(URL + "/accept").accept("text/foo;x=X;q=0.9;y=Y").getResponseAsString());
+	}
+
+	@Test
+	public void testAcceptEncoding() throws Exception {
+		RestClient client = TestMicroservice.DEFAULT_CLIENT;
+
+		assertEquals("foo", client.doGet(URL + "/acceptEncoding").accept("text/plain").acceptEncoding("foo").getResponseAsString());
+		assertEquals("*", client.doGet(URL + "/acceptEncoding").accept("text/plain").acceptEncoding("*").getResponseAsString());
+	}
+
+	@Test
+	public void testContentType() throws Exception {
+		RestClient client = TestMicroservice.DEFAULT_CLIENT;
+
+		assertEquals("text/foo", client.doGet(URL + "/contentType").accept("text/plain").contentType("text/foo").getResponseAsString());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ParsersTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ParsersTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ParsersTest.java
index 21e07a1..95482a4 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ParsersTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ParsersTest.java
@@ -108,7 +108,7 @@ public class ParsersTest extends RestTestcase {
 		String url = URL + "/testParserWithDifferentMediaTypes";
 
 		String r = client.doPut(url, "test4").contentType("text/a").getResponseAsString();
-		assertEquals("text/d - test4", r);
+		assertEquals("text/a - test4", r);
 
 		r = client.doPut(url, "test4").contentType("text/d").getResponseAsString();
 		assertEquals("text/d - test4", r);

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/CallMethod.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/CallMethod.java b/juneau-rest/src/main/java/org/apache/juneau/rest/CallMethod.java
index c26e53c..6fb9a08 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/CallMethod.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/CallMethod.java
@@ -32,6 +32,7 @@ import org.apache.juneau.*;
 import org.apache.juneau.dto.swagger.*;
 import org.apache.juneau.encoders.*;
 import org.apache.juneau.html.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.parser.*;
@@ -327,6 +328,12 @@ class CallMethod implements Comparable<CallMethod>  {
 				_paramType = REQ;
 			else if (isClass && isParentClass(HttpServletResponse.class, (Class<?>)type))
 				_paramType = RES;
+			else if (isClass && isParentClass(Accept.class, (Class<?>)type))
+				_paramType = ACCEPT;
+			else if (isClass && isParentClass(AcceptEncoding.class, (Class<?>)type))
+				_paramType = ACCEPTENCODING;
+			else if (isClass && isParentClass(ContentType.class, (Class<?>)type))
+				_paramType = CONTENTTYPE;
 			else for (Annotation a : annotations) {
 				if (a instanceof Path) {
 					Path a2 = (Path)a;
@@ -441,18 +448,24 @@ class CallMethod implements Comparable<CallMethod>  {
 				case PATHREMAINDER: return req.getPathRemainder();
 				case PROPS:         return res.getProperties();
 				case MESSAGES:      return req.getResourceBundle();
+				case ACCEPT:        return req.getAcceptHeader();
+				case ACCEPTENCODING:return req.getAcceptEncodingHeader();
+				case CONTENTTYPE:   return req.getContentTypeHeader();
 				default:            return null;
 			}
 		}
 	}
 
 	static enum ParamType {
-		REQ, RES, PATH, BODY, HEADER, METHOD, FORMDATA, QUERY, HASFORMDATA, HASQUERY, PATHREMAINDER, PROPS, MESSAGES;
+		REQ, RES, PATH, BODY, HEADER, METHOD, FORMDATA, QUERY, HASFORMDATA, HASQUERY, PATHREMAINDER, PROPS, MESSAGES, ACCEPT, ACCEPTENCODING, CONTENTTYPE;
 
 		private String getSwaggerParameterType() {
 			switch(this) {
 				case PATH: return "path";
-				case HEADER: return "header";
+				case HEADER:
+				case ACCEPT:
+				case ACCEPTENCODING:
+				case CONTENTTYPE: return "header";
 				case FORMDATA: return "formData";
 				case QUERY: return "query";
 				case BODY: return "body";

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/ReaderResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/ReaderResource.java b/juneau-rest/src/main/java/org/apache/juneau/rest/ReaderResource.java
index 7556006..e4da074 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/ReaderResource.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/ReaderResource.java
@@ -16,6 +16,7 @@ import java.io.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.rest.annotation.*;
 import org.apache.juneau.rest.response.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/RestConfig.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestConfig.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestConfig.java
index 0197cbc..2a33a34 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestConfig.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestConfig.java
@@ -25,6 +25,7 @@ import javax.servlet.http.*;
 import org.apache.juneau.*;
 import org.apache.juneau.encoders.*;
 import org.apache.juneau.encoders.Encoder;
+import org.apache.juneau.http.*;
 import org.apache.juneau.ini.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.parser.*;
@@ -172,9 +173,9 @@ public class RestConfig implements ServletConfig {
 				RestResource r = e.getValue();
 				for (Property p : r.properties())
 					properties.append(vr.resolve(p.name()), vr.resolve(p.value()));
-				addSerializers(reverse(r.serializers()));  // TODO - why reverse?
-				addParsers(reverse(r.parsers()));  // TODO - why reverse?
-				addEncoders(reverse(r.encoders()));  // TODO - why reverse?
+				addSerializers(r.serializers());
+				addParsers(r.parsers());
+				addEncoders(r.encoders());
 				addDefaultRequestHeaders(r.defaultRequestHeaders());
 				addDefaultResponseHeaders(r.defaultResponseHeaders());
 				addResponseHandlers(r.responseHandlers());

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java
index 65d447e..97ab2d4 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -27,6 +27,7 @@ import javax.servlet.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.encoders.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.ini.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.json.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/RestInfoProvider.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestInfoProvider.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestInfoProvider.java
index e43f514..84f5f9f 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestInfoProvider.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestInfoProvider.java
@@ -18,8 +18,8 @@ import static org.apache.juneau.dto.swagger.SwaggerBuilder.*;
 import java.util.*;
 import java.util.concurrent.*;
 
-import org.apache.juneau.*;
 import org.apache.juneau.dto.swagger.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.parser.*;

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java
index 86d2db7..c35e0bd 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java
@@ -32,6 +32,7 @@ import org.apache.juneau.*;
 import org.apache.juneau.dto.swagger.*;
 import org.apache.juneau.encoders.*;
 import org.apache.juneau.encoders.Encoder;
+import org.apache.juneau.http.*;
 import org.apache.juneau.ini.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.parser.*;
@@ -352,25 +353,30 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	}
 
 	/**
-	 * Returns the <code>Content-Type</code> header value on the request, stripped
-	 * 	of any parameters such as <js>";charset=X"</js>.
-	 * <p>
-	 * Example: <js>"text/json"</js>.
-	 * <p>
-	 * If the content type is not specified, and the content is specified via a
-	 * 	<code>&amp;body</code> query parameter, the content type is assumed to be
-	 * 	<js>"text/uon"</js>.  Otherwise, the content type is assumed to be <js>"text/json"</js>.
+	 * Returns the <code>Accept</code> header on the request.
 	 *
-	 * @return The <code>Content-Type</code> media-type header value on the request.
+	 * @return The parsed <code>Accept</code> header on the request, or <jk>null</jk> if not found.
 	 */
-	public MediaType getMediaType() {
-		String cm = getHeader("Content-Type");
-		if (cm == null) {
-			if (body != null)
-				return MediaType.UON;
-			return MediaType.JSON;
-		}
-		return MediaType.forString(cm);
+	public Accept getAcceptHeader() {
+		return getHeader("Accept", Accept.class);
+	}
+
+	/**
+	 * Returns the <code>Content-Type</code> header on the request.
+	 *
+	 * @return The parsed <code>Content-Type</code> header on the request, or <jk>null</jk> if not found.
+	 */
+	public ContentType getContentTypeHeader() {
+		return getHeader("Content-Type", ContentType.class);
+	}
+
+	/**
+	 * Returns the <code>Accept-Encoding</code> header on the request.
+	 *
+	 * @return The parsed <code>Accept-Encoding</code> header on the request, or <jk>null</jk> if not found.
+	 */
+	public AcceptEncoding getAcceptEncodingHeader() {
+		return getHeader("Accept-Encoding", AcceptEncoding.class);
 	}
 
 	/**
@@ -431,7 +437,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	public Locale getLocale() {
 		String h = getOverriddenHeader("Accept-Language");
 		if (h != null) {
-			MediaRange[] mr = MediaRange.parse(h);
+			MediaTypeRange[] mr = MediaTypeRange.parse(h);
 			if (mr.length > 0)
 				return toLocale(mr[0].getMediaType().getType());
 		}
@@ -442,10 +448,10 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	public Enumeration<Locale> getLocales() {
 		String h = getOverriddenHeader("Accept-Language");
 		if (h != null) {
-			MediaRange[] mr = MediaRange.parse(h);
+			MediaTypeRange[] mr = MediaTypeRange.parse(h);
 			if (mr.length > 0) {
 				List<Locale> l = new ArrayList<Locale>(mr.length);
-				for (MediaRange r : mr)
+				for (MediaTypeRange r : mr)
 					l.add(toLocale(r.getMediaType().getType()));
 				return enumeration(l);
 			}
@@ -1726,7 +1732,13 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	 * Includes the matching media type.
 	 */
 	public ParserMatch getParserMatch() {
-		MediaType mediaType = getMediaType();
+		MediaType mediaType = getContentTypeHeader();
+		if (mediaType == null) {
+			if (body != null)
+				mediaType = MediaType.UON;
+			else
+				mediaType = MediaType.JSON;
+		}
 		ParserMatch pm = parserGroup.getParserMatch(mediaType);
 
 		// If no patching parser for URL-encoding, use the one defined on the servlet.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java
index 00ac554..2bde785 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestResponse.java
@@ -22,6 +22,7 @@ import javax.servlet.http.*;
 import org.apache.juneau.*;
 import org.apache.juneau.encoders.*;
 import org.apache.juneau.html.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.jena.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.rest.annotation.*;
@@ -99,7 +100,7 @@ public final class RestResponse extends HttpServletResponseWrapper {
 		String charset = null;
 		if (h == null)
 			charset = defaultCharset;
-		else for (MediaRange r : MediaRange.parse(h)) {
+		else for (MediaTypeRange r : MediaTypeRange.parse(h)) {
 			if (r.getQValue() > 0) {
 				MediaType mt = r.getMediaType();
 				if (mt.getType().equals("*"))

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/StreamResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/StreamResource.java b/juneau-rest/src/main/java/org/apache/juneau/rest/StreamResource.java
index dbd5076..53e186c 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/StreamResource.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/StreamResource.java
@@ -16,6 +16,7 @@ import java.io.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.rest.response.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/package.html
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/package.html b/juneau-rest/src/main/java/org/apache/juneau/rest/package.html
index bfc3aa3..8451144 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/package.html
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/package.html
@@ -577,34 +577,30 @@
 			The method can contain any of the following parameters in any order:
 		</p>
 		<ul class='spaced-list'>
-			<li>Parameter of type {@link org.apache.juneau.rest.RestRequest}
-			<li>Parameter of type {@link javax.servlet.http.HttpServletRequest}
-			<li>Parameter of type {@link org.apache.juneau.rest.RestResponse}
-			<li>Parameter of type {@link javax.servlet.http.HttpServletResponse}
-			<li>Parameters annotated with {@link org.apache.juneau.rest.annotation.Path @Path}
-				<br>These match variables in matched URL path patterns.
-			<li>Parameters annotated with with {@link org.apache.juneau.rest.annotation.FormData @FormData}
-				<br>These denote multipart form post parameter values.
-			<li>Parameters annotated with {@link org.apache.juneau.rest.annotation.HasFormData @HasFormData}
-				<br>Similar to <ja>@FormData</ja>, but resolves to a simple boolean <jk>true/false</jk> denoting whether the form data parameter exists.
-			<li>Parameters annotated with {@link org.apache.juneau.rest.annotation.Query @Query} 
-				<br>These denote query parameters.
-				<br>Using this prevents the HTTP body from being processed as a URL-Encoded form post.
-			<li>Parameters annotated with {@link org.apache.juneau.rest.annotation.HasQuery @HasQuery}
-				<br>Similar to <ja>@Query</ja>, but resolves to a simple boolean <jk>true/false</jk> denoting whether the query parameter exists.
-			<li>Parameters annotated with {@link org.apache.juneau.rest.annotation.Header @Header}
-				<br>These denote header values.
-			<li>Parameter annotated with {@link org.apache.juneau.rest.annotation.Method @Method} 
-				<br>This denotes the HTTP method name.
-			<li>Parameter annotated with {@link org.apache.juneau.rest.annotation.PathRemainder @PathRemainder}
-				<br>This denotes the path remainder value after path pattern match.
-			<li>Parameter annotated with {@link org.apache.juneau.rest.annotation.Body @Body} 
-				<br>This denotes the HTTP content parsed as a POJO.
-				<br>The type can be any parsable POJO type as defined in <a class='doclink' href='../../../../overview-summary.html#Core.PojoCategories'>POJO Categories</a>
-			<li>Parameter annotated with {@link org.apache.juneau.rest.annotation.Messages @Messages} 
-				<br>This gives you access to the resource bundle for the servlet localized to the language on the request.
-			<li>Parameter annotated with {@link org.apache.juneau.rest.annotation.Properties @Properties} 
-				<br>This gives you access to the serializer/parser/servlet properties so they can be read or altered on the request.
+			<li>Parameters of the following class types:
+				<ul>
+					<li>{@link org.apache.juneau.rest.RestRequest} - The request object.
+					<li>{@link javax.servlet.http.HttpServletRequest} - The superclass of <code>RestRequest</code>.
+					<li>{@link org.apache.juneau.rest.RestResponse} - The response object.
+					<li>{@link javax.servlet.http.HttpServletResponse} - The superclass of <code>RestResponse</code>.
+					<li>{@link org.apache.juneau.http.Accept} - The parsed <code>Accept</code> header.
+					<li>{@link org.apache.juneau.http.AcceptEncoding} - The parsed <code>Accept-Encoding</code> header.
+					<li>{@link org.apache.juneau.http.ContentType} - The parsed <code>Content-Type</code> header.
+				</ul>
+			<li>Annotated parameters:
+				<ul>
+					<li>{@link org.apache.juneau.rest.annotation.Path @Path} - Variables in matched URL path patterns.
+					<li>{@link org.apache.juneau.rest.annotation.FormData @FormData} - Multipart form post parameter values.
+					<li>{@link org.apache.juneau.rest.annotation.HasFormData @HasFormData} - Denotes whether the form data parameter exists.
+					<li>{@link org.apache.juneau.rest.annotation.Query @Query} - Query parameters.  Using this prevents the HTTP body from being processed as a URL-Encoded form post.
+					<li>{@link org.apache.juneau.rest.annotation.HasQuery @HasQuery} - Denotes whether the query parameter exists.
+					<li>{@link org.apache.juneau.rest.annotation.Header @Header} - A header value.
+					<li>{@link org.apache.juneau.rest.annotation.Method @Method} - The HTTP method name. 
+					<li>{@link org.apache.juneau.rest.annotation.PathRemainder @PathRemainder} - The remainder value after path pattern match.
+					<li>{@link org.apache.juneau.rest.annotation.Body @Body} - The HTTP content parsed as a POJO.
+					<li>{@link org.apache.juneau.rest.annotation.Messages @Messages} - The resource bundle for the servlet localized to the language on the request.
+					<li>{@link org.apache.juneau.rest.annotation.Properties @Properties} - The serializer/parser/servlet properties so they can be read or altered on the request.
+				</ul>
 		</ul>
 		<p class='bcode'>
 	<jc>// Example GET request using annotated attributes</jc>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java b/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
index 55f3c8d..795f521 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
@@ -101,7 +101,7 @@ public abstract class RemoteableServlet extends RestServletDefault {
 		// Find the parser.
 		ReaderParser p = req.getReaderParser();
 		if (p == null)
-			throw new RestException(SC_UNSUPPORTED_MEDIA_TYPE, "Could not find parser for media type ''{0}''", req.getMediaType()); //$NON-NLS-1$
+			throw new RestException(SC_UNSUPPORTED_MEDIA_TYPE, "Could not find parser for media type ''{0}''", req.getContentTypeHeader()); //$NON-NLS-1$
 		Class<?> c = getInterfaceClass(javaInterface);
 
 		// Find the service.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java b/juneau-rest/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java
index f7f6df3..190ea44 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/response/DefaultHandler.java
@@ -18,6 +18,7 @@ import java.io.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.rest.*;
 import org.apache.juneau.serializer.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/response/StreamableHandler.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/response/StreamableHandler.java b/juneau-rest/src/main/java/org/apache/juneau/rest/response/StreamableHandler.java
index 8a2f107..4eed2fe 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/response/StreamableHandler.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/response/StreamableHandler.java
@@ -16,6 +16,7 @@ import java.io.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.rest.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/c3609d05/juneau-rest/src/main/java/org/apache/juneau/rest/response/WritableHandler.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/response/WritableHandler.java b/juneau-rest/src/main/java/org/apache/juneau/rest/response/WritableHandler.java
index b453d1f..927fb82 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/response/WritableHandler.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/response/WritableHandler.java
@@ -16,6 +16,7 @@ import java.io.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.http.*;
 import org.apache.juneau.rest.*;
 
 /**


Mime
View raw message