juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject juneau git commit: RestContext refactoring.
Date Fri, 05 Jan 2018 23:51:00 GMT
Repository: juneau
Updated Branches:
  refs/heads/master 779be8b4c -> 30ac20a16


RestContext refactoring.

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

Branch: refs/heads/master
Commit: 30ac20a1621322bf63b8cdfbffce9190d75e13f1
Parents: 779be8b
Author: JamesBognar <jamesbognar@apache.org>
Authored: Fri Jan 5 18:50:57 2018 -0500
Committer: JamesBognar <jamesbognar@apache.org>
Committed: Fri Jan 5 18:50:57 2018 -0500

----------------------------------------------------------------------
 .../org/apache/juneau/rest/RestContext.java     | 1297 +++++++++---------
 .../apache/juneau/rest/RestContextBuilder.java  |   26 +-
 2 files changed, 632 insertions(+), 691 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juneau/blob/30ac20a1/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index b270a97..bc2aa30 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -63,39 +63,6 @@ public final class RestContext extends BeanContext {
 	private static final String PREFIX = "RestContext.";
 	
 	/**
-	 * <b>Configuration property:</b>  Allow header URL parameters.
-	 *
-	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.allowHeaderParams.b"</js>
-	 * 	<li><b>Data type:</b> <code>Boolean</code>
-	 * 	<li><b>Default:</b> <jk>true</jk>
-	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
-	 * </ul>
-	 *
-	 * <p>
-	 * When enabled, headers such as <js>"Accept"</js> and <js>"Content-Type"</js> to be passed in as URL query
-	 * parameters.
-	 * <br>
-	 * For example:  <js>"?Accept=text/json&amp;Content-Type=text/json"</js>
-	 * 
-	 * <h5 class='section'>Notes:</h5>
-	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_allowHeaderParams}
-	 * 	<li>Annotations:  
-	 * 		<ul>
-	 * 			<li>{@link RestResource#allowHeaderParams()}
-	 * 		</ul>
-	 * 	<li>Methods:  
-	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#allowHeaderParams(boolean)}
-	 * 		</ul>
-	 * 	<li>Parameter name is case-insensitive.
-	 * 	<li>Useful for debugging REST interface using only a browser.
-	 *	</ul>
-	 */
-	public static final String REST_allowHeaderParams = PREFIX + "allowHeaderParams.b";
-	
-	/**
 	 * <b>Configuration property:</b>  Allow body URL parameter.
 	 *
 	 * <ul>
@@ -168,178 +135,174 @@ public final class RestContext extends BeanContext {
 	public static final String REST_allowedMethodParams = PREFIX + "allowedMethodParams.s";
 
 	/**
-	 * <b>Configuration property:</b>  Render response stack traces in responses.
+	 * <b>Configuration property:</b>  Allow header URL parameters.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.renderResponseStackTraces.b"</js>
+	 * 	<li><b>Name:</b> <js>"RestContext.allowHeaderParams.b"</js>
 	 * 	<li><b>Data type:</b> <code>Boolean</code>
-	 * 	<li><b>Default:</b> <jk>false</jk>
+	 * 	<li><b>Default:</b> <jk>true</jk>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 *
 	 * <p>
-	 * Render stack traces in HTTP response bodies when errors occur.
-	 *
+	 * When enabled, headers such as <js>"Accept"</js> and <js>"Content-Type"</js> to be passed in as URL query
+	 * parameters.
+	 * <br>
+	 * For example:  <js>"?Accept=text/json&amp;Content-Type=text/json"</js>
+	 * 
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_renderResponseStackTraces}
+	 * 	<li>Property:  {@link RestContext#REST_allowHeaderParams}
 	 * 	<li>Annotations:  
 	 * 		<ul>
-	 * 			<li>{@link RestResource#renderResponseStackTraces()}
+	 * 			<li>{@link RestResource#allowHeaderParams()}
 	 * 		</ul>
 	 * 	<li>Methods:  
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#renderResponseStackTraces(boolean)}
+	 * 			<li>{@link RestContextBuilder#allowHeaderParams(boolean)}
 	 * 		</ul>
-	 * 	<li>Useful for debugging, although allowing stack traces to be rendered may cause security concerns so use
-	 * 		caution when enabling.
+	 * 	<li>Parameter name is case-insensitive.
+	 * 	<li>Useful for debugging REST interface using only a browser.
 	 *	</ul>
 	 */
-	public static final String REST_renderResponseStackTraces = PREFIX + "renderResponseStackTraces.b";
+	public static final String REST_allowHeaderParams = PREFIX + "allowHeaderParams.b";
 	
 	/**
-	 * <b>Configuration property:</b>  Use stack trace hashes.
+	 * <b>Configuration property:</b>  REST call handler.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.useStackTraceHashes.b"</js>
-	 * 	<li><b>Data type:</b> <code>Boolean</code>
-	 * 	<li><b>Default:</b> <jk>true</jk>
+	 * 	<li><b>Name:</b> <js>"RestContext.callHandler.o"</js>
+	 * 	<li><b>Data type:</b> <code>Class&lt;? <jk>extends</jk> RestCallHandler&gt; | RestCallHandler</code>
+	 * 	<li><b>Default:</b> {@link RestCallHandler}
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
-	 *
+	 * 
+	 * <p>
+	 * This class handles the basic lifecycle of an HTTP REST call.
+	 * <br>Subclasses can be used to customize how these HTTP calls are handled.
+
 	 * <p>
-	 * When enabled, the number of times an exception has occurred will be determined based on stack trace hashsums,
-	 * made available through the {@link RestException#getOccurrence()} method.
-	 *
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_useStackTraceHashes}
-	 * 	<li>Annotations:  
+	 * 	<li>Property:  {@link RestContext#REST_callHandler}
+	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#useStackTraceHashes()}
+	 * 			<li>{@link RestResource#callHandler()} 
 	 * 		</ul>
-	 * 	<li>Methods:  
+	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#useStackTraceHashes(boolean)}
+	 * 			<li>{@link RestContextBuilder#callHandler(Class)}
+	 * 			<li>{@link RestContextBuilder#callHandler(RestCallHandler)} 
 	 * 		</ul>
 	 *	</ul>
 	 */
-	public static final String REST_useStackTraceHashes = PREFIX + "useStackTraceHashes.b";
-	
+	public static final String REST_callHandler = PREFIX + "callHandler.o";
+
 	/**
-	 * <b>Configuration property:</b>  Default character encoding.
+	 * <b>Configuration property:</b>  Classpath resource finder. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.defaultCharset.s"</js>
-	 * 	<li><b>Data type:</b> <code>String</code>
-	 * 	<li><b>Default:</b> <js>"utf-8"</js>
+	 * 	<li><b>Name:</b> <js>"RestContext.classpathResourceFinder.o"</js>
+	 * 	<li><b>Data type:</b> {@link ClasspathResourceFinder}
+	 * 	<li><b>Default:</b> {@link ClasspathResourceFinderBasic}
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
-	 *
+	 * 
 	 * <p>
-	 * The default character encoding for the request and response if not specified on the request.
-	 *
-	 * <h5 class='section'>Notes:</h5>
+	 * Used to retrieve localized files from the classpath.
+	 * 
+	 * <p>
+	 * 
+	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_defaultCharset}
-	 * 	<li>Annotations:  
+	 * 	<li>Property:  {@link RestContext#REST_classpathResourceFinder}
+	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#defaultCharset()}
-	 * 			<li>{@link RestMethod#defaultCharset()}
+	 * 			<li>{@link RestResource#classpathResourceFinder()} 
 	 * 		</ul>
-	 * 	<li>Methods:  
+	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#defaultCharset(String)}
+	 * 			<li>{@link RestContextBuilder#classpathResourceFinder(Class)}
+	 * 			<li>{@link RestContextBuilder#classpathResourceFinder(ClasspathResourceFinder)}
 	 * 		</ul>
-	 *	</ul>
+	 * 	<li>
+	 * 		The default value is {@link ClasspathResourceFinderBasic} which provides basic support for finding localized
+	 * 		resources on the classpath and JVM working directory.
+	 * 		<br>The {@link ClasspathResourceFinderRecursive} is another option that also recursively searches for resources
+	 * 		up the parent class hierarchy.
+	 * 		<br>Each of these classes can be extended to provide customized handling of resource retrieval.
+	 * </ul>
 	 */
-	public static final String REST_defaultCharset = PREFIX + "defaultCharset.s";
+	public static final String REST_classpathResourceFinder = PREFIX + "classpathResourceFinder.o";
 	
 	/**
-	 * <b>Configuration property:</b>  The maximum allowed input size (in bytes) on HTTP requests.
+	 * <b>Configuration property:</b>  Client version header.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.maxInput.s"</js>
+	 * 	<li><b>Name:</b> <js>"RestContext.clientVersionHeader.s"</js>
 	 * 	<li><b>Data type:</b> <code>String</code>
-	 * 	<li><b>Default:</b> <js>"100M"</js>
+	 * 	<li><b>Default:</b> <js>"X-Client-Version"</js>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
+	 * 
+	 * <p>
+	 * Specifies the name of the header used to denote the client version on HTTP requests.
 	 *
 	 * <p>
-	 * Useful for alleviating DoS attacks by throwing an exception when too much input is received instead of resulting
-	 * in out-of-memory errors which could affect system stability.
+	 * The client version is used to support backwards compatibility for breaking REST interface changes.
+	 * <br>Used in conjunction with {@link RestMethod#clientVersion()} annotation.
 	 * 
+	 * <p>
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_maxInput}
-	 * 	<li>Annotations:  
+	 * 	<li>Property:  {@link RestContext#REST_clientVersionHeader}
+	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#maxInput()}
-	 * 			<li>{@link RestMethod#maxInput()}
+	 * 			<li>{@link RestResource#clientVersionHeader()} 
 	 * 		</ul>
-	 * 	<li>Methods:  
+	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#maxInput(String)}
+	 * 			<li>{@link RestContextBuilder#clientVersionHeader(String)}
 	 * 		</ul>
-	 * 	<li>String value that gets resolved to a <jk>long</jk>.
-	 * 	<li>Can be suffixed with any of the following representing kilobytes, megabytes, and gigabytes:  
-	 * 		<js>'K'</js>, <js>'M'</js>, <js>'G'</js>.
-	 * 	<li>A value of <js>"-1"</js> can be used to represent no limit.
 	 *	</ul>
 	 */
-	public static final String REST_maxInput = PREFIX + "maxInput.s";
-	
+	public static final String REST_clientVersionHeader = PREFIX + "clientVersionHeader.s";
+
 	/**
-	 * <b>Configuration property:</b>  Java method parameter resolvers.
+	 * <b>Configuration property:</b>  Resource context path. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.paramResolvers.lo"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;RestParam | Class&lt;? <jk>extends</jk> RestParam&gt;&gt;</code>
-	 * 	<li><b>Default:</b> empty list
+	 * 	<li><b>Name:</b> <js>"RestContext.contextPath.s"</js>
+	 * 	<li><b>Data type:</b> <code>String</code>
+	 * 	<li><b>Default:</b> <jk>null</jk>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
-	 *
+	 * 
 	 * <p>
-	 * By default, the Juneau framework will automatically Java method parameters of various types (e.g.
-	 * <code>RestRequest</code>, <code>Accept</code>, <code>Reader</code>).
-	 * This annotation allows you to provide your own resolvers for your own class types that you want resolved.
+	 * Overrides the context path value for this resource and any child resources.
 	 *
 	 * <p>
-	 * For example, if you want to pass in instances of <code>MySpecialObject</code> to your Java method, define
-	 * the following resolver:
-	 * <p class='bcode'>
-	 * 	<jk>public class</jk> MyRestParam <jk>extends</jk> RestParam {
-	 *
-	 * 		<jc>// Must have no-arg constructor!</jc>
-	 * 		<jk>public</jk> MyRestParam() {
-	 * 			<jc>// First two parameters help with Swagger doc generation.</jc>
-	 * 			<jk>super</jk>(<jsf>QUERY</jsf>, <js>"myparam"</js>, MySpecialObject.<jk>class</jk>);
-	 * 		}
-	 *
-	 * 		<jc>// The method that creates our object.
-	 * 		// In this case, we're taking in a query parameter and converting it to our object.</jc>
-	 * 		<jk>public</jk> Object resolve(RestRequest req, RestResponse res) <jk>throws</jk> Exception {
-	 * 			<jk>return new</jk> MySpecialObject(req.getQuery().get(<js>"myparam"</js>));
-	 * 		}
-	 * 	}
-	 * </p>
-	 *
+	 * This setting is useful if you want to use <js>"context:/child/path"</js> URLs in child resource POJOs but
+	 * the context path is not actually specified on the servlet container.
+	 * The net effect is that the {@link RestRequest#getContextPath()} and {@link RestRequest#getServletPath()} methods
+	 * will return this value instead of the actual context path of the web app.
+	 * 
+	 * <p>
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_paramResolvers}
-	 * 	<li>Annotations:  
+	 * 	<li>Property:  {@link RestContext#REST_contextPath}
+	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#paramResolvers()}
+	 * 			<li>{@link RestResource#contextPath()} 
+	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#paramResolvers(Class...)}
-	 * 			<li>{@link RestContextBuilder#paramResolvers(RestParam...)}
+	 * 			<li>{@link RestContextBuilder#contextPath(String)} 
 	 * 		</ul>
-	 * 	<li>{@link RestParam} classes must have either a no-arg or {@link PropertyStore} argument constructors.
 	 *	</ul>
 	 */
-	public static final String REST_paramResolvers = PREFIX + "paramResolvers.lo";
-
+	public static final String REST_contextPath = PREFIX + "contextPath.s";
+	
 	/**
 	 * <b>Configuration property:</b>  Class-level response converters.
 	 *
@@ -381,91 +344,41 @@ public final class RestContext extends BeanContext {
 	public static final String REST_converters = PREFIX + "converters.lo";
 
 	/**
-	 * <b>Configuration property:</b>  Class-level guards.
+	 * <b>Configuration property:</b>  Default character encoding.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.guards.lo"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;RestGuard | Class&lt;? <jk>extends</jk> RestGuard&gt;&gt;</code>
-	 * 	<li><b>Default:</b> empty list
+	 * 	<li><b>Name:</b> <js>"RestContext.defaultCharset.s"</js>
+	 * 	<li><b>Data type:</b> <code>String</code>
+	 * 	<li><b>Default:</b> <js>"utf-8"</js>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 *
 	 * <p>
-	 * Associates one or more {@link RestGuard RestGuards} with all REST methods defined in this class.
-	 * These guards get called immediately before execution of any REST method in this class.
-	 *
-	 * <p>
-	 * Typically, guards will be used for permissions checking on the user making the request, but it can also be used
-	 * for other purposes like pre-call validation of a request.
+	 * The default character encoding for the request and response if not specified on the request.
 	 *
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_guards}
+	 * 	<li>Property:  {@link RestContext#REST_defaultCharset}
 	 * 	<li>Annotations:  
 	 * 		<ul>
-	 * 			<li>{@link RestResource#guards()}
-	 * 			<li>{@link RestMethod#guards()}
+	 * 			<li>{@link RestResource#defaultCharset()}
+	 * 			<li>{@link RestMethod#defaultCharset()}
 	 * 		</ul>
-	 * 	<li>Methods: 
+	 * 	<li>Methods:  
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#guards(Class...)}
-	 * 			<li>{@link RestContextBuilder#guards(RestGuard...)}
+	 * 			<li>{@link RestContextBuilder#defaultCharset(String)}
 	 * 		</ul>
-	 * 	<li>{@link RestGuard} classes must have either a no-arg or {@link PropertyStore} argument constructors.
 	 *	</ul>
 	 */
-	public static final String REST_guards = PREFIX + "guards.lo";
-
+	public static final String REST_defaultCharset = PREFIX + "defaultCharset.s";
+	
 	/**
-	 * <b>Configuration property:</b>  Response handlers.
+	 * <b>Configuration property:</b>  Default request headers.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.responseHandlers.lo"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;Class&lt;? <jk>extends</jk> ResponseHandler&gt;&gt;</code>
-	 * 	<li><b>Default:</b> empty list
-	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
-	 * </ul>
-	 * 
-	 * <p>
-	 * Specifies a list of {@link ResponseHandler} classes that know how to convert POJOs returned by REST methods or
-	 * set via {@link RestResponse#setOutput(Object)} into appropriate HTTP responses.
-	 *
-	 * <p>
-	 * By default, the following response handlers are provided out-of-the-box:
-	 * <ul>
-	 * 	<li>{@link StreamableHandler}
-	 * 	<li>{@link WritableHandler}
-	 * 	<li>{@link ReaderHandler}
-	 * 	<li>{@link InputStreamHandler}
-	 * 	<li>{@link RedirectHandler}
-	 * 	<li>{@link DefaultHandler}
-	 * </ul>
-
-	 * <p>
-	 * <h5 class='section'>Notes:</h5>
-	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_responseHandlers}
-	 * 	<li>Annotations: 
-	 * 		<ul>
-	 * 			<li>{@link RestResource#responseHandlers()} 
-	 * 		</ul>
-	 * 	<li>Methods: 
-	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#responseHandlers(Class...)}
-					<li>{@link RestContextBuilder#responseHandlers(ResponseHandler...)}
-				</ul>
-	 * 	<li>{@link ResponseHandler} classes must have either a no-arg or {@link PropertyStore} argument constructors.
-	 *	</ul>
-	 */
-	public static final String REST_responseHandlers = PREFIX + "responseHandlers.lo";
-
-	/**
-	 * <b>Configuration property:</b>  Default request headers.
-	 *
-	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.defaultRequestHeaders.smo"</js>
-	 * 	<li><b>Data type:</b> <code>Map&lt;String,String&gt;</code>
-	 * 	<li><b>Default:</b> empty map
+	 * 	<li><b>Name:</b> <js>"RestContext.defaultRequestHeaders.smo"</js>
+	 * 	<li><b>Data type:</b> <code>Map&lt;String,String&gt;</code>
+	 * 	<li><b>Default:</b> empty map
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
@@ -527,141 +440,116 @@ public final class RestContext extends BeanContext {
 	public static final String REST_defaultResponseHeaders = PREFIX + "defaultResponseHeaders.omo";
 
 	/**
-	 * <b>Configuration property:</b>  Supported accept media types.
+	 * <b>Configuration property:</b>  Compression encoders. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.supportedAcceptTypes.ls"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;String&gt;</code>
+	 * 	<li><b>Name:</b> <js>"RestContext.encoders.o"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;Class &lt;? <jk>extends</jk> Encoder&gt; | Encoder&gt;</code>
 	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Overrides the media types inferred from the serializers that identify what media types can be produced by the resource.
-	 * 
-	 * <p>
-	 * This affects the values returned by {@link RestRequest#getSupportedAcceptTypes()} and the supported accept
-	 * types shown in {@link RestInfoProvider#getSwagger(RestRequest)}.
+	 * These can be used to enable various kinds of compression (e.g. <js>"gzip"</js>) on requests and responses.
 	 *
-	 * <p>
-	 * <h5 class='section'>Notes:</h5>
+	 * <h5 class='section'>Example:</h5>
+	 * <p class='bcode'>
+	 * 	<jc>// Servlet with automated support for GZIP compression</jc>
+	 * 	<ja>@RestResource</ja>(encoders={GzipEncoder.<jk>class</jk>})
+	 * 	<jk>public</jk> MyRestServlet <jk>extends</jk> RestServlet {
+	 * 		...
+	 * 	}
+	 * </p>
+	 * 
+	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_supportedAcceptTypes}
-	 * 	<li>Annotations:
+	 * 	<li>Property:  {@link RestContext#REST_encoders}
+	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#supportedAcceptTypes()}
-	 * 			<li>{@link RestMethod#supportedAcceptTypes()}
-	 * 		</ul> 
-	 * 	<li>Methods:  
+	 * 			<li>{@link RestResource#encoders()} 
+	 * 			<li>{@link RestMethod#encoders()} 
+	 * 		</ul>
+	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#supportedAcceptTypes(boolean,String...)}
-	 * 			<li>{@link RestContextBuilder#supportedAcceptTypes(boolean,MediaType...)}
+	 * 			<li>{@link RestContextBuilder#encoders(Class...)}
+	 * 			<li>{@link RestContextBuilder#encoders(Encoder...)}
 	 * 		</ul>
-	 *	</ul>
+	 * 	<li>Instance classes must provide a public no-arg constructor, or a public constructor that takes in a
+	 * 		{@link PropertyStore} object.
+	 * 	<li>Instance class can be defined as an inner class of the REST resource class.
+	 * </ul>
 	 */
-	public static final String REST_supportedAcceptTypes = PREFIX + "supportedAcceptTypes.ls";
+	public static final String REST_encoders = PREFIX + "encoders.lo";
 
 	/**
-	 * <b>Configuration property:</b>  Supported content media types.
+	 * <b>Configuration property:</b>  Class-level guards.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.supportedContentTypes.ls"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;String&gt;</code>
+	 * 	<li><b>Name:</b> <js>"RestContext.guards.lo"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;RestGuard | Class&lt;? <jk>extends</jk> RestGuard&gt;&gt;</code>
 	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
-	 * 
-	 * <p>
-	 * Overrides the media types inferred from the parsers that identify what media types can be consumed by the resource.
 	 *
 	 * <p>
-	 * This affects the values returned by {@link RestRequest#getSupportedContentTypes()} and the supported content
-	 * types shown in {@link RestInfoProvider#getSwagger(RestRequest)}.
-	 * 
-	 * <p>
-	 * <h5 class='section'>Notes:</h5>
-	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_supportedContentTypes}
-	 * 	<li>Annotations:
-	 * 		<ul>
-	 * 			<li>{@link RestResource#supportedContentTypes()}
-	 * 			<li>{@link RestMethod#supportedContentTypes()}
-	 * 		</ul> 
-	 * 	<li>Methods:  
-	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#supportedContentTypes(boolean,String...)}
-	 * 			<li>{@link RestContextBuilder#supportedContentTypes(boolean,MediaType...)}
-	 * 		</ul>
-	 *	</ul>
-	 */
-	public static final String REST_supportedContentTypes = PREFIX + "supportedContentTypes.ls";
-	
-	/**
-	 * <b>Configuration property:</b>  Client version header.
+	 * Associates one or more {@link RestGuard RestGuards} with all REST methods defined in this class.
+	 * These guards get called immediately before execution of any REST method in this class.
 	 *
-	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.clientVersionHeader.s"</js>
-	 * 	<li><b>Data type:</b> <code>String</code>
-	 * 	<li><b>Default:</b> <js>"X-Client-Version"</js>
-	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
-	 * </ul>
-	 * 
 	 * <p>
-	 * Specifies the name of the header used to denote the client version on HTTP requests.
+	 * Typically, guards will be used for permissions checking on the user making the request, but it can also be used
+	 * for other purposes like pre-call validation of a request.
 	 *
-	 * <p>
-	 * The client version is used to support backwards compatibility for breaking REST interface changes.
-	 * <br>Used in conjunction with {@link RestMethod#clientVersion()} annotation.
-	 * 
-	 * <p>
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_clientVersionHeader}
-	 * 	<li>Annotations: 
+	 * 	<li>Property:  {@link RestContext#REST_guards}
+	 * 	<li>Annotations:  
 	 * 		<ul>
-	 * 			<li>{@link RestResource#clientVersionHeader()} 
+	 * 			<li>{@link RestResource#guards()}
+	 * 			<li>{@link RestMethod#guards()}
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#clientVersionHeader(String)}
+	 * 			<li>{@link RestContextBuilder#guards(Class...)}
+	 * 			<li>{@link RestContextBuilder#guards(RestGuard...)}
 	 * 		</ul>
+	 * 	<li>{@link RestGuard} classes must have either a no-arg or {@link PropertyStore} argument constructors.
 	 *	</ul>
 	 */
-	public static final String REST_clientVersionHeader = PREFIX + "clientVersionHeader.s";
+	public static final String REST_guards = PREFIX + "guards.lo";
 
 	/**
-	 * <b>Configuration property:</b>  REST resource resolver.
+	 * <b>Configuration property:</b>  REST info provider. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.resourceResolver.o"</js>
-	 * 	<li><b>Data type:</b> <code>Class&lt;? <jk>extends</jk> RestResourceResolver&gt; | RestResourceResolver</code>
-	 * 	<li><b>Default:</b> {@link RestResourceResolverSimple}
+	 * 	<li><b>Name:</b> <js>"RestContext.infoProvider.o"</js>
+	 * 	<li><b>Data type:</b> <code>Class&lt;? <jk>extends</jk> RestInfoProvider&gt; | RestInfoProvider</code>
+	 * 	<li><b>Default:</b> {@link RestInfoProvider}
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
-	 * The resolver used for resolving child resources.
-	 * 
 	 * <p>
-	 * Can be used to provide customized resolution of REST resource class instances (e.g. resources retrieve from Spring).
+	 * Class used to retrieve title/description/swagger information about a resource.
+	 *
+	 * <p>
+	 * Subclasses can be used to customize the documentation on a resource.
 	 *
 	 * <p>
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_resourceResolver}
+	 * 	<li>Property:  {@link RestContext#REST_infoProvider}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#resourceResolver()} 
+	 * 			<li>{@link RestResource#infoProvider()} 
 	 * 		</ul>
-	 * 	<li>Methods:  
+	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#resourceResolver(Class)}
-					<li>{@link RestContextBuilder#resourceResolver(RestResourceResolver)}
-				</ul>
-	 * 	<li>Unless overridden, resource resolvers are inherited from parent resources.
+	 * 			<li>{@link RestContextBuilder#infoProvider(Class)}
+	 * 			<li>{@link RestContextBuilder#infoProvider(RestInfoProvider)} 
+	 * 		</ul>
 	 *	</ul>
 	 */
-	public static final String REST_resourceResolver = PREFIX + "resourceResolver.o";
-
+	public static final String REST_infoProvider = PREFIX + "infoProvider.o";
+	
 	/**
 	 * <b>Configuration property:</b>  REST logger.
 	 * 
@@ -686,629 +574,741 @@ public final class RestContext extends BeanContext {
 	 * 	<li>Methods:  
 	 * 		<ul>
 	 * 			<li>{@link RestContextBuilder#logger(Class)}
-					<li>{@link RestContextBuilder#logger(RestLogger)} 
-				</ul>
+	 * 			<li>{@link RestContextBuilder#logger(RestLogger)} 
+	 * 		</ul>
 	 * 	<li>The {@link RestLogger.Normal} logger can be used to provide basic error logging to the Java logger.
 	 *	</ul>
 	 */
 	public static final String REST_logger = PREFIX + "logger.o";
 
 	/**
-	 * <b>Configuration property:</b>  REST call handler.
+	 * <b>Configuration property:</b>  The maximum allowed input size (in bytes) on HTTP requests.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.callHandler.o"</js>
-	 * 	<li><b>Data type:</b> <code>Class&lt;? <jk>extends</jk> RestCallHandler&gt; | RestCallHandler</code>
-	 * 	<li><b>Default:</b> {@link RestCallHandler}
+	 * 	<li><b>Name:</b> <js>"RestContext.maxInput.s"</js>
+	 * 	<li><b>Data type:</b> <code>String</code>
+	 * 	<li><b>Default:</b> <js>"100M"</js>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
-	 * 
-	 * <p>
-	 * This class handles the basic lifecycle of an HTTP REST call.
-	 * <br>Subclasses can be used to customize how these HTTP calls are handled.
-
+	 *
 	 * <p>
+	 * Useful for alleviating DoS attacks by throwing an exception when too much input is received instead of resulting
+	 * in out-of-memory errors which could affect system stability.
+	 * 
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_callHandler}
-	 * 	<li>Annotations: 
+	 * 	<li>Property:  {@link RestContext#REST_maxInput}
+	 * 	<li>Annotations:  
 	 * 		<ul>
-	 * 			<li>{@link RestResource#callHandler()} 
+	 * 			<li>{@link RestResource#maxInput()}
+	 * 			<li>{@link RestMethod#maxInput()}
 	 * 		</ul>
-	 * 	<li>Methods: 
+	 * 	<li>Methods:  
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#callHandler(Class)}
-	 * 			<li>{@link RestContextBuilder#callHandler(RestCallHandler)} 
+	 * 			<li>{@link RestContextBuilder#maxInput(String)}
 	 * 		</ul>
+	 * 	<li>String value that gets resolved to a <jk>long</jk>.
+	 * 	<li>Can be suffixed with any of the following representing kilobytes, megabytes, and gigabytes:  
+	 * 		<js>'K'</js>, <js>'M'</js>, <js>'G'</js>.
+	 * 	<li>A value of <js>"-1"</js> can be used to represent no limit.
 	 *	</ul>
 	 */
-	public static final String REST_callHandler = PREFIX + "callHandler.o";
-
+	public static final String REST_maxInput = PREFIX + "maxInput.s";
+	
 	/**
-	 * <b>Configuration property:</b>  REST info provider. 
+	 * <b>Configuration property:</b>  Messages. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.infoProvider.o"</js>
-	 * 	<li><b>Data type:</b> <code>Class&lt;? <jk>extends</jk> RestInfoProvider&gt; | RestInfoProvider</code>
-	 * 	<li><b>Default:</b> {@link RestInfoProvider}
+	 * 	<li><b>Name:</b> <js>"RestContext.messages.lo"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;MessageBundleLocation&gt;</code>
+	 * 	<li><b>Default:</b> <jk>null</jk>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Class used to retrieve title/description/swagger information about a resource.
+	 * Identifies the location of the resource bundle for this class.
 	 *
 	 * <p>
-	 * Subclasses can be used to customize the documentation on a resource.
+	 * This annotation is used to provide localized messages for the following methods:
+	 * <ul>
+	 * 	<li>{@link RestRequest#getMessage(String, Object...)}
+	 * 	<li>{@link RestContext#getMessages()}
+	 * </ul>
 	 *
 	 * <p>
-	 * <h5 class='section'>Notes:</h5>
+	 * Refer to the {@link MessageBundle} class for a description of the message key formats used in the properties file.
+	 *
+	 * <p>
+	 * The value can be a relative path like <js>"nls/Messages"</js>, indicating to look for the resource bundle
+	 * <js>"com.foo.sample.nls.Messages"</js> if the resource class is in <js>"com.foo.sample"</js>, or it can be an
+	 * absolute path, like <js>"com.foo.sample.nls.Messages"</js>
+	 * 
+	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_infoProvider}
+	 * 	<li>Property:  {@link RestContext#REST_messages}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#infoProvider()} 
+	 * 			<li>{@link RestResource#messages()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#infoProvider(Class)}
-	 * 			<li>{@link RestContextBuilder#infoProvider(RestInfoProvider)} 
-	 * 		</ul>
-	 *	</ul>
+	 * 			<li>{@link RestContextBuilder#messages(String)},
+	 * 			<li>{@link RestContextBuilder#messages(Class,String)}
+	 * 			<li>{@link RestContextBuilder#messages(MessageBundleLocation)} 
+	 * 		</ul>
+	 * 	<li>Mappings are cumulative from parent to child.  
+	 * </ul>
 	 */
-	public static final String REST_infoProvider = PREFIX + "infoProvider.o";
+	public static final String REST_messages = PREFIX + "messages.lo";
 	
 	/**
-	 * <b>Configuration property:</b>  Resource path.   
+	 * <b>Configuration property:</b>  MIME types. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.path.s"</js>
-	 * 	<li><b>Data type:</b> <code>String</code>
-	 * 	<li><b>Default:</b> <jk>null</jk>
+	 * 	<li><b>Name:</b> <js>"RestContext.mimeTypes.ss"</js>
+	 * 	<li><b>Data type:</b> <code>Set&lt;String&gt;</code>
+	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Identifies the URL subpath relative to the parent resource.
-	 *
+	 * Defines MIME-type file type mappings.
+	 * 
 	 * <p>
-	 * <h5 class='section'>Notes:</h5>
+	 * Used for specifying the content type on file resources retrieved through the following methods:
+	 * <ul>
+	 * 	<li>{@link RestContext#resolveStaticFile(String)}
+	 * 	<li>{@link RestRequest#getClasspathReaderResource(String,boolean,MediaType)}
+	 * 	<li>{@link RestRequest#getClasspathReaderResource(String,boolean)}
+	 * 	<li>{@link RestRequest#getClasspathReaderResource(String)}
+	 * </ul>
+	 * 
+	 * <p>
+	 * This list appends to the existing list provided by {@link ExtendedMimetypesFileTypeMap}.
+	 * 
+	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_path}
+	 * 	<li>Property:  {@link RestContext#REST_mimeTypes}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#path()} 
+	 * 			<li>{@link RestResource#mimeTypes()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#path(String)} 
+	 * 			<li>{@link RestContextBuilder#mimeTypes(String...)}
 	 * 		</ul>
-	 * 	<li>This annotation is ignored on top-level servlets (i.e. servlets defined in <code>web.xml</code> files).
-	 * 		<br>Therefore, implementers can optionally specify a path value for documentation purposes.
-	 * 	<li>Typically, this setting is only applicable to resources defined as children through the 
-	 * 		{@link RestResource#children()} annotation.
-	 * 		<br>However, it may be used in other ways (e.g. defining paths for top-level resources in microservices).
-	 *	</ul>
+	 * 	<li>Values are .mime.types formatted entry string.
+	 * 		<br>Example: <js>"image/svg+xml svg"</js>
+	 * </ul>
 	 */
-	public static final String REST_path = PREFIX + "path.s";
+	public static final String REST_mimeTypes = PREFIX + "mimeTypes.ss";
 
 	/**
-	 * <b>Configuration property:</b>  Resource context path. 
+	 * <b>Configuration property:</b>  Java method parameter resolvers.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.contextPath.s"</js>
-	 * 	<li><b>Data type:</b> <code>String</code>
-	 * 	<li><b>Default:</b> <jk>null</jk>
+	 * 	<li><b>Name:</b> <js>"RestContext.paramResolvers.lo"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;RestParam | Class&lt;? <jk>extends</jk> RestParam&gt;&gt;</code>
+	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
-	 * 
-	 * <p>
-	 * Overrides the context path value for this resource and any child resources.
 	 *
 	 * <p>
-	 * This setting is useful if you want to use <js>"context:/child/path"</js> URLs in child resource POJOs but
-	 * the context path is not actually specified on the servlet container.
-	 * The net effect is that the {@link RestRequest#getContextPath()} and {@link RestRequest#getServletPath()} methods
-	 * will return this value instead of the actual context path of the web app.
-	 * 
+	 * By default, the Juneau framework will automatically Java method parameters of various types (e.g.
+	 * <code>RestRequest</code>, <code>Accept</code>, <code>Reader</code>).
+	 * This annotation allows you to provide your own resolvers for your own class types that you want resolved.
+	 *
 	 * <p>
+	 * For example, if you want to pass in instances of <code>MySpecialObject</code> to your Java method, define
+	 * the following resolver:
+	 * <p class='bcode'>
+	 * 	<jk>public class</jk> MyRestParam <jk>extends</jk> RestParam {
+	 *
+	 * 		<jc>// Must have no-arg constructor!</jc>
+	 * 		<jk>public</jk> MyRestParam() {
+	 * 			<jc>// First two parameters help with Swagger doc generation.</jc>
+	 * 			<jk>super</jk>(<jsf>QUERY</jsf>, <js>"myparam"</js>, MySpecialObject.<jk>class</jk>);
+	 * 		}
+	 *
+	 * 		<jc>// The method that creates our object.
+	 * 		// In this case, we're taking in a query parameter and converting it to our object.</jc>
+	 * 		<jk>public</jk> Object resolve(RestRequest req, RestResponse res) <jk>throws</jk> Exception {
+	 * 			<jk>return new</jk> MySpecialObject(req.getQuery().get(<js>"myparam"</js>));
+	 * 		}
+	 * 	}
+	 * </p>
+	 *
 	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_contextPath}
-	 * 	<li>Annotations: 
+	 * 	<li>Property:  {@link RestContext#REST_paramResolvers}
+	 * 	<li>Annotations:  
 	 * 		<ul>
-	 * 			<li>{@link RestResource#contextPath()} 
-	 * 		</ul>
+	 * 			<li>{@link RestResource#paramResolvers()}
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#contextPath(String)} 
+	 * 			<li>{@link RestContextBuilder#paramResolvers(Class...)}
+	 * 			<li>{@link RestContextBuilder#paramResolvers(RestParam...)}
 	 * 		</ul>
+	 * 	<li>{@link RestParam} classes must have either a no-arg or {@link PropertyStore} argument constructors.
 	 *	</ul>
 	 */
-	public static final String REST_contextPath = PREFIX + "contextPath.s";
-	
+	public static final String REST_paramResolvers = PREFIX + "paramResolvers.lo";
+
 	/**
-	 * <b>Configuration property:</b>  Static file mappings. 
+	 * <b>Configuration property:</b>  Parsers. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.staticFiles.lo"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;StaticFileMapping&gt;</code>
-	 * 	<li><b>Default:</b> <jk>null</jk>
+	 * 	<li><b>Name:</b> <js>"RestContext.parsers.lo"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;Class &lt;? <jk>extends</jk> Parser&gt; | Parser&gt;</code>
+	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Used to define paths and locations of statically-served files such as images or HTML documents.
-	 * 
-	 * <p>
-	 * Static files are found by calling {@link #getClasspathResource(String,Locale)} which uses the registered 
-	 * {@link ClasspathResourceFinder} for locating files on the classpath (or other location).
-	 * 
-	 * <p>
-	 * An example where this class is used is in the {@link RestResource#staticFiles} annotation:
-	 * <p class='bcode'>
-	 * 	<jk>package</jk> com.foo.mypackage;
-	 * 
-	 * 	<ja>@RestResource</ja>(
-	 * 		path=<js>"/myresource"</js>,
-	 * 		staticFiles={<js>"htdocs:docs"</js>,<js>"styles:styles"</js>}
-	 * 	)
-	 * 	<jk>public class</jk> MyResource <jk>extends</jk> RestServletDefault {...}
-	 * </p>
-	 * 
-	 * <p>
-	 * In the example above, given a GET request to <l>/myresource/htdocs/foobar.html</l>, the servlet will attempt to find 
-	 * the <l>foobar.html</l> file in the following ordered locations:
-	 * <ol>
-	 * 	<li><l>com.foo.mypackage.docs</l> package.
-	 * 	<li><l>org.apache.juneau.rest.docs</l> package (since <l>RestServletDefault</l> is in <l>org.apache.juneau.rest</l>).
-	 * 	<li><l>[working-dir]/docs</l> directory.
-	 * </ol>
+	 * Adds class-level parsers to this resource.
 	 * 
 	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_staticFiles}
+	 * 	<li>Property:  {@link RestContext#REST_parsers}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#staticFiles()} 
+	 * 			<li>{@link RestResource#parsers()} 
+	 * 			<li>{@link RestMethod#parsers()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#staticFiles(String)},
-	 * 			<li>{@link RestContextBuilder#staticFiles(Class,String)}
-	 * 			<li>{@link RestContextBuilder#staticFiles(String,String)}
-	 * 			<li>{@link RestContextBuilder#staticFiles(Class,String,String)} 
-	 * 			<li>{@link RestContextBuilder#staticFiles(StaticFileMapping...)} 
+	 * 			<li>{@link RestContextBuilder#parsers(Class...)}
+	 * 			<li>{@link RestContextBuilder#parsers(boolean,Class...)}
+	 * 			<li>{@link RestContextBuilder#parsers(Parser...)}
+	 * 			<li>{@link RestContextBuilder#parsers(boolean,Parser...)}
 	 * 		</ul>
-	 * 	<li>Mappings are cumulative from parent to child.  
-	 * 	<li>Child resources can override mappings made on parent resources.
-	 * 	<li>The media type on the response is determined by the {@link org.apache.juneau.rest.RestContext#getMediaTypeForName(String)} method.
-	 * 	<li>The resource finder is configured via the {@link #REST_classpathResourceFinder} setting, and can be
-	 * 		overridden to provide customized handling of resource retrieval.
-	 * 	<li>The {@link #REST_useClasspathResourceCaching} setting can be used to cache static files in memory
-	 * 		to improve performance.
+	 * 	<li>When defined as a class, properties/transforms defined on the resource/method are inherited.
+	 * 	<li>When defined as an instance, properties/transforms defined on the resource/method are NOT inherited.
 	 * </ul>
 	 */
-	public static final String REST_staticFiles = PREFIX + "staticFiles.lo";
-	
+	public static final String REST_parsers = PREFIX + "parsers.lo";
+
 	/**
-	 * <b>Configuration property:</b>  Messages. 
+	 * <b>Configuration property:</b>  HTTP part parser. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.messages.lo"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;MessageBundleLocation&gt;</code>
-	 * 	<li><b>Default:</b> <jk>null</jk>
+	 * 	<li><b>Name:</b> <js>"RestContext.partParser.o"</js>
+	 * 	<li><b>Data type:</b> <code>Class &lt;? <jk>extends</jk> HttpPartParser&gt; | HttpPartParser</code>
+	 * 	<li><b>Default:</b> {@link UonPartParser}
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Identifies the location of the resource bundle for this class.
-	 *
-	 * <p>
-	 * This annotation is used to provide localized messages for the following methods:
-	 * <ul>
-	 * 	<li>{@link RestRequest#getMessage(String, Object...)}
-	 * 	<li>{@link RestContext#getMessages()}
-	 * </ul>
-	 *
-	 * <p>
-	 * Refer to the {@link MessageBundle} class for a description of the message key formats used in the properties file.
-	 *
-	 * <p>
-	 * The value can be a relative path like <js>"nls/Messages"</js>, indicating to look for the resource bundle
-	 * <js>"com.foo.sample.nls.Messages"</js> if the resource class is in <js>"com.foo.sample"</js>, or it can be an
-	 * absolute path, like <js>"com.foo.sample.nls.Messages"</js>
+	 * Specifies the {@link HttpPartParser} to use for parsing headers, query/form parameters, and URI parts.
 	 * 
 	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_messages}
+	 * 	<li>Property:  {@link RestContext#REST_partParser}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#messages()} 
+	 * 			<li>{@link RestResource#partParser()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#messages(String)},
-	 * 			<li>{@link RestContextBuilder#messages(Class,String)}
-	 * 			<li>{@link RestContextBuilder#messages(MessageBundleLocation)} 
+	 * 			<li>{@link RestContextBuilder#partParser(Class)}
+	 * 			<li>{@link RestContextBuilder#partParser(HttpPartParser)}
 	 * 		</ul>
-	 * 	<li>Mappings are cumulative from parent to child.  
+	 * 	<li>When defined as a class, properties/transforms defined on the resource/method are inherited.
+	 * 	<li>When defined as an instance, properties/transforms defined on the resource/method are NOT inherited.
 	 * </ul>
 	 */
-	public static final String REST_messages = PREFIX + "messages.lo";
-	
+	public static final String REST_partParser = PREFIX + "partParser.o";
+
 	/**
-	 * <b>Configuration property:</b>  Static file response headers. 
+	 * <b>Configuration property:</b>  HTTP part serializer. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.staticFileResponseHeaders.omo"</js>
-	 * 	<li><b>Data type:</b> <code>Map&lt;String,String&gt;</code>
-	 * 	<li><b>Default:</b> <code>{<js>'Cache-Control'</js>: <js>'max-age=86400, public</js>}</code>
+	 * 	<li><b>Name:</b> <js>"RestContext.partSerializer.o"</js>
+	 * 	<li><b>Data type:</b> <code>Class &lt;? <jk>extends</jk> HttpPartSerializer&gt; | HttpPartSerializer</code>
+	 * 	<li><b>Default:</b> {@link SimpleUonPartSerializer}
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Used to customize the headers on responses returned for statically-served files.
-	 * 
+	 * Specifies the {@link HttpPartSerializer} to use for serializing headers, query/form parameters, and URI parts.
+	 *
 	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_staticFileResponseHeaders}
+	 * 	<li>Property:  {@link RestContext#REST_partSerializer}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#staticFileResponseHeaders()} 
+	 * 			<li>{@link RestResource#partSerializer()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#staticFileResponseHeaders(boolean,Map)}
-	 * 			<li>{@link RestContextBuilder#staticFileResponseHeaders(String...)}
-	 * 			<li>{@link RestContextBuilder#staticFileResponseHeader(String,String)}
+	 * 			<li>{@link RestContextBuilder#partSerializer(Class)}
+	 * 			<li>{@link RestContextBuilder#partSerializer(HttpPartSerializer)}
 	 * 		</ul>
+	 * 	<li>When defined as a class, properties/transforms defined on the resource/method are inherited.
+	 * 	<li>When defined as an instance, properties/transforms defined on the resource/method are NOT inherited.
 	 * </ul>
 	 */
-	public static final String REST_staticFileResponseHeaders = PREFIX + "staticFileResponseHeaders.omo";
-	
+	public static final String REST_partSerializer = PREFIX + "partSerializer.o";
+
 	/**
-	 * <b>Configuration property:</b>  Classpath resource finder. 
+	 * <b>Configuration property:</b>  Resource path.   
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.classpathResourceFinder.o"</js>
-	 * 	<li><b>Data type:</b> {@link ClasspathResourceFinder}
-	 * 	<li><b>Default:</b> {@link ClasspathResourceFinderBasic}
+	 * 	<li><b>Name:</b> <js>"RestContext.path.s"</js>
+	 * 	<li><b>Data type:</b> <code>String</code>
+	 * 	<li><b>Default:</b> <jk>null</jk>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Used to retrieve localized files from the classpath.
-	 * 
+	 * Identifies the URL subpath relative to the parent resource.
+	 *
 	 * <p>
-	 * 
-	 * <h6 class='topic'>Notes:</h6>
+	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_classpathResourceFinder}
+	 * 	<li>Property:  {@link RestContext#REST_path}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#classpathResourceFinder()} 
+	 * 			<li>{@link RestResource#path()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#classpathResourceFinder(Class)}
-	 * 			<li>{@link RestContextBuilder#classpathResourceFinder(ClasspathResourceFinder)}
+	 * 			<li>{@link RestContextBuilder#path(String)} 
 	 * 		</ul>
-	 * 	<li>
-	 * 		The default value is {@link ClasspathResourceFinderBasic} which provides basic support for finding localized
-	 * 		resources on the classpath and JVM working directory.
-	 * 		<br>The {@link ClasspathResourceFinderRecursive} is another option that also recursively searches for resources
-	 * 		up the parent class hierarchy.
-	 * 		<br>Each of these classes can be extended to provide customized handling of resource retrieval.
+	 * 	<li>This annotation is ignored on top-level servlets (i.e. servlets defined in <code>web.xml</code> files).
+	 * 		<br>Therefore, implementers can optionally specify a path value for documentation purposes.
+	 * 	<li>Typically, this setting is only applicable to resources defined as children through the 
+	 * 		{@link RestResource#children()} annotation.
+	 * 		<br>However, it may be used in other ways (e.g. defining paths for top-level resources in microservices).
+	 *	</ul>
+	 */
+	public static final String REST_path = PREFIX + "path.s";
+
+	/**
+	 * <b>Configuration property:</b>  Render response stack traces in responses.
+	 *
+	 * <ul>
+	 * 	<li><b>Name:</b> <js>"RestContext.renderResponseStackTraces.b"</js>
+	 * 	<li><b>Data type:</b> <code>Boolean</code>
+	 * 	<li><b>Default:</b> <jk>false</jk>
+	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
+	 *
+	 * <p>
+	 * Render stack traces in HTTP response bodies when errors occur.
+	 *
+	 * <h5 class='section'>Notes:</h5>
+	 * <ul class='spaced-list'>
+	 * 	<li>Property:  {@link RestContext#REST_renderResponseStackTraces}
+	 * 	<li>Annotations:  
+	 * 		<ul>
+	 * 			<li>{@link RestResource#renderResponseStackTraces()}
+	 * 		</ul>
+	 * 	<li>Methods:  
+	 * 		<ul>
+	 * 			<li>{@link RestContextBuilder#renderResponseStackTraces(boolean)}
+	 * 		</ul>
+	 * 	<li>Useful for debugging, although allowing stack traces to be rendered may cause security concerns so use
+	 * 		caution when enabling.
+	 *	</ul>
 	 */
-	public static final String REST_classpathResourceFinder = PREFIX + "classpathResourceFinder.o";
+	public static final String REST_renderResponseStackTraces = PREFIX + "renderResponseStackTraces.b";
 	
 	/**
-	 * <b>Configuration property:</b>  Use classpath resource caching. 
+	 * <b>Configuration property:</b>  REST resource resolver.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.useClasspathResourceCaching.b"</js>
-	 * 	<li><b>Data type:</b> <code>Boolean</code>
-	 * 	<li><b>Default:</b> <jk>true</jk>
+	 * 	<li><b>Name:</b> <js>"RestContext.resourceResolver.o"</js>
+	 * 	<li><b>Data type:</b> <code>Class&lt;? <jk>extends</jk> RestResourceResolver&gt; | RestResourceResolver</code>
+	 * 	<li><b>Default:</b> {@link RestResourceResolverSimple}
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
+	 * The resolver used for resolving child resources.
+	 * 
 	 * <p>
-	 * When enabled, resources retrieved via {@link RestContext#getClasspathResource(String, Locale)} (and related 
-	 * methods) will be cached in memory to speed subsequent lookups.
+	 * Can be used to provide customized resolution of REST resource class instances (e.g. resources retrieve from Spring).
+	 *
+	 * <p>
+	 * <h5 class='section'>Notes:</h5>
+	 * <ul class='spaced-list'>
+	 * 	<li>Property:  {@link RestContext#REST_resourceResolver}
+	 * 	<li>Annotations: 
+	 * 		<ul>
+	 * 			<li>{@link RestResource#resourceResolver()} 
+	 * 		</ul>
+	 * 	<li>Methods:  
+	 * 		<ul>
+	 * 			<li>{@link RestContextBuilder#resourceResolver(Class)}
+					<li>{@link RestContextBuilder#resourceResolver(RestResourceResolver)}
+				</ul>
+	 * 	<li>Unless overridden, resource resolvers are inherited from parent resources.
+	 *	</ul>
+	 */
+	public static final String REST_resourceResolver = PREFIX + "resourceResolver.o";
+
+	/**
+	 * <b>Configuration property:</b>  Response handlers.
+	 *
+	 * <ul>
+	 * 	<li><b>Name:</b> <js>"RestContext.responseHandlers.lo"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;Class&lt;? <jk>extends</jk> ResponseHandler&gt;&gt;</code>
+	 * 	<li><b>Default:</b> empty list
+	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
+	 * </ul>
 	 * 
-	 * <h6 class='topic'>Notes:</h6>
+	 * <p>
+	 * Specifies a list of {@link ResponseHandler} classes that know how to convert POJOs returned by REST methods or
+	 * set via {@link RestResponse#setOutput(Object)} into appropriate HTTP responses.
+	 *
+	 * <p>
+	 * By default, the following response handlers are provided out-of-the-box:
+	 * <ul>
+	 * 	<li>{@link StreamableHandler}
+	 * 	<li>{@link WritableHandler}
+	 * 	<li>{@link ReaderHandler}
+	 * 	<li>{@link InputStreamHandler}
+	 * 	<li>{@link RedirectHandler}
+	 * 	<li>{@link DefaultHandler}
+	 * </ul>
+
+	 * <p>
+	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_useClasspathResourceCaching}
+	 * 	<li>Property:  {@link RestContext#REST_responseHandlers}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#useClasspathResourceCaching()} 
+	 * 			<li>{@link RestResource#responseHandlers()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#useClasspathResourceCaching(boolean)}
-	 * 		</ul>
-	 * </ul>
+	 * 			<li>{@link RestContextBuilder#responseHandlers(Class...)}
+					<li>{@link RestContextBuilder#responseHandlers(ResponseHandler...)}
+				</ul>
+	 * 	<li>{@link ResponseHandler} classes must have either a no-arg or {@link PropertyStore} argument constructors.
+	 *	</ul>
 	 */
-	public static final String REST_useClasspathResourceCaching = PREFIX + "useClasspathResourceCaching.b";
+	public static final String REST_responseHandlers = PREFIX + "responseHandlers.lo";
 
 	/**
-	 * <b>Configuration property:</b>  HTML Widgets. 
+	 * <b>Configuration property:</b>  Serializers. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.widgets.lo"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;Class&lt;? <jk>extends</jk> Widget&gt; | Widget&gt;</code>
+	 * 	<li><b>Name:</b> <js>"RestContext.serializers.lo"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;Class &lt;? <jk>extends</jk> Serializer&gt; | Serializer&gt;</code>
 	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Defines widgets that can be used in conjunction with string variables of the form <js>"$W{name}"</js>to quickly
-	 * generate arbitrary replacement text.
+	 * Adds class-level serializers to this resource.
 	 * 
-	 * Widgets resolve the following variables:
-	 * <ul>
-	 * 	<li><js>"$W{name}"</js> - Contents returned by {@link Widget#getHtml(RestRequest)}.
-	 * 	<li><js>"$W{name.script}"</js> - Contents returned by {@link Widget#getScript(RestRequest)}.
-	 * 		<br>The script contents are automatically inserted into the <xt>&lt;head/script&gt;</xt> section
-	 * 			 in the HTML page.
-	 * 	<li><js>"$W{name.style}"</js> - Contents returned by {@link Widget#getStyle(RestRequest)}.
-	 * 		<br>The styles contents are automatically inserted into the <xt>&lt;head/style&gt;</xt> section
-	 * 			 in the HTML page.
+	 * <h6 class='topic'>Notes:</h6>
+	 * <ul class='spaced-list'>
+	 * 	<li>Property:  {@link RestContext#REST_serializers}
+	 * 	<li>Annotations: 
+	 * 		<ul>
+	 * 			<li>{@link RestResource#serializers()} 
+	 * 			<li>{@link RestMethod#serializers()} 
+	 * 		</ul>
+	 * 	<li>Methods: 
+	 * 		<ul>
+	 * 			<li>{@link RestContextBuilder#serializers(Class...)}
+	 * 			<li>{@link RestContextBuilder#serializers(boolean,Class...)}
+	 * 			<li>{@link RestContextBuilder#serializers(Serializer...)}
+	 * 			<li>{@link RestContextBuilder#serializers(boolean,Serializer...)}
+	 * 		</ul>
+	 * 	<li>When defined as a class, properties/transforms defined on the resource/method are inherited.
+	 * 	<li>When defined as an instance, properties/transforms defined on the resource/method are NOT inherited.
 	 * </ul>
+	 */
+	public static final String REST_serializers = PREFIX + "serializers.lo";
+
+	/**
+	 * <b>Configuration property:</b>  Static file response headers. 
 	 *
+	 * <ul>
+	 * 	<li><b>Name:</b> <js>"RestContext.staticFileResponseHeaders.omo"</js>
+	 * 	<li><b>Data type:</b> <code>Map&lt;String,String&gt;</code>
+	 * 	<li><b>Default:</b> <code>{<js>'Cache-Control'</js>: <js>'max-age=86400, public</js>}</code>
+	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
+	 * </ul>
+	 * 
 	 * <p>
-	 * The following examples shows how to associate a widget with a REST method and then have it rendered in the links
-	 * and aside section of the page:
-	 *
-	 * <p class='bcode'>
-	 * 	<ja>@RestMethod</ja>(
-	 * 		widgets={
-	 * 			MyWidget.<jk>class</jk>
-	 * 		}
-	 * 		htmldoc=<ja>@HtmlDoc</ja>(
-	 * 			navlinks={
-	 * 				<js>"$W{MyWidget}"</js>
-	 * 			},
-	 * 			aside={
-	 * 				<js>"Check out this widget:  $W{MyWidget}"</js>
-	 * 			}
-	 * 		)
-	 * 	)
-	 * </p>
+	 * Used to customize the headers on responses returned for statically-served files.
 	 * 
 	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_widgets}
+	 * 	<li>Property:  {@link RestContext#REST_staticFileResponseHeaders}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link HtmlDoc#widgets()} 
+	 * 			<li>{@link RestResource#staticFileResponseHeaders()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#widgets(Class...)}
-	 * 			<li>{@link RestContextBuilder#widgets(Widget...)}
-	 * 			<li>{@link RestContextBuilder#widgets(boolean,Widget...)}
+	 * 			<li>{@link RestContextBuilder#staticFileResponseHeaders(boolean,Map)}
+	 * 			<li>{@link RestContextBuilder#staticFileResponseHeaders(String...)}
+	 * 			<li>{@link RestContextBuilder#staticFileResponseHeader(String,String)}
 	 * 		</ul>
-	 * 	<li>Widgets are inherited from parent to child, but can be overridden by reusing the widget name.
 	 * </ul>
 	 */
-	public static final String REST_widgets = PREFIX + "widgets.lo";
+	public static final String REST_staticFileResponseHeaders = PREFIX + "staticFileResponseHeaders.omo";
 	
 	/**
-	 * <b>Configuration property:</b>  MIME types. 
+	 * <b>Configuration property:</b>  Static file mappings. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.mimeTypes.ss"</js>
-	 * 	<li><b>Data type:</b> <code>Set&lt;String&gt;</code>
-	 * 	<li><b>Default:</b> empty list
+	 * 	<li><b>Name:</b> <js>"RestContext.staticFiles.lo"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;StaticFileMapping&gt;</code>
+	 * 	<li><b>Default:</b> <jk>null</jk>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Defines MIME-type file type mappings.
+	 * Used to define paths and locations of statically-served files such as images or HTML documents.
 	 * 
 	 * <p>
-	 * Used for specifying the content type on file resources retrieved through the following methods:
-	 * <ul>
-	 * 	<li>{@link RestContext#resolveStaticFile(String)}
-	 * 	<li>{@link RestRequest#getClasspathReaderResource(String,boolean,MediaType)}
-	 * 	<li>{@link RestRequest#getClasspathReaderResource(String,boolean)}
-	 * 	<li>{@link RestRequest#getClasspathReaderResource(String)}
-	 * </ul>
+	 * Static files are found by calling {@link #getClasspathResource(String,Locale)} which uses the registered 
+	 * {@link ClasspathResourceFinder} for locating files on the classpath (or other location).
+	 * 
+	 * <p>
+	 * An example where this class is used is in the {@link RestResource#staticFiles} annotation:
+	 * <p class='bcode'>
+	 * 	<jk>package</jk> com.foo.mypackage;
+	 * 
+	 * 	<ja>@RestResource</ja>(
+	 * 		path=<js>"/myresource"</js>,
+	 * 		staticFiles={<js>"htdocs:docs"</js>,<js>"styles:styles"</js>}
+	 * 	)
+	 * 	<jk>public class</jk> MyResource <jk>extends</jk> RestServletDefault {...}
+	 * </p>
 	 * 
 	 * <p>
-	 * This list appends to the existing list provided by {@link ExtendedMimetypesFileTypeMap}.
+	 * In the example above, given a GET request to <l>/myresource/htdocs/foobar.html</l>, the servlet will attempt to find 
+	 * the <l>foobar.html</l> file in the following ordered locations:
+	 * <ol>
+	 * 	<li><l>com.foo.mypackage.docs</l> package.
+	 * 	<li><l>org.apache.juneau.rest.docs</l> package (since <l>RestServletDefault</l> is in <l>org.apache.juneau.rest</l>).
+	 * 	<li><l>[working-dir]/docs</l> directory.
+	 * </ol>
 	 * 
 	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_mimeTypes}
+	 * 	<li>Property:  {@link RestContext#REST_staticFiles}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#mimeTypes()} 
+	 * 			<li>{@link RestResource#staticFiles()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#mimeTypes(String...)}
+	 * 			<li>{@link RestContextBuilder#staticFiles(String)},
+	 * 			<li>{@link RestContextBuilder#staticFiles(Class,String)}
+	 * 			<li>{@link RestContextBuilder#staticFiles(String,String)}
+	 * 			<li>{@link RestContextBuilder#staticFiles(Class,String,String)} 
+	 * 			<li>{@link RestContextBuilder#staticFiles(StaticFileMapping...)} 
 	 * 		</ul>
-	 * 	<li>Values are .mime.types formatted entry string.
-	 * 		<br>Example: <js>"image/svg+xml svg"</js>
+	 * 	<li>Mappings are cumulative from parent to child.  
+	 * 	<li>Child resources can override mappings made on parent resources.
+	 * 	<li>The media type on the response is determined by the {@link org.apache.juneau.rest.RestContext#getMediaTypeForName(String)} method.
+	 * 	<li>The resource finder is configured via the {@link #REST_classpathResourceFinder} setting, and can be
+	 * 		overridden to provide customized handling of resource retrieval.
+	 * 	<li>The {@link #REST_useClasspathResourceCaching} setting can be used to cache static files in memory
+	 * 		to improve performance.
 	 * </ul>
 	 */
-	public static final String REST_mimeTypes = PREFIX + "mimeTypes.ss";
-
+	public static final String REST_staticFiles = PREFIX + "staticFiles.lo";
+	
 	/**
-	 * <b>Configuration property:</b>  Serializers. 
+	 * <b>Configuration property:</b>  Supported accept media types.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.serializers.lo"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;Class &lt;? <jk>extends</jk> Serializer&gt; | Serializer&gt;</code>
+	 * 	<li><b>Name:</b> <js>"RestContext.supportedAcceptTypes.ls"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;String&gt;</code>
 	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Adds class-level serializers to this resource.
+	 * Overrides the media types inferred from the serializers that identify what media types can be produced by the resource.
 	 * 
-	 * <h6 class='topic'>Notes:</h6>
+	 * <p>
+	 * This affects the values returned by {@link RestRequest#getSupportedAcceptTypes()} and the supported accept
+	 * types shown in {@link RestInfoProvider#getSwagger(RestRequest)}.
+	 *
+	 * <p>
+	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_serializers}
-	 * 	<li>Annotations: 
+	 * 	<li>Property:  {@link RestContext#REST_supportedAcceptTypes}
+	 * 	<li>Annotations:
 	 * 		<ul>
-	 * 			<li>{@link RestResource#serializers()} 
-	 * 			<li>{@link RestMethod#serializers()} 
-	 * 		</ul>
-	 * 	<li>Methods: 
+	 * 			<li>{@link RestResource#supportedAcceptTypes()}
+	 * 			<li>{@link RestMethod#supportedAcceptTypes()}
+	 * 		</ul> 
+	 * 	<li>Methods:  
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#serializers(Class...)}
-	 * 			<li>{@link RestContextBuilder#serializers(boolean,Class...)}
-	 * 			<li>{@link RestContextBuilder#serializers(Serializer...)}
-	 * 			<li>{@link RestContextBuilder#serializers(boolean,Serializer...)}
+	 * 			<li>{@link RestContextBuilder#supportedAcceptTypes(boolean,String...)}
+	 * 			<li>{@link RestContextBuilder#supportedAcceptTypes(boolean,MediaType...)}
 	 * 		</ul>
-	 * 	<li>When defined as a class, properties/transforms defined on the resource/method are inherited.
-	 * 	<li>When defined as an instance, properties/transforms defined on the resource/method are NOT inherited.
-	 * </ul>
+	 *	</ul>
 	 */
-	public static final String REST_serializers = PREFIX + "serializers.lo";
+	public static final String REST_supportedAcceptTypes = PREFIX + "supportedAcceptTypes.ls";
 
 	/**
-	 * <b>Configuration property:</b>  Parsers. 
+	 * <b>Configuration property:</b>  Supported content media types.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.parsers.lo"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;Class &lt;? <jk>extends</jk> Parser&gt; | Parser&gt;</code>
+	 * 	<li><b>Name:</b> <js>"RestContext.supportedContentTypes.ls"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;String&gt;</code>
 	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Adds class-level parsers to this resource.
+	 * Overrides the media types inferred from the parsers that identify what media types can be consumed by the resource.
+	 *
+	 * <p>
+	 * This affects the values returned by {@link RestRequest#getSupportedContentTypes()} and the supported content
+	 * types shown in {@link RestInfoProvider#getSwagger(RestRequest)}.
 	 * 
-	 * <h6 class='topic'>Notes:</h6>
+	 * <p>
+	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_parsers}
-	 * 	<li>Annotations: 
+	 * 	<li>Property:  {@link RestContext#REST_supportedContentTypes}
+	 * 	<li>Annotations:
 	 * 		<ul>
-	 * 			<li>{@link RestResource#parsers()} 
-	 * 			<li>{@link RestMethod#parsers()} 
-	 * 		</ul>
-	 * 	<li>Methods: 
+	 * 			<li>{@link RestResource#supportedContentTypes()}
+	 * 			<li>{@link RestMethod#supportedContentTypes()}
+	 * 		</ul> 
+	 * 	<li>Methods:  
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#parsers(Class...)}
-	 * 			<li>{@link RestContextBuilder#parsers(boolean,Class...)}
-	 * 			<li>{@link RestContextBuilder#parsers(Parser...)}
-	 * 			<li>{@link RestContextBuilder#parsers(boolean,Parser...)}
+	 * 			<li>{@link RestContextBuilder#supportedContentTypes(boolean,String...)}
+	 * 			<li>{@link RestContextBuilder#supportedContentTypes(boolean,MediaType...)}
 	 * 		</ul>
-	 * 	<li>When defined as a class, properties/transforms defined on the resource/method are inherited.
-	 * 	<li>When defined as an instance, properties/transforms defined on the resource/method are NOT inherited.
-	 * </ul>
+	 *	</ul>
 	 */
-	public static final String REST_parsers = PREFIX + "parsers.lo";
-
+	public static final String REST_supportedContentTypes = PREFIX + "supportedContentTypes.ls";
+	
 	/**
-	 * <b>Configuration property:</b>  HTTP part serializer. 
+	 * <b>Configuration property:</b>  Use classpath resource caching. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.partSerializer.o"</js>
-	 * 	<li><b>Data type:</b> <code>Class &lt;? <jk>extends</jk> HttpPartSerializer&gt; | HttpPartSerializer</code>
-	 * 	<li><b>Default:</b> {@link SimpleUonPartSerializer}
+	 * 	<li><b>Name:</b> <js>"RestContext.useClasspathResourceCaching.b"</js>
+	 * 	<li><b>Data type:</b> <code>Boolean</code>
+	 * 	<li><b>Default:</b> <jk>true</jk>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * Specifies the {@link HttpPartSerializer} to use for serializing headers, query/form parameters, and URI parts.
-	 *
+	 * When enabled, resources retrieved via {@link RestContext#getClasspathResource(String, Locale)} (and related 
+	 * methods) will be cached in memory to speed subsequent lookups.
+	 * 
 	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_partSerializer}
+	 * 	<li>Property:  {@link RestContext#REST_useClasspathResourceCaching}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#partSerializer()} 
+	 * 			<li>{@link RestResource#useClasspathResourceCaching()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#partSerializer(Class)}
-	 * 			<li>{@link RestContextBuilder#partSerializer(HttpPartSerializer)}
+	 * 			<li>{@link RestContextBuilder#useClasspathResourceCaching(boolean)}
 	 * 		</ul>
-	 * 	<li>When defined as a class, properties/transforms defined on the resource/method are inherited.
-	 * 	<li>When defined as an instance, properties/transforms defined on the resource/method are NOT inherited.
 	 * </ul>
 	 */
-	public static final String REST_partSerializer = PREFIX + "partSerializer.o";
+	public static final String REST_useClasspathResourceCaching = PREFIX + "useClasspathResourceCaching.b";
 
 	/**
-	 * <b>Configuration property:</b>  HTTP part parser. 
+	 * <b>Configuration property:</b>  Use stack trace hashes.
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.partParser.o"</js>
-	 * 	<li><b>Data type:</b> <code>Class &lt;? <jk>extends</jk> HttpPartParser&gt; | HttpPartParser</code>
-	 * 	<li><b>Default:</b> {@link UonPartParser}
+	 * 	<li><b>Name:</b> <js>"RestContext.useStackTraceHashes.b"</js>
+	 * 	<li><b>Data type:</b> <code>Boolean</code>
+	 * 	<li><b>Default:</b> <jk>true</jk>
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
-	 * 
+	 *
 	 * <p>
-	 * Specifies the {@link HttpPartParser} to use for parsing headers, query/form parameters, and URI parts.
-	 * 
-	 * <h6 class='topic'>Notes:</h6>
+	 * When enabled, the number of times an exception has occurred will be determined based on stack trace hashsums,
+	 * made available through the {@link RestException#getOccurrence()} method.
+	 *
+	 * <h5 class='section'>Notes:</h5>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_partParser}
-	 * 	<li>Annotations: 
+	 * 	<li>Property:  {@link RestContext#REST_useStackTraceHashes}
+	 * 	<li>Annotations:  
 	 * 		<ul>
-	 * 			<li>{@link RestResource#partParser()} 
+	 * 			<li>{@link RestResource#useStackTraceHashes()}
 	 * 		</ul>
-	 * 	<li>Methods: 
+	 * 	<li>Methods:  
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#partParser(Class)}
-	 * 			<li>{@link RestContextBuilder#partParser(HttpPartParser)}
+	 * 			<li>{@link RestContextBuilder#useStackTraceHashes(boolean)}
 	 * 		</ul>
-	 * 	<li>When defined as a class, properties/transforms defined on the resource/method are inherited.
-	 * 	<li>When defined as an instance, properties/transforms defined on the resource/method are NOT inherited.
-	 * </ul>
+	 *	</ul>
 	 */
-	public static final String REST_partParser = PREFIX + "partParser.o";
-
+	public static final String REST_useStackTraceHashes = PREFIX + "useStackTraceHashes.b";
+	
 	/**
-	 * <b>Configuration property:</b>  Compression encoders. 
+	 * <b>Configuration property:</b>  HTML Widgets. 
 	 *
 	 * <ul>
-	 * 	<li><b>Name:</b> <js>"RestContext.encoders.o"</js>
-	 * 	<li><b>Data type:</b> <code>List&lt;Class &lt;? <jk>extends</jk> Encoder&gt; | Encoder&gt;</code>
+	 * 	<li><b>Name:</b> <js>"RestContext.widgets.lo"</js>
+	 * 	<li><b>Data type:</b> <code>List&lt;Class&lt;? <jk>extends</jk> Widget&gt; | Widget&gt;</code>
 	 * 	<li><b>Default:</b> empty list
 	 * 	<li><b>Session-overridable:</b> <jk>false</jk>
 	 * </ul>
 	 * 
 	 * <p>
-	 * These can be used to enable various kinds of compression (e.g. <js>"gzip"</js>) on requests and responses.
+	 * Defines widgets that can be used in conjunction with string variables of the form <js>"$W{name}"</js>to quickly
+	 * generate arbitrary replacement text.
+	 * 
+	 * Widgets resolve the following variables:
+	 * <ul>
+	 * 	<li><js>"$W{name}"</js> - Contents returned by {@link Widget#getHtml(RestRequest)}.
+	 * 	<li><js>"$W{name.script}"</js> - Contents returned by {@link Widget#getScript(RestRequest)}.
+	 * 		<br>The script contents are automatically inserted into the <xt>&lt;head/script&gt;</xt> section
+	 * 			 in the HTML page.
+	 * 	<li><js>"$W{name.style}"</js> - Contents returned by {@link Widget#getStyle(RestRequest)}.
+	 * 		<br>The styles contents are automatically inserted into the <xt>&lt;head/style&gt;</xt> section
+	 * 			 in the HTML page.
+	 * </ul>
+	 *
+	 * <p>
+	 * The following examples shows how to associate a widget with a REST method and then have it rendered in the links
+	 * and aside section of the page:
 	 *
-	 * <h5 class='section'>Example:</h5>
 	 * <p class='bcode'>
-	 * 	<jc>// Servlet with automated support for GZIP compression</jc>
-	 * 	<ja>@RestResource</ja>(encoders={GzipEncoder.<jk>class</jk>})
-	 * 	<jk>public</jk> MyRestServlet <jk>extends</jk> RestServlet {
-	 * 		...
-	 * 	}
+	 * 	<ja>@RestMethod</ja>(
+	 * 		widgets={
+	 * 			MyWidget.<jk>class</jk>
+	 * 		}
+	 * 		htmldoc=<ja>@HtmlDoc</ja>(
+	 * 			navlinks={
+	 * 				<js>"$W{MyWidget}"</js>
+	 * 			},
+	 * 			aside={
+	 * 				<js>"Check out this widget:  $W{MyWidget}"</js>
+	 * 			}
+	 * 		)
+	 * 	)
 	 * </p>
 	 * 
 	 * <h6 class='topic'>Notes:</h6>
 	 * <ul class='spaced-list'>
-	 * 	<li>Property:  {@link RestContext#REST_encoders}
+	 * 	<li>Property:  {@link RestContext#REST_widgets}
 	 * 	<li>Annotations: 
 	 * 		<ul>
-	 * 			<li>{@link RestResource#encoders()} 
-	 * 			<li>{@link RestMethod#encoders()} 
+	 * 			<li>{@link HtmlDoc#widgets()} 
 	 * 		</ul>
 	 * 	<li>Methods: 
 	 * 		<ul>
-	 * 			<li>{@link RestContextBuilder#encoders(Class...)}
-	 * 			<li>{@link RestContextBuilder#encoders(Encoder...)}
+	 * 			<li>{@link RestContextBuilder#widgets(Class...)}
+	 * 			<li>{@link RestContextBuilder#widgets(Widget...)}
+	 * 			<li>{@link RestContextBuilder#widgets(boolean,Widget...)}
 	 * 		</ul>
-	 * 	<li>Instance classes must provide a public no-arg constructor, or a public constructor that takes in a
-	 * 		{@link PropertyStore} object.
-	 * 	<li>Instance class can be defined as an inner class of the REST resource class.
+	 * 	<li>Widgets are inherited from parent to child, but can be overridden by reusing the widget name.
 	 * </ul>
 	 */
-	public static final String REST_encoders = PREFIX + "encoders.lo";
-
+	public static final String REST_widgets = PREFIX + "widgets.lo";
+	
 	
 	//-------------------------------------------------------------------------------------------------------------------
 	// Instance
@@ -1442,7 +1442,7 @@ public final class RestContext extends BeanContext {
 			defaultResponseHeaders = getMapProperty(REST_defaultResponseHeaders, Object.class);
 			staticFileResponseHeaders = getMapProperty(REST_staticFileResponseHeaders, Object.class);	
 			
-			logger = getInstanceProperty(REST_logger, resource, RestLogger.class, RestLogger.NoOp.class, false);
+			logger = getInstanceProperty(REST_logger, resource, RestLogger.class, RestLogger.NoOp.class, true, ps);
 
 			varResolver = builder.varResolverBuilder
 				.vars(
@@ -1472,7 +1472,7 @@ public final class RestContext extends BeanContext {
 			partSerializer = getInstanceProperty(REST_partSerializer, HttpPartSerializer.class, SimpleUonPartSerializer.class, true, resource, ps);
 			partParser = getInstanceProperty(REST_partSerializer, HttpPartParser.class, UonPartParser.class, true, resource, ps);
 			encoders = new EncoderGroupBuilder().append(getInstanceArrayProperty(REST_encoders, Encoder.class, new Encoder[0], true, resource, ps)).build();
-			beanContext = BeanContext.create().apply(ps).add(properties).build();
+			beanContext = BeanContext.create().apply(ps).build();
 
 			mimetypesFileTypeMap = new ExtendedMimetypesFileTypeMap();
 			for (String mimeType : getArrayProperty(REST_mimeTypes, String.class))
@@ -1505,7 +1505,7 @@ public final class RestContext extends BeanContext {
 			this.childResources = Collections.synchronizedMap(new LinkedHashMap<String,RestContext>());  // Not unmodifiable on purpose so that children can be replaced.
 			
 			Map<String,Widget> _widgets = new LinkedHashMap<>();
-			for (Widget w : getInstanceArrayProperty(REST_widgets, Widget.class, new Widget[0], true, resource, ps))
+			for (Widget w : getInstanceArrayProperty(REST_widgets, resource, Widget.class, new Widget[0], true, ps))
 				_widgets.put(w.getName(), w);
 			this.widgets = Collections.unmodifiableMap(_widgets);
 
@@ -1534,13 +1534,13 @@ public final class RestContext extends BeanContext {
 				_postInitChildFirstMethodParams = new ArrayList<>(),
 				_destroyMethodParams = new ArrayList<>();
 
-			for (java.lang.reflect.Method method : resource.getClass().getMethods()) {
+			for (java.lang.reflect.Method method : resourceClass.getMethods()) {
 				if (method.isAnnotationPresent(RestMethod.class)) {
 					RestMethod a = method.getAnnotation(RestMethod.class);
 					methodsFound.add(method.getName() + "," + a.name() + "," + a.path());
 					try {
 						if (! Modifier.isPublic(method.getModifiers()))
-							throw new RestServletException("@RestMethod method {0}.{1} must be defined as public.", this.getClass().getName(), method.getName());
+							throw new RestServletException("@RestMethod method {0}.{1} must be defined as public.", resourceClass.getName(), method.getName());
 
 						CallMethod sm = new CallMethod(resource, method, this);
 						String httpMethod = sm.getHttpMethod();
@@ -1602,12 +1602,12 @@ public final class RestContext extends BeanContext {
 							addToRouter(routers, httpMethod, sm);
 						}
 					} catch (RestServletException e) {
-						throw new RestServletException("Problem occurred trying to serialize methods on class {0}, methods={1}", this.getClass().getName(), JsonSerializer.DEFAULT_LAX.serialize(methodsFound)).initCause(e);
+						throw new RestServletException("Problem occurred trying to serialize methods on class {0}, methods={1}", resourceClass.getName(), JsonSerializer.DEFAULT_LAX.serialize(methodsFound)).initCause(e);
 					}
 				}
 			}
 
-			for (Method m : ClassUtils.getAllMethods(resource.getClass(), true)) {
+			for (Method m : ClassUtils.getAllMethods(resourceClass, true)) {
 				if (ClassUtils.isPublic(m) && m.isAnnotationPresent(RestHook.class)) {
 					HookEvent he = m.getAnnotation(RestHook.class).value();
 					String sig = ClassUtils.getMethodSignature(m);
@@ -1700,7 +1700,7 @@ public final class RestContext extends BeanContext {
 			this.callRouters = Collections.unmodifiableMap(_callRouters);
 
 			// Initialize our child resources.
-			resourceResolver = getInstanceProperty(REST_resourceResolver, resource, RestResourceResolver.class, parentContext == null ? RestResourceResolverSimple.class : parentContext.resourceResolver, true, this);
+			resourceResolver = getInstanceProperty(REST_resourceResolver, resource, RestResourceResolver.class, parentContext == null ? RestResourceResolverSimple.class : parentContext.resourceResolver, true, this, ps);
 			for (Object o : builder.childResources) {
 				String path = null;
 				Object r = null;
@@ -1740,8 +1740,8 @@ public final class RestContext extends BeanContext {
 				childResources.put(path, rc2);
 			}
 
-			callHandler = getInstanceProperty(REST_callHandler, resource, RestCallHandler.class, RestCallHandler.class, true, this);
-			infoProvider = getInstanceProperty(REST_infoProvider, resource, RestInfoProvider.class, RestInfoProvider.class, true, this);
+			callHandler = getInstanceProperty(REST_callHandler, resource, RestCallHandler.class, RestCallHandler.class, true, this, ps);
+			infoProvider = getInstanceProperty(REST_infoProvider, resource, RestInfoProvider.class, RestInfoProvider.class, true, this, ps);
 
 		} catch (RestException e) {
 			_initException = e;
@@ -1760,27 +1760,6 @@ public final class RestContext extends BeanContext {
 		routers.get(httpMethodName).add(cm);
 	}
 
-	static final boolean getBoolean(Object o, String systemProperty, boolean def) {
-		if (o == null)
-			o = SystemUtils.getFirstBoolean(def, systemProperty);
-		return "true".equalsIgnoreCase(o.toString());
-	}
-
-	static final String getString(Object o, String systemProperty, String def) {
-		if (o == null)
-			o = SystemUtils.getFirstString(def, systemProperty);
-		return o.toString();
-	}
-
-	static final long getLong(Object o, String systemProperty, long def) {
-		String s = StringUtils.toString(o);
-		if (s == null)
-			s = System.getProperty(systemProperty);
-		if (StringUtils.isEmpty(s))
-			return def;
-		return StringUtils.parseLongWithSuffix(s);
-	}
-
 	/**
 	 * Returns the resource resolver associated with this context.
 	 *
@@ -1849,9 +1828,12 @@ public final class RestContext extends BeanContext {
 	 * The following is the default list of supported variables:
 	 * <ul>
 	 * 	<li><code>$C{key[,defaultValue]}</code> - Config file entry. See {@link ConfigFileVar}.
+	 * 	<li><code>$CO{arg1[,arg2...]}</code> - Coalesce variable. See {@link CoalesceVar}.
+	 * 	<li><code>$CR{arg1[,arg2...]}</code> - Coalesce-and-recurse variable. See {@link CoalesceAndRecurseVar}.
 	 * 	<li><code>$E{envVar[,defaultValue]}</code> - Environment variable. See {@link EnvVariablesVar}.
 	 * 	<li><code>$F{path[,defaultValue]}</code> - File resource. See {@link FileVar}.
 	 * 	<li><code>$I{name[,defaultValue]}</code> - Servlet init parameter. See {@link ServletInitParamVar}.
+	 * 	<li><code>$IF{booleanArg,thenValue[,elseValue]}</code> - If/else variable. See {@link IfVar}.
 	 * 	<li><code>$L{key[,args...]}</code> - Localized message. See {@link LocalizationVar}.
 	 * 	<li><code>$RA{key1[,key2...]}</code> - Request attribute variable. See {@link RequestAttributeVar}.
 	 * 	<li><code>$RF{key1[,key2...]}</code> - Request form-data variable. See {@link RequestFormDataVar}.
@@ -1861,21 +1843,13 @@ public final class RestContext extends BeanContext {
 	 * 	<li><code>$R{key1[,key2...]}</code> - Request object variable. See {@link RequestVar}.
 	 * 	<li><code>$S{systemProperty[,defaultValue]}</code> - System property. See {@link SystemPropertiesVar}.
 	 * 	<li><code>$SA{contentType,key[,defaultValue]}</code> - Serialized request attribute. See {@link SerializedRequestAttrVar}.
+	 * 	<li><code>$SW{stringArg(,pattern,thenValue)+[,elseValue]}</code> - Switch variable. See {@link SwitchVar}.
 	 * 	<li><code>$U{uri}</code> - URI resolver. See {@link UrlVar}.
 	 * 	<li><code>$UE{uriPart}</code> - URL-Encoder. See {@link UrlEncodeVar}.
 	 * 	<li><code>$W{widgetName}</code> - HTML widget variable. See {@link WidgetVar}.
 	 * </ul>
 	 *
 	 * <p>
-	 * The following syntax variables are also provided:
-	 * <ul>
-	 * 	<li><code>$CO{string1[,string2...]}</code> - Coalesce variable. See {@link CoalesceVar}.
-	 * 	<li><code>$CR{string1[,string2...]}</code> - Coalesce-and-recurse variable. See {@link CoalesceAndRecurseVar}.
-	 * 	<li><code>$IF{booleanArg,thenValue[,elseValue]}</code> - If/else variable. See {@link IfVar}.
-	 * 	<li><code>$SW{stringArg(,pattern,thenValue)+[,elseValue]}</code> - Switch variable. See {@link SwitchVar}.
-	 * </ul>
-	 *
-	 * <p>
 	 * The list of variables can be extended using the {@link RestContextBuilder#vars(Class...)} method.
 	 * For example, this is used to add support for the Args and Manifest-File variables in the microservice
 	 * <code>Resource</code> class.
@@ -2855,21 +2829,6 @@ public final class RestContext extends BeanContext {
 		return null;
 	}
 
-	//----------------------------------------------------------------------------------------------------
-	// Utility methods
-	//----------------------------------------------------------------------------------------------------
-
-	/**
-	 * Takes in an object of type T or a Class<T> and either casts or constructs a T.
-	 */
-	static final <T> T resolve(Object outer, Class<T> c, Object o, Object...cArgs) throws RestServletException {
-		try {
-			return ClassUtils.newInstanceFromOuter(outer, c, o, true, cArgs);
-		} catch (Exception e) {
-			throw new RestServletException("Exception occurred while constructing class ''{0}''", c).initCause(e);
-		}
-	}
-
 	@Override /* BeanContextBuilder */
 	public BeanSession createSession(BeanSessionArgs args) {
 		throw new NoSuchMethodError();

http://git-wip-us.apache.org/repos/asf/juneau/blob/30ac20a1/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
index 70ec0db..8a3d14c 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
@@ -35,7 +35,6 @@ import org.apache.juneau.internal.*;
 import org.apache.juneau.parser.*;
 import org.apache.juneau.rest.annotation.*;
 import org.apache.juneau.rest.response.*;
-import org.apache.juneau.rest.vars.*;
 import org.apache.juneau.rest.widget.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.svl.*;
@@ -149,7 +148,9 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon
 					EnvVariablesVar.class,
 					ConfigFileVar.class,
 					IfVar.class,
-					SwitchVar.class
+					SwitchVar.class,
+					CoalesceVar.class,
+					CoalesceAndRecurseVar.class
 				);
 
 			VarResolver vr = varResolverBuilder.build();
@@ -327,26 +328,7 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon
 	 * used to resolve string variables of the form <js>"$X{...}"</js>.
 	 *
 	 * <p>
-	 * By default, this config includes the following variables:
-	 * <ul>
-	 * 	<li>{@link SystemPropertiesVar}
-	 * 	<li>{@link EnvVariablesVar}
-	 * 	<li>{@link ConfigFileVar}
-	 * 	<li>{@link IfVar}
-	 * 	<li>{@link SwitchVar}
-	 * </ul>
-	 *
-	 * <p>
-	 * Later during the construction of {@link RestContext}, we add the following variables:
-	 * <ul>
-	 * 	<li>{@link LocalizationVar}
-	 * 	<li>{@link RequestVar}
-	 * 	<li>{@link SerializedRequestAttrVar}
-	 * 	<li>{@link ServletInitParamVar}
-	 * 	<li>{@link UrlVar}
-	 * 	<li>{@link UrlEncodeVar}
-	 * 	<li>{@link WidgetVar}
-	 * </ul>
+	 * See {@link RestContext#getVarResolver()} for a list of predefined variables.
 	 *
 	 * @param vars The {@link Var} classes to add to this config.
 	 * @return This object (for method chaining).


Mime
View raw message