Repository: incubator-juneau
Updated Branches:
  refs/heads/master 6e47b7ff9 -> bed066ee0


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/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 ef8aed8..1658dd9 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
@@ -67,8 +67,7 @@ class CallMethod implements Comparable<CallMethod>  {
        private final Response[] responses;
        private final RestContext context;
        private final BeanContext beanContext;
-       final String htmlTitle, htmlDescription, htmlBranding, htmlHeader, 
htmlNav, htmlAside,
-               htmlFooter, htmlStyle, htmlStylesheet, htmlScript, 
htmlNoResultsMessage;
+       final String htmlHeader, htmlNav, htmlAside, htmlFooter, htmlStyle, 
htmlStylesheet, htmlScript, htmlNoResultsMessage;
        final String[] htmlLinks;
        final boolean htmlNoWrap;
        final HtmlDocTemplate htmlTemplate;
@@ -104,9 +103,6 @@ class CallMethod implements Comparable<CallMethod>  {
                this.priority = b.priority;
                this.parameters = b.parameters;
                this.responses = b.responses;
-               this.htmlTitle = b.htmlTitle;
-               this.htmlDescription = b.htmlDescription;
-               this.htmlBranding = b.htmlBranding;
                this.htmlHeader = b.htmlHeader;
                this.htmlLinks = b.htmlLinks;
                this.htmlNav = b.htmlNav;
@@ -122,8 +118,8 @@ class CallMethod implements Comparable<CallMethod>  {
        }
 
        private static class Builder  {
-               private String httpMethod, defaultCharset, description, tags, 
summary, externalDocs, htmlTitle, htmlDescription,
-                       htmlBranding, htmlNav, htmlAside, htmlFooter, 
htmlStyle, htmlStylesheet, htmlScript, htmlHeader, htmlNoResultsMessage;
+               private String httpMethod, defaultCharset, description, tags, 
summary, externalDocs, htmlNav, htmlAside,
+                       htmlFooter, htmlStyle, htmlStylesheet, htmlScript, 
htmlHeader, htmlNoResultsMessage;
                private String[] htmlLinks;
                private boolean htmlNoWrap;
                private HtmlDocTemplate htmlTemplate;
@@ -182,9 +178,6 @@ class CallMethod implements Comparable<CallMethod>  {
                                        Widget w = 
ClassUtils.newInstance(Widget.class, wc);
                                        htmlWidgets.put(w.getName(), w);
                                }
-                               htmlTitle = hd.title().isEmpty() ? 
context.getHtmlTitle() : hd.title();
-                               htmlDescription = hd.description().isEmpty() ? 
context.getHtmlDescription() : hd.description();
-                               htmlBranding = hd.branding().length == 0 ? 
context.getHtmlBranding() : join(hd.branding(), '\n');
                                htmlHeader = hd.header().length == 0 ? 
context.getHtmlHeader() : join(hd.header(), '\n');
                                htmlLinks = hd.links().length == 0 ? 
context.getHtmlLinks() : hd.links();
                                htmlNav = hd.nav().length == 0 ? 
context.getHtmlNav() : join(hd.nav(), '\n');

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/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 ee2272e..eec40ed 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
@@ -244,4 +244,22 @@ public class ReaderResource implements Writable {
                }
                return sw.toString();
        }
+
+       /**
+        * Same as {@link #toString()} but strips comments from the text before 
returning it.
+        *
+        * <p>
+        * Supports stripping comments from the following media types: HTML, 
XHTML, XML, JSON, Javascript, CSS.
+        *
+        * @return The resource contents stripped of any comments.
+        */
+       public String toCommentStrippedString() {
+               String s = toString();
+               String subType = mediaType.getSubType();
+               if ("html".equals(subType) || "xhtml".equals(subType) || 
"xml".equals(subType))
+                       s = s.replaceAll("(?s)<!--(.*?)-->\\s*", "");
+               else if ("json".equals(subType) || "javascript".equals(subType) 
|| "css".equals(subType))
+                       s.replaceAll("(?s)\\/\\*(.*?)\\*\\/\\s*", "");
+               return s;
+       }
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/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 7034a71..38ec9f5 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
@@ -38,6 +38,7 @@ import org.apache.juneau.rest.widget.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.svl.*;
 import org.apache.juneau.svl.vars.*;
+import org.apache.juneau.utils.*;
 
 /**
  * Defines the initial configuration of a <code>RestServlet</code> or 
<code>@RestResource</code> annotated object.
@@ -103,7 +104,7 @@ public class RestConfig implements ServletConfig {
        EncoderGroupBuilder encoders = new 
EncoderGroupBuilder().append(IdentityEncoder.INSTANCE);
        List<Object> converters = new ArrayList<Object>();
        List<Object> guards = new ArrayList<Object>();
-       MimetypesFileTypeMap mimeTypes = new MimetypesFileTypeMap();
+       MimetypesFileTypeMap mimeTypes = new ExtendedMimetypesFileTypeMap();
        Map<String,String> defaultRequestHeaders = new 
TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
        Map<String,Object> defaultResponseHeaders = new 
LinkedHashMap<String,Object>();
        List<Object> responseHandlers = new ArrayList<Object>();
@@ -112,8 +113,7 @@ public class RestConfig implements ServletConfig {
        Object favIcon;
        List<Object> staticFiles;
        RestContext parentContext;
-       String path, htmlTitle, htmlDescription, htmlBranding, htmlHeader, 
htmlNav, htmlAside, htmlFooter,
-               htmlStyle, htmlStylesheet, htmlScript, htmlNoResultsMessage;
+       String path, htmlHeader, htmlNav, htmlAside, htmlFooter, htmlStyle, 
htmlStylesheet, htmlScript, htmlNoResultsMessage;
        String[] htmlLinks;
        String clientVersionHeader = "X-Client-Version";
 
@@ -223,12 +223,6 @@ public class RestConfig implements ServletConfig {
                                HtmlDoc hd = r.htmldoc();
                                for (Class<? extends Widget> cw : hd.widgets())
                                        addHtmlWidget(cw);
-                               if (! hd.title().isEmpty())
-                                       setHtmlTitle(hd.title());
-                               if (! hd.description().isEmpty())
-                                       setHtmlDescription(hd.description());
-                               if (hd.branding().length > 0)
-                                       setHtmlBranding(join(hd.branding(), 
'\n'));
                                if (hd.header().length > 0)
                                        setHtmlHeader(join(hd.header(), '\n'));
                                if (hd.links().length != 0)
@@ -262,16 +256,6 @@ public class RestConfig implements ServletConfig {
                                DefaultHandler.class
                        );
 
-                       addMimeTypes(
-                               "text/css css CSS",
-                               "text/html html htm HTML",
-                               "text/plain txt text TXT",
-                               "application/javascript js",
-                               "image/png png",
-                               "image/gif gif",
-                               "application/xml xml XML",
-                               "application/json json JSON"
-                       );
                } catch (Exception e) {
                        throw new ServletException(e);
                }
@@ -678,23 +662,12 @@ public class RestConfig implements ServletConfig {
         * <p>
         * Refer to {@link MimetypesFileTypeMap#addMimeTypes(String)} for an 
explanation of the format.
         *
-        * <p>
-        * By default, this config includes the following mime-type definitions:
-        * <ul>
-        *      <li><js>"text/css css CSS"</js>
-        *      <li><js>"text/html html htm HTML"</js>
-        *      <li><js>"text/plain txt text TXT"</js>
-        *      <li><js>"application/javascript js"</js>
-        *      <li><js>"image/png png"</js>
-        *      <li><js>"image/gif gif"</js>
-        *      <li><js>"application/xml xml XML"</js>
-        *      <li><js>"application/json json JSON"</js>
-        * </ul>
-        *
         * @param mimeTypes The MIME-types to add to this config.
         * @return This object (for method chaining).
         */
        public RestConfig addMimeTypes(String...mimeTypes) {
+               if (this.mimeTypes == ExtendedMimetypesFileTypeMap.DEFAULT)
+                       this.mimeTypes = new ExtendedMimetypesFileTypeMap();
                for (String mimeType : mimeTypes)
                        this.mimeTypes.addMimeTypes(mimeType);
                return this;
@@ -1099,124 +1072,6 @@ public class RestConfig implements ServletConfig {
        }
 
        /**
-        * Sets the HTML page title.
-        *
-        * <p>
-        * The format of this value is plain text.
-        *
-        * <p>
-        * It gets wrapped in a <code><xt>&lt;h1&gt;</xt></code> element and 
then added
-        * to the <code><xt>&lt;header&gt;</code> section on the page.
-        *
-        * <p>
-        * If not specified, the page title is pulled from one of the following 
locations:
-        * <ol>
-        *      <li><code>{servletClass}.{methodName}.pageTitle</code> resource 
bundle value.
-        *      <li><code>{servletClass}.pageTitle</code> resource bundle value.
-        *      <li><code><ja>@RestResource</ja>(title)</code> annotation.
-        *      <li><code>{servletClass}.title</code> resource bundle value.
-        *      <li><code>info/title</code> entry in swagger file.
-        * </ol>
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <ul class='doctree'>
-        *      <li class='info'>
-        *              In most cases, you'll simply want to use the 
<code>@RestResource(title)</code> annotation to specify the
-        *              page title.
-        *              However, this annotation is provided in cases where you 
want the page title to be different that the one
-        *              shown in the swagger document.
-        * </ul>
-        *
-        * <p>
-        * This is the programmatic equivalent to the {@link HtmlDoc#title() 
@HtmlDoc.title()} annotation.
-        *
-        * @param value The HTML page title.
-        * @return This object (for method chaining).
-        */
-       public RestConfig setHtmlTitle(String value) {
-               this.htmlTitle = value;
-               return this;
-       }
-
-       /**
-        * Sets the HTML page description.
-        *
-        * <p>
-        * The format of this value is plain text.
-        *
-        * <p>
-        * It gets wrapped in a <code><xt>&lt;h2&gt;</xt></code> element and 
then
-        * added to the <code><xt>&lt;header&gt;</code> section on the page.
-        *
-        * <p>
-        * If not specified, the page title is pulled from one of the following 
locations:
-        * <ol>
-        *      <li><code>{servletClass}.{methodName}.pageText</code> resource 
bundle value.
-        *      <li><code>{servletClass}.pageText</code> resource bundle value.
-        *      <li><code><ja>@RestMethod</ja>(summary)</code> annotation.
-        *      <li><code>{servletClass}.{methodName}.summary</code> resource 
bundle value.
-        *      <li><code>summary</code> entry in swagger file for method.
-        *      <li><code>{servletClass}.description</code> resource bundle 
value.
-        *      <li><code>info/description</code> entry in swagger file.
-        * </ol>
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <ul class='doctree'>
-        *      <li class='info'>
-        *              In most cases, you'll simply want to use the 
<code>@RestResource(description)</code> or
-        *              <code>@RestMethod(summary)</code> annotations to 
specify the page text.
-        *              However, this annotation is provided in cases where you 
want the text to be different that the values shown
-        *              in the swagger document.
-        * </ul>
-        *
-        * <p>
-        * This is the programmatic equivalent to the {@link 
HtmlDoc#description() @HtmlDoc.description()} annotation.
-        *
-        * @param value The HTML page description.
-        * @return This object (for method chaining).
-        */
-       public RestConfig setHtmlDescription(String value) {
-               this.htmlDescription = value;
-               return this;
-       }
-
-       /**
-        * Sets the HTML page branding in the header section of the page 
generated by the default HTML doc template.
-        *
-        * <p>
-        * The format of this value is HTML.
-        *
-        * <p>
-        * This is arbitrary HTML that can be added to the header section to 
provide basic custom branding on the page.
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <p>
-        * This is the programmatic equivalent to the {@link HtmlDoc#branding() 
@HtmlDoc.branding()} annotation.
-        *
-        * @param value The HTML page branding.
-        * @return This object (for method chaining).
-        */
-       public RestConfig setHtmlBranding(String value) {
-               this.htmlBranding = value;
-               return this;
-       }
-
-       /**
         * Sets the HTML header section contents.
         *
         * <p>
@@ -1227,10 +1082,6 @@ public class RestConfig implements ServletConfig {
         * to be whatever you want.
         *
         * <p>
-        * When a value is specified, the {@link #setHtmlTitle(String)} and 
{@link #setHtmlDescription(String)} values will
-        * be ignored.
-        *
-        * <p>
         * A value of <js>"NONE"</js> can be used to force no header.
         *
         * <p>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/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 f7ae070..116bd79 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
@@ -44,6 +44,7 @@ import org.apache.juneau.rest.vars.*;
 import org.apache.juneau.rest.widget.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.svl.*;
+import org.apache.juneau.svl.vars.*;
 import org.apache.juneau.urlencoding.*;
 import org.apache.juneau.utils.*;
 
@@ -242,9 +243,6 @@ public final class RestContext extends Context {
                paramFormat,
                clientVersionHeader,
                fullPath,
-               htmlTitle,
-               htmlDescription,
-               htmlBranding,
                htmlHeader,
                htmlNav,
                htmlAside,
@@ -358,9 +356,6 @@ public final class RestContext extends Context {
                        this.fullPath = b.fullPath;
 
                        this.htmlWidgets = 
Collections.unmodifiableMap(b.htmlWidgets);
-                       this.htmlTitle = b.htmlTitle;
-                       this.htmlDescription = b.htmlDescription;
-                       this.htmlBranding = b.htmlBranding;
                        this.htmlHeader = b.htmlHeader;
                        this.htmlLinks = b.htmlLinks;
                        this.htmlNav = b.htmlNav;
@@ -545,8 +540,8 @@ public final class RestContext extends Context {
                UrlEncodingSerializer urlEncodingSerializer;
                UrlEncodingParser urlEncodingParser;
                EncoderGroup encoders;
-               String clientVersionHeader = "", defaultCharset, paramFormat, 
htmlTitle, htmlDescription, htmlBranding,
-                       htmlHeader, htmlNav, htmlAside, htmlStyle, 
htmlStylesheet, htmlScript, htmlFooter, htmlNoResultsMessage;
+               String clientVersionHeader = "", defaultCharset, paramFormat, 
htmlHeader, htmlNav, htmlAside, htmlStyle,
+                               htmlStylesheet, htmlScript, htmlFooter, 
htmlNoResultsMessage;
                String[] htmlLinks;
                boolean htmlNoWrap;
                HtmlDocTemplate htmlTemplate;
@@ -589,7 +584,7 @@ public final class RestContext extends Context {
                                        allowMethodParams.add(m.toUpperCase());
 
                        varResolver = sc.varResolverBuilder
-                               .vars(LocalizationVar.class, RequestVar.class, 
SerializedRequestAttrVar.class, ServletInitParamVar.class, UrlVar.class, 
UrlEncodeVar.class, WidgetVar.class)
+                               .vars(FileVar.class, LocalizationVar.class, 
RequestVar.class, SerializedRequestAttrVar.class, ServletInitParamVar.class, 
UrlVar.class, UrlEncodeVar.class, WidgetVar.class)
                                .build()
                        ;
                        configFile = 
sc.configFile.getResolving(this.varResolver);
@@ -679,9 +674,6 @@ public final class RestContext extends Context {
                        fullPath = (sc.parentContext == null ? "" : 
(sc.parentContext.fullPath + '/')) + sc.path;
 
                        htmlWidgets = sc.htmlWidgets;
-                       htmlTitle = sc.htmlTitle;
-                       htmlDescription = sc.htmlDescription;
-                       htmlBranding = sc.htmlBranding;
                        htmlHeader = sc.htmlHeader;
                        htmlLinks = sc.htmlLinks;
                        htmlNav = sc.htmlNav;
@@ -701,6 +693,8 @@ public final class RestContext extends Context {
         *
         * <p>
         * Variable resolvers are used to replace variables in property values.
+        * They can be nested arbitrarily deep.
+        * They can also return values that themselves contain other variables.
         *
         * <h6 class='figure'>Example:</h6>
         * <p class='bcode'>
@@ -711,7 +705,7 @@ public final class RestContext extends Context {
         *                      
<ja>@Property</ja>(name=<js>"javaVendor"</js>,value=<js>"$S{java.vendor,Oracle}"</js>),
  <jc>// System property with default value</jc>
         *                      
<ja>@Property</ja>(name=<js>"foo"</js>,value=<js>"bar"</js>),
         *                      
<ja>@Property</ja>(name=<js>"bar"</js>,value=<js>"baz"</js>),
-        *                      
<ja>@Property</ja>(name=<js>"v1"</js>,value=<js>"$R{foo}"</js>),  <jc>// 
Request variable. value="bar"</jc>
+        *                      
<ja>@Property</ja>(name=<js>"v1"</js>,value=<js>"$R{foo}"</js>),  <jc>// 
Request variable.  value="bar"</jc>
         *                      
<ja>@Property</ja>(name=<js>"v2"</js>,value=<js>"$R{$R{foo}}"</js>)  <jc>// 
Nested request variable. value="baz"</jc>
         *              }
         *      )
@@ -719,22 +713,49 @@ public final class RestContext extends Context {
         * </p>
         *
         * <p>
-        * A typical usage pattern is using variables for resolving URL links 
when rendering HTML:
+        * A typical usage pattern involves using variables inside the {@link 
HtmlDoc} annotation:
         * <p class='bcode'>
         *      <ja>@RestMethod</ja>(
         *              name=<js>"GET"</js>, path=<js>"/{name}/*"</js>,
-        *              properties={
-        *                      <ja>@Property</ja>(
-        *                              name=<jsf>HTMLDOC_links</jsf>,
-        *                              value=<js>"{up:'$R{requestParentURI}', 
options:'servlet:/?method=OPTIONS', 
editLevel:'servlet:/editLevel?logger=$R{attribute.name}'}"</js>
-        *                      )
-        *              }
+        *              htmldoc=@HtmlDoc(
+        *                      links={
+        *                              <js>"up: $R{requestParentURI}"</js>,
+        *                              <js>"options: 
servlet:/?method=OPTIONS"</js>,
+        *                              <js>"editLevel: 
servlet:/editLevel?logger=$A{attribute.name, OFF}"</js>
+        *                      }
+        *                      header={
+        *                              "<h1>$L{MyLocalizedPageTitle}"</js>
+        *                      },
+        *                      aside={
+        *                              <js>"$F{resources/AsideText.html}"</js>
+        *                      }
+        *              )
         *      )
         *      <jk>public</jk> LoggerEntry getLogger(RestRequest req, 
<ja>@Path</ja> String name) <jk>throws</jk> Exception {
         * </p>
         *
         * <p>
-        * Calls to <code>req.getProperties().getString(<js>"key"</js>)</code> 
returns strings with variables resolved.
+        * The following is the default list of supported variables:
+        * <ul>
+        *      <li><code>$S{systemProperty[,defaultValue]}</code> - System 
property. See {@link SystemPropertiesVar}.
+        *      <li><code>$E{envVar[,defaultValue]}</code> - Environment 
variable. See {@link EnvVariablesVar}.
+        *      <li><code>$C{key[,defaultValue]}</code> - Config file entry. 
See {@link ConfigFileVar}.
+        *      <li><code>$F{key[,defaultValue]}</code> - File resource. See 
{@link FileVar}.
+        *      <li><code>$L{key[,args...]}</code> - Localized message. See 
{@link LocalizationVar}.
+        *      <li><code>$R{key[,args...]}</code> - Request variable. See 
{@link RequestVar}.
+        *      <li><code>$SA{contentType,key[,defaultValue]}</code> - 
Serialized request attribute. See {@link SerializedRequestAttrVar}.
+        *      <li><code>$I{key[,defaultValue]}</code> - Servlet init 
parameter. See {@link ServletInitParamVar}.
+        *      <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}.
+        *      <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}.
+        * <p>
+        *
+        * <p>
+        * The list of variables can be extended using the {@link 
RestConfig#addVars(Class...)} method.
+        * For example, this is used to add support for the Args and 
Manifest-File variables in the microservice
+        * <code>Resource</code> class.
         *
         * @return The var resolver in use by this resource.
         */
@@ -894,42 +915,6 @@ public final class RestContext extends Context {
        }
 
        /**
-        * The HTML page title.
-        *
-        * <p>
-        * Defined by the {@link HtmlDoc#title()} annotation or {@link 
RestConfig#setHtmlTitle(String)} method.
-        *
-        * @return The HTML page title.
-        */
-       public String getHtmlTitle() {
-               return htmlTitle;
-       }
-
-       /**
-        * The HTML page description.
-        *
-        * <p>
-        * Defined by the {@link HtmlDoc#description()} annotation or {@link 
RestConfig#setHtmlDescription(String)} method.
-        *
-        * @return The HTML page description.
-        */
-       public String getHtmlDescription() {
-               return htmlDescription;
-       }
-
-       /**
-        * The HTML page branding.
-        *
-        * <p>
-        * Defined by the {@link HtmlDoc#branding()} annotation or {@link 
RestConfig#setHtmlBranding(String)} method.
-        *
-        * @return The HTML page description.
-        */
-       public String getHtmlBranding() {
-               return htmlBranding;
-       }
-
-       /**
         * The HTML page header contents.
         *
         * <p>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/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 00f70b5..b54cdd5 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
@@ -258,8 +258,6 @@ public final class RestRequest extends 
HttpServletRequestWrapper {
         *                      <br>Valid names:
         *                      <ul>
         *                              <li><js>"aside"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_aside}
-        *                              <li><js>"branding"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_branding}
-        *                              <li><js>"description"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_description}
         *                              <li><js>"footer"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_footer}
         *                              <li><js>"header"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_header}
         *                              <li><js>"links.list"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_links}
@@ -270,7 +268,6 @@ public final class RestRequest extends 
HttpServletRequestWrapper {
         *                              <li><js>"style.list"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_style}
         *                              <li><js>"stylesheet"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_stylesheet}
         *                              <li><js>"template"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_template}
-        *                              <li><js>"title"</js> - See {@link 
HtmlDocSerializerContext#HTMLDOC_title}
         *                      </ul>
         *              <li>
         *                      <js>"Path"</js> - Value returned by {@link 
RestRequest#getPath(String)}.
@@ -314,19 +311,6 @@ public final class RestRequest extends 
HttpServletRequestWrapper {
                                if (c2 == 'a') {
                                        if ("aside".equals(name))
                                                return cm.htmlAside == null ? 
null : resolveVars(cm.htmlAside);
-                               } else if (c2 == 'b') {
-                                       if ("branding".equals(name))
-                                               return cm.htmlBranding == null 
? null : resolveVars(cm.htmlBranding);
-                               } else if (c2 == 'd') {
-                                       if ("description".equals(name)) {
-                                               String s = cm.htmlDescription;
-                                               if (! StringUtils.isEmpty(s))
-                                                       return resolveVars(s);
-                                               s = getMethodSummary();
-                                               if (StringUtils.isEmpty(s))
-                                                       s = 
getServletDescription();
-                                               return s;
-                                       }
                                } else if (c2 == 'f') {
                                        if ("footer".equals(name))
                                                return cm.htmlFooter == null ? 
null : resolveVars(cm.htmlFooter);
@@ -404,12 +388,6 @@ public final class RestRequest extends 
HttpServletRequestWrapper {
                                } else if (c2 == 't') {
                                        if ("template".equals(name))
                                                return cm.htmlTemplate;
-                                       if ("title".equals(name)) {
-                                               String s = cm.htmlTitle;
-                                               if (! StringUtils.isEmpty(s))
-                                                       return resolveVars(s);
-                                               return getServletTitle();
-                                       }
                                }
                        }
                } else if (c == 'P') {
@@ -1018,6 +996,9 @@ public final class RestRequest extends 
HttpServletRequestWrapper {
         * Returns the variable resolver session for this request using session 
objects created by
         * {@link RestCallHandler#getSessionObjects(RestRequest)}.
         *
+        * <p>
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
+        *
         * @return The variable resolver for this request.
         */
        public VarResolverSession getVarResolverSession() {
@@ -1044,6 +1025,7 @@ public final class RestRequest extends 
HttpServletRequestWrapper {
         * @param resolveVars
         *      If <jk>true</jk>, any {@link 
org.apache.juneau.rest.annotation.Parameter} variables will be
         *      resolved by the variable resolver returned by {@link 
#getVarResolverSession()}.
+        *      <br>See {@link RestContext#getVarResolver()} for the list of 
supported variables.
         * @param mediaType The value to set as the <js>"Content-Type"</js> 
header for this object.
         * @return A new reader resource, or <jk>null</jk> if resource could 
not be found.
         * @throws IOException
@@ -1066,6 +1048,7 @@ public final class RestRequest extends 
HttpServletRequestWrapper {
         * @param resolveVars
         *      If <jk>true</jk>, any {@link 
org.apache.juneau.rest.annotation.Parameter} variables will be
         *      resolved by the variable resolver returned by {@link 
#getVarResolverSession()}.
+        *      <br>See {@link RestContext#getVarResolver()} for the list of 
supported variables.
         * @return A new reader resource, or <jk>null</jk> if resource could 
not be found.
         * @throws IOException
         */

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/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 958707a..e252285 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
@@ -438,139 +438,6 @@ public final class RestResponse extends 
HttpServletResponseWrapper {
        }
 
        /**
-        * Sets the HTML page title.
-        *
-        * <p>
-        * The format of this value is plain text.
-        *
-        * <p>
-        * It gets wrapped in a <code><xt>&lt;h1&gt;</xt></code> element and 
then added
-        * to the <code><xt>&lt;header&gt;</code> section on the page.
-        *
-        * <p>
-        * If not specified, the page title is pulled from one of the following 
locations:
-        * <ol>
-        *      <li><code>{servletClass}.{methodName}.pageTitle</code> resource 
bundle value.
-        *      <li><code>{servletClass}.pageTitle</code> resource bundle value.
-        *      <li><code><ja>@RestResource</ja>(title)</code> annotation.
-        *      <li><code>{servletClass}.title</code> resource bundle value.
-        *      <li><code>info/title</code> entry in swagger file.
-        * </ol>
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <ul class='doctree'>
-        *      <li class='info'>
-        *              In most cases, you'll simply want to use the 
<code>@RestResource(title)</code> annotation to specify the
-        *              page title.
-        *              However, this annotation is provided in cases where you 
want the page title to be different that the one
-        *              shown in the swagger document.
-        * </ul>
-        *
-        * <p>
-        * This is the programmatic equivalent to the {@link HtmlDoc#title() 
@HtmlDoc.title()} annotation.
-        *
-        * @param value
-        *      The HTML page title.
-        *      Object will be converted to a string using {@link 
Object#toString()}.
-        *      <p>
-        *      <ul class='doctree'>
-        *              <li class='info'>
-        *                      <b>Tip:</b>  Use {@link StringMessage} to 
generate value with delayed serialization so as not to
-        *                              waste string concatenation cycles on 
non-HTML views.
-        *      </ul>
-        * @return This object (for method chaining).
-        */
-       public RestResponse setHtmlTitle(Object value) {
-               return setProperty(HtmlDocSerializerContext.HTMLDOC_title, 
value);
-       }
-
-       /**
-        * Sets the HTML page description.
-        *
-        * <p>
-        * The format of this value is plain text.
-        *
-        * <p>
-        * It gets wrapped in a <code><xt>&lt;h2&gt;</xt></code> element and 
then
-        * added to the <code><xt>&lt;header&gt;</code> section on the page.
-        *
-        * <p>
-        * If not specified, the page title is pulled from one of the following 
locations:
-        * <ol>
-        *      <li><code>{servletClass}.{methodName}.pageText</code> resource 
bundle value.
-        *      <li><code>{servletClass}.pageText</code> resource bundle value.
-        *      <li><code><ja>@RestMethod</ja>(summary)</code> annotation.
-        *      <li><code>{servletClass}.{methodName}.summary</code> resource 
bundle value.
-        *      <li><code>summary</code> entry in swagger file for method.
-        *      <li><code>{servletClass}.description</code> resource bundle 
value.
-        *      <li><code>info/description</code> entry in swagger file.
-        * </ol>
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <ul class='doctree'>
-        *      <li class='info'>
-        *              In most cases, you'll simply want to use the 
<code>@RestResource(description)</code> or
-        *              <code>@RestMethod(summary)</code> annotations to 
specify the page text.
-        *              However, this annotation is provided in cases where you 
want the text to be different that the values shown
-        *              in the swagger document.
-        * </ul>
-        *
-        * <p>
-        * This is the programmatic equivalent to the {@link 
HtmlDoc#description() @HtmlDoc.description()} annotation.
-        *
-        * @param value
-        *      The HTML page description.
-        *      Object will be converted to a string using {@link 
Object#toString()}.
-        *      <p>
-        *      <ul class='doctree'>
-        *              <li class='info'>
-        *                      <b>Tip:</b>  Use {@link StringMessage} to 
generate value with delayed serialization so as not to
-        *                              waste string concatenation cycles on 
non-HTML views.
-        *      </ul>
-        * @return This object (for method chaining).
-        */
-       public RestResponse setHtmlDescription(Object value) {
-               return 
setProperty(HtmlDocSerializerContext.HTMLDOC_description, value);
-       }
-
-       /**
-        * Sets the HTML page branding in the header section of the page 
generated by the default HTML doc template.
-        *
-        * <p>
-        * The format of this value is HTML.
-        *
-        * <p>
-        * This is arbitrary HTML that can be added to the header section to 
provide basic custom branding on the page.
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <p>
-        * This is the programmatic equivalent to the {@link HtmlDoc#branding() 
@HtmlDoc.branding()} annotation.
-        *
-        * @param value
-        *      The HTML page branding.
-        *      Object will be converted to a string using {@link 
Object#toString()}.
-        * @return This object (for method chaining).
-        */
-       public RestResponse setHtmlBranding(Object value) {
-               return setProperty(HtmlDocSerializerContext.HTMLDOC_branding, 
value);
-       }
-
-       /**
         * Sets the HTML header section contents.
         *
         * <p>
@@ -581,10 +448,6 @@ public final class RestResponse extends 
HttpServletResponseWrapper {
         * to be whatever you want.
         *
         * <p>
-        * When a value is specified, the {@link #setHtmlTitle(Object)} and 
{@link #setHtmlDescription(Object)} values will
-        * be ignored.
-        *
-        * <p>
         * A value of <js>"NONE"</js> can be used to force no header.
         *
         * <p>
@@ -605,7 +468,7 @@ public final class RestResponse extends 
HttpServletResponseWrapper {
         * @return This object (for method chaining).
         */
        public RestResponse setHtmlHeader(Object value) {
-               return setProperty(HtmlDocSerializerContext.HTMLDOC_title, 
value);
+               return setProperty(HtmlDocSerializerContext.HTMLDOC_header, 
value);
        }
 
        /**

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/RestServletDefault.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/RestServletDefault.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/RestServletDefault.java
index d158783..926b277 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestServletDefault.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestServletDefault.java
@@ -190,7 +190,11 @@ import org.apache.juneau.xml.*;
                @Property(name=REST_allowMethodParam, value="OPTIONS"),
        },
        htmldoc=@HtmlDoc(
-               branding="<a href='http://juneau.apache.org'><img 
src='$U{servlet:/htdocs/juneau.png}' 
style='position:absolute;top:5;right:5;background-color:transparent;height:30px'></a>",
+               header={
+                       "<h1>$R{servletTitle}</h1>",
+                       "<h2>$R{methodSummary,$R{servletDescription}}</h2>",
+                       "<a href='http://juneau.apache.org'><img 
src='$U{servlet:/htdocs/juneau.png}' 
style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/></a>"
+               },
                stylesheet="servlet:/styles/devops.css"
        ),
 
@@ -212,14 +216,13 @@ public abstract class RestServletDefault extends 
RestServlet {
        @RestMethod(name="OPTIONS", path="/*",
                htmldoc=@HtmlDoc(
                        links={
-                               "back: servlet:/,",
+                               "back: servlet:/",
                                "json: 
servlet:/?method=OPTIONS&Accept=text/json&plainText=true"
                        },
-                       description="Swagger documentation",
                        aside="NONE"
                ),
-               summary="Resource options",
-               description="Swagger documentation"
+               summary="Swagger documentation",
+               description="Auto-generated swagger documentation for this 
resource"
        )
        public Swagger getOptions(RestRequest req) {
                return req.getSwagger();

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java
index f1a5608..955c2d8 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/HtmlDoc.java
@@ -56,9 +56,7 @@ import org.apache.juneau.rest.widget.*;
  *             &lt;/head&gt;
  *             &lt;body&gt;
  *                     &lt;header&gt;
- *                             &lt;h1&gt;<xv>Page title</xv>&lt;/h1&gt;
- *                             &lt;h2&gt;<xv>Page description</xv>&lt;/h2&gt;
- *                             <xv>Arbitrary page branding</xv>
+ *                             <xv>Page header</xv>
  *                     &lt;/header&gt;
  *                     &lt;nav&gt;
  *                             <xv>Page links</xv>
@@ -79,118 +77,6 @@ import org.apache.juneau.rest.widget.*;
 public @interface HtmlDoc {
 
        /**
-        * Sets the HTML page title in the header section of the page generated 
by the default HTML doc template.
-        *
-        * <p>
-        * The format of this value is HTML (phrasing content only).
-        *
-        * <p>
-        * It gets wrapped in a <code><xt>&lt;h1&gt;</xt></code> element and 
then added
-        * to the <code><xt>&lt;header&gt;</code> section on the page.
-        *
-        * <p>
-        * If not specified, the page title is pulled from one of the following 
locations:
-        * <ol>
-        *      <li><code>{servletClass}.{methodName}.title</code> resource 
bundle value.
-        *      <li><code>{servletClass}.title</code> resource bundle value.
-        *      <li><code><ja>@RestResource</ja>(title)</code> annotation.
-        *      <li><code>{servletClass}.title</code> resource bundle value.
-        *      <li><code>info/title</code> entry in swagger file.
-        * </ol>
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <ul class='doctree'>
-        *      <li class='info'>
-        *              In most cases, you'll simply want to use the 
<code>@RestResource(title)</code> annotation to specify the
-        *              page title.
-        *              However, this annotation is provided in cases where you 
want the page title to be different that the one
-        *              shown in the swagger document.
-        *      <li class='info'>
-        *              The entire header section can be rendered with 
arbitrary HTML using {@link #header()}.
-        *              This annotation is ignored when the {@link #header()} 
annotation is specified.
-        * </ul>
-        *
-        * <p>
-        * The programmatic equivalent to this annotation are the
-        * {@link RestConfig#setHtmlTitle(String)}/{@link 
RestResponse#setHtmlTitle(Object)} methods.
-        */
-       String title() default "";
-
-       /**
-        * Sets the HTML page subtitle in the header section of the page 
generated by the default HTML doc template.
-        *
-        * <p>
-        * The format of this value is HTML (phrasing content only).
-        *
-        * <p>
-        * It gets wrapped in a <code><xt>&lt;h2&gt;</xt></code> element and 
then
-        * added to the <code><xt>&lt;header&gt;</code> section on the page.
-        *
-        * <p>
-        * If not specified, the page title is pulled from one of the following 
locations:
-        * <ol>
-        *      <li><code>{servletClass}.{methodName}.summary</code> resource 
bundle value.
-        *      <li><code>{servletClass}.summary</code> resource bundle value.
-        *      <li><code><ja>@RestMethod</ja>(summary)</code> annotation.
-        *      <li><code>{servletClass}.{methodName}.summary</code> resource 
bundle value.
-        *      <li><code>summary</code> entry in swagger file for method.
-        *      <li><code>{servletClass}.description</code> resource bundle 
value.
-        *      <li><code>info/description</code> entry in swagger file.
-        * </ol>
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <ul class='doctree'>
-        *      <li class='info'>
-        *              In most cases, you'll simply want to use the 
<code>@RestResource(description)</code> or
-        *              <code>@RestMethod(summary)</code> annotations to 
specify the page text.
-        *              However, this annotation is provided in cases where you 
want the text to be different that the values shown
-        *              in the swagger document.
-        *      <li class='info'>
-        *              The entire header section can be rendered with 
arbitrary HTML using {@link #header()}.
-        *              This annotation is ignored when the {@link #header()} 
annotation is specified.
-        * </ul>
-        *
-        * <p>
-        * The programmatic equivalent to this annotation are the
-        * {@link RestConfig#setHtmlDescription(String)}/{@link 
RestResponse#setHtmlDescription(Object)} methods.
-        */
-       String description() default "";
-
-       /**
-        * Sets the HTML page branding in the header section of the page 
generated by the default HTML doc template.
-        *
-        * <p>
-        * The format of this value is HTML.
-        *
-        * <p>
-        * This is arbitrary HTML that can be added to the header section to 
provide basic custom branding on the page.
-        *
-        * <p>
-        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
-        *
-        * <p>
-        * A value of <js>"NONE"</js> can be used to force no value.
-        *
-        * <p>
-        * Multiple values are combined with newlines into a single string.
-        *
-        * <p>
-        * The programmatic equivalent to this annotation are the
-        * {@link RestConfig#setHtmlBranding(String)}/{@link 
RestResponse#setHtmlBranding(Object)} methods.
-        */
-       String[] branding() default {};
-
-       /**
         * Sets the HTML header section contents.
         *
         * <p>
@@ -212,13 +98,11 @@ public @interface HtmlDoc {
         * </p>
         *
         * <p>
-        * When a value is specified, the {@link #title()} and {@link 
#description()} values will be ignored.
-        *
-        * <p>
         * A value of <js>"NONE"</js> can be used to force no header.
         *
         * <p>
         * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Multiple values are combined with newlines into a single string.
@@ -257,6 +141,7 @@ public @interface HtmlDoc {
         *
         * <p>
         * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * A value of <js>"NONE"</js> can be used to force no value.
@@ -298,6 +183,7 @@ public @interface HtmlDoc {
         *
         * <p>
         * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * A value of <js>"NONE"</js> can be used to force no value.
@@ -333,6 +219,7 @@ public @interface HtmlDoc {
         *
         * <p>
         * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * A value of <js>"NONE"</js> can be used to force no value.
@@ -368,6 +255,7 @@ public @interface HtmlDoc {
         *
         * <p>
         * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * A value of <js>"NONE"</js> can be used to force no value.
@@ -401,6 +289,7 @@ public @interface HtmlDoc {
         *
         * <p>
         * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * A value of <js>"NONE"</js> can be used to force no value.
@@ -438,6 +327,7 @@ public @interface HtmlDoc {
         * <p>
         * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>) and can use URL protocols defined
         * by {@link UriResolver}.
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * The programmatic equivalent to this annotation are the
@@ -464,6 +354,7 @@ public @interface HtmlDoc {
         *
         * <p>
         * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * A value of <js>"NONE"</js> can be used to force no value.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java
 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java
index 8aaa396..66c6bd4 100644
--- 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java
+++ 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/MethodSwagger.java
@@ -12,6 +12,8 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.rest.annotation;
 
+import org.apache.juneau.rest.*;
+
 /**
  * Extended annotation for {@link RestMethod#swagger() RestMethod.swagger()}.
  */
@@ -48,7 +50,8 @@ public @interface MethodSwagger {
         * </p>
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field 
<code>/paths/{path}/{method}/externalDocs</code>.
@@ -80,7 +83,8 @@ public @interface MethodSwagger {
         * </p>
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field 
<code>/paths/{path}/{method}/tags</code>.
@@ -108,7 +112,8 @@ public @interface MethodSwagger {
         * </p>
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field 
<code>/paths/{path}/{method}/deprecated</code>.
@@ -154,7 +159,8 @@ public @interface MethodSwagger {
         * English), and use resource bundles if you need to support 
localization.
         *
         * <p>
-        * These annotations can contain variables (e.g. 
"$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field 
<code>/paths/{path}/{method}/parameters</code>.
@@ -201,7 +207,8 @@ public @interface MethodSwagger {
         * English), and use resource bundles if you need to support 
localization.
         *
         * <p>
-        * These annotations can contain variables (e.g. 
"$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         */
        Response[] responses() default {};
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/ResourceSwagger.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/ResourceSwagger.java
 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/ResourceSwagger.java
index e30c4f1..366f40a 100644
--- 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/ResourceSwagger.java
+++ 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/ResourceSwagger.java
@@ -20,15 +20,21 @@ import org.apache.juneau.rest.*;
 public @interface ResourceSwagger {
        /**
         * Optional servlet terms-of-service for this API.
+        *
         * <p>
         * It is used to populate the Swagger terms-of-service field.
+        *
         * <p>
         * The default value pulls the description from the 
<code>termsOfService</code> entry in the servlet resource bundle.
         * (e.g. <js>"termsOfService = foo"</js> or 
<js>"MyServlet.termsOfService = foo"</js>).
+        *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
+        *
         * <p>
         * Corresponds to the swagger field <code>/info/termsOfService</code>.
+        *
         * <p>
         * The programmatic equivalent to this annotation is the {@link 
RestInfoProvider#getTermsOfService(RestRequest)}
         * method.
@@ -66,7 +72,8 @@ public @interface ResourceSwagger {
         * </p>
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field <code>/info/contact</code>.
@@ -106,7 +113,8 @@ public @interface ResourceSwagger {
         * </p>
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field <code>/info/license</code>.
@@ -127,7 +135,8 @@ public @interface ResourceSwagger {
         * (e.g. <js>"version = 2.0"</js> or <js>"MyServlet.version = 
2.0"</js>).
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field <code>/info/version</code>.
@@ -173,7 +182,8 @@ public @interface ResourceSwagger {
         * </p>
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field <code>/tags</code>.
@@ -213,7 +223,8 @@ public @interface ResourceSwagger {
         * </p>
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field <code>/tags</code>.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java
index 9758cfd..ea20632 100644
--- 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java
+++ 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java
@@ -500,7 +500,8 @@ public @interface RestMethod {
         * servlet resource bundle. (e.g. <js>"MyClass.myMethod.summary = 
foo"</js> or <js>"myMethod.summary = foo"</js>).
         *
         * <p>
-        * This field value can contain variables (e.g. 
"$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field 
<code>/paths/{path}/{method}/summary</code>.
@@ -527,7 +528,8 @@ public @interface RestMethod {
         * <js>"myMethod.description = foo"</js>).
         *
         * <p>
-        * This field value can contain variables (e.g. 
"$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field 
<code>/paths/{path}/{method}/description</code>.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestResource.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
index ec2d91c..0d24ac4 100644
--- 
a/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
+++ 
b/juneau-rest/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
@@ -426,7 +426,8 @@ public @interface RestResource {
         * This value can be retrieved programmatically through the {@link 
RestRequest#getSiteName()} method.
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * The programmatic equivalent to this annotation is the {@link 
RestInfoProvider#getSiteName(RestRequest)} method.
@@ -437,7 +438,7 @@ public @interface RestResource {
         * Optional servlet title.
         *
         * <p>
-        * It is used to populate the Swagger title field and as a default 
value for the {@link HtmlDoc#title()} value.
+        * It is used to populate the Swagger title field.
         * This value can be retrieved programmatically through the {@link 
RestRequest#getServletTitle()} method.
         *
         * <p>
@@ -445,7 +446,8 @@ public @interface RestResource {
         * (e.g. <js>"title = foo"</js> or <js>"MyServlet.title = foo"</js>).
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field <code>/info/title</code>.
@@ -459,8 +461,7 @@ public @interface RestResource {
         * Optional servlet description.
         *
         * <p>
-        * It is used to populate the Swagger description field and as a 
default value for the {@link HtmlDoc#description()}
-        * value.
+        * It is used to populate the Swagger description field.
         * This value can be retrieved programmatically through the {@link 
RestRequest#getServletDescription()} method.
         *
         * <p>
@@ -468,7 +469,8 @@ public @interface RestResource {
         * (e.g. <js>"description = foo"</js> or <js>"MyServlet.description = 
foo"</js>).
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * Corresponds to the swagger field <code>/info/description</code>.
@@ -485,7 +487,8 @@ public @interface RestResource {
         * The configuration file .
         *
         * <p>
-        * This field can contain variables (e.g. "$L{my.localized.variable}").
+        * This field can contain variables (e.g. 
<js>"$L{my.localized.variable}"</js>).
+        * See {@link RestContext#getVarResolver()} for the list of supported 
variables.
         *
         * <p>
         * The programmatic equivalent to this annotation is the {@link 
RestConfig#setConfigFile(ConfigFile)} method.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/jena/RestServletJenaDefault.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/jena/RestServletJenaDefault.java
 
b/juneau-rest/src/main/java/org/apache/juneau/rest/jena/RestServletJenaDefault.java
index beb0231..8780662 100644
--- 
a/juneau-rest/src/main/java/org/apache/juneau/rest/jena/RestServletJenaDefault.java
+++ 
b/juneau-rest/src/main/java/org/apache/juneau/rest/jena/RestServletJenaDefault.java
@@ -245,7 +245,11 @@ import org.apache.juneau.xml.*;
                @Property(name=REST_allowMethodParam, value="OPTIONS")
        },
        htmldoc=@HtmlDoc(
-               branding="<a href='http://juneau.apache.org'><img 
src='$U{servlet:/htdocs/juneau.png}' 
style='position:absolute;top:5;right:5;background-color:transparent;height:30px'></a>",
+               header={
+                       "<h1>$R{servletTitle}</h1>",
+                       "<h2>$R{methodSummary,$R{servletDescription}}</h2>",
+                       "<a href='http://juneau.apache.org'><img 
src='$U{servlet:/htdocs/juneau.png}' 
style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/></a>"
+               },
                stylesheet="servlet:/styles/devops.css"
        ),
        favicon="htdocs/juneau.png",
@@ -266,11 +270,10 @@ public abstract class RestServletJenaDefault extends 
RestServlet {
                                "back: servlet:/",
                                "json: 
servlet:/?method=OPTIONS&Accept=text/json&plainText=true"
                        },
-                       description="Swagger documentation",
                        aside="NONE"
                ),
-               summary="Resource options",
-               description="Swagger documentation"
+               summary="Swagger documentation",
+               description="Auto-generated swagger documentation for this 
resource"
        )
        public Swagger getOptions(RestRequest req) {
                return req.getSwagger();

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/vars/FileVar.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/FileVar.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/FileVar.java
new file mode 100644
index 0000000..d728ca8
--- /dev/null
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/FileVar.java
@@ -0,0 +1,87 @@
+// 
***************************************************************************************************************************
+// * 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.vars;
+
+import org.apache.juneau.rest.*;
+import org.apache.juneau.svl.*;
+import org.apache.juneau.utils.*;
+
+/**
+ * File resource variable resolver
+ *
+ * <p>
+ * The format for this var is <js>"$F{path[,defaultValue]}"</js>.
+ *
+ * <p>
+ * File variables resolve to the contents of resource files located on the 
classpath or local JVM directory.
+ * They use the {@link RestRequest#getReaderResource(String)} method to 
retrieve the contents of the file.
+ * That in turn uses the {@link ResourceFinder} associated with the servlet 
class to find the file.
+ *
+ * <p>
+ * The {@link ResourceFinder} is similar to {@link 
Class#getResourceAsStream(String)} except if it doesn't find the
+ * resource on this class, it searches up the parent hierarchy chain.
+ *
+ * <p>
+ * If the resource cannot be found in the classpath, then an attempt is made 
to look in the JVM working directory.
+ * <br>Path traversals outside the working directory are not allowed for 
security reasons.
+
+ * <p>
+ * Localized resources (based on the locale of the HTTP request) are supported.
+ * For example, if looking for the resource <js>"MyResource.txt"</js> for the 
Japanese locale, we will look for
+ * files in the following order:
+ * <ol>
+ *     <li><js>"MyResource_ja_JP.txt"</js>
+ *     <li><js>"MyResource_ja.txt"</js>
+ *     <li><js>"MyResource.txt"</js>
+ * </ol>
+ *
+ * <p class='bcode'>
+ *     <ja>@RestResource</ja>(
+ *             htmldoc=<ja>@HtmlDoc</ja>(
+ *                     aside=<js>"$F{resources/MyAsideMessage.html, Oops not 
found!}"</js>
+ *             )
+ *     )
+ * </p>
+ *
+ * <p>
+ * Files of type HTML, JSON, Javascript, or CSS will be stripped of comments.
+ * This allows you to place license headers in files without them being 
serialized to the output.
+ *
+ * @see org.apache.juneau.svl
+ */
+public class FileVar extends DefaultingVar {
+
+       /**
+        * The name of the session or context object that identifies the {@link 
RestRequest} object.
+        */
+       public static final String SESSION_req = "req";
+
+       /**
+        * The name of this variable.
+        */
+       public static final String NAME = "F";
+
+       /**
+        * Constructor.
+        */
+       public FileVar() {
+               super(NAME);
+       }
+
+       @Override /* Parameter */
+       public String resolve(VarResolverSession session, String key) throws 
Exception {
+               RestRequest req = session.getSessionObject(RestRequest.class, 
SESSION_req);
+               ReaderResource rr = req.getReaderResource(key);
+               return (rr == null ? null : rr.toCommentStrippedString());
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/vars/LocalizationVar.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/LocalizationVar.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/LocalizationVar.java
index c518793..43e15c9 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/LocalizationVar.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/LocalizationVar.java
@@ -21,7 +21,7 @@ import org.apache.juneau.svl.*;
  * Localized string variable resolver.
  *
  * <p>
- * The format for this var is <js>"$L{key}"</js> or <js>"$L{key,args...}"</js>.
+ * The format for this var is <js>"$L{key[,args...]}"</js>.
  *
  * <p>
  * This variable resolver requires that a {@link RestRequest} object be set as 
a context object on the resolver or a

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/vars/RequestVar.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/RequestVar.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/RequestVar.java
index dc49fe8..550a57e 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/RequestVar.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/RequestVar.java
@@ -12,6 +12,8 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.rest.vars;
 
+import javax.servlet.http.*;
+
 import org.apache.juneau.*;
 import org.apache.juneau.rest.*;
 import org.apache.juneau.svl.*;
@@ -20,22 +22,30 @@ import org.apache.juneau.svl.*;
  * Request attribute variable resolver.
  *
  * <p>
- * The format for this var is <js>"$R{key}"</js>.
+ * The format for this var is <js>"$R{key[,defaultValue]}"</js>.
+ * 
+ * <p>
  * The possible values are:
  * <ul>
- *     <li><code>$R{contextPath}</code> - Value returned by {@link 
RestRequest#getContextPath()}.
- *     <li><code>$R{method}</code> - Value returned by {@link 
RestRequest#getMethod()}.
- *     <li><code>$R{methodDescription}</code> - Value returned by {@link 
RestRequest#getMethodDescription()}.
- *     <li><code>$R{pathInfo}</code> - Value returned by {@link 
RestRequest#getPathInfo()}.
- *     <li><code>$R{requestParentURI}</code> - Value returned by {@link 
UriContext#getRootRelativePathInfoParent()}.
- *     <li><code>$R{requestURI}</code> - Value returned by {@link 
RestRequest#getRequestURI()}.
- *     <li><code>$R{servletDescription}</code> - Value returned by {@link 
RestRequest#getServletDescription()}.
- *     <li><code>$R{servletTitle}</code> - Value returned by {@link 
RestRequest#getServletTitle()}.
- *     <li><code>$R{servletParentURI}</code> - Value returned by {@link 
UriContext#getRootRelativeServletPathParent()}.
- *     <li><code>$R{servletPath}</code> - Value returned by {@link 
RestRequest#getServletPath()}.
- *     <li><code>$R{servletURI}</code> - Value returned by {@link 
UriContext#getRootRelativeServletPath()}.
+ *     <li><js>"contextPath"</js> - Value returned by {@link 
RestRequest#getContextPath()}
+ *     <li><js>"method"</js> - Value returned by {@link 
RestRequest#getMethod()}
+ *     <li><js>"methodDescription"</js> - Value returned by {@link 
RestRequest#getMethodDescription()}
+ *     <li><js>"methodSummary"</js> - Value returned by {@link 
RestRequest#getMethodSummary()}
+ *     <li><js>"pathInfo"</js> - Value returned by {@link 
RestRequest#getPathInfo()}
+ *     <li><js>"requestParentURI"</js> - Value returned by {@link 
UriContext#getRootRelativePathInfoParent()}
+ *     <li><js>"requestURI"</js> - Value returned by {@link 
RestRequest#getRequestURI()}
+ *     <li><js>"servletDescription"</js> - Value returned by {@link 
RestRequest#getServletDescription()}
+ *     <li><js>"servletParentURI"</js> - Value returned by {@link 
UriContext#getRootRelativeServletPathParent()}
+ *     <li><js>"servletPath"</js> - See {@link RestRequest#getServletPath()}
+ *     <li><js>"servletTitle"</js> - See {@link RestRequest#getServletTitle()}
+ *     <li><js>"servletURI"</js> - See {@link 
UriContext#getRootRelativeServletPath()}
+ *     <li><js>"siteName"</js> - See {@link RestRequest#getSiteName()}
+ *     <li><js>"Attribute.x"</js> - Value returned by {@link 
HttpServletRequest#getAttribute(String)}.
+ *     <li><js>"FormData.x"</js> - Value returned by {@link 
RestRequest#getFormData(String)}.
+ *     <li><js>"Header.x"</js> - Value returned by {@link 
RestRequest#getHeader(String)}.
+ *     <li><js>"Path.x"</js> - Value returned by {@link 
RestRequest#getPath(String)}.
+ *     <li><js>"Query.x"</js> = Value returned by {@link 
RestRequest#getQuery(String)}.
  * </ul>
- *
  * <p>
  * This variable resolver requires that a {@link RestRequest} object be set as 
a context object on the resolver or a
  * session object on the resolver session.
@@ -46,7 +56,7 @@ import org.apache.juneau.svl.*;
  *
  * @see org.apache.juneau.svl
  */
-public class RequestVar extends SimpleVar {
+public class RequestVar extends DefaultingVar {
 
        /**
         * The name of the session or context object that identifies the {@link 
RestRequest} object.

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/vars/SerializedRequestAttrVar.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/SerializedRequestAttrVar.java
 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/SerializedRequestAttrVar.java
index a4a297f..e7ef586 100644
--- 
a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/SerializedRequestAttrVar.java
+++ 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/SerializedRequestAttrVar.java
@@ -24,7 +24,7 @@ import org.apache.juneau.svl.*;
  * Serialized request attribute variable resolver.
  *
  * <p>
- * The format for this var is <js>"$SA{contentType,key}"</js> or 
<js>"$SA{contentType,key,defaultValue}"</js>.
+ * The format for this var is <js>"$SA{contentType,key[,defaultValue]}"</js>.
  *
  * <p>
  * This variable resolver requires that a {@link RestRequest} object be set as 
a context object on the resolver or a
@@ -49,23 +49,19 @@ public class SerializedRequestAttrVar extends StreamedVar {
        }
 
        @Override /* Parameter */
-       public void resolveTo(VarResolverSession session, Writer w, String key) 
{
-               try {
-                       int i = key.indexOf(',');
-                       if (i == -1)
-                               throw new RuntimeException("Invalid format for 
$SA var.  Must be of the format $SA{contentType,key[,defaultValue]}");
-                       String[] s2 = split(key);
-                       RestRequest req = 
session.getSessionObject(RestRequest.class, RequestVar.SESSION_req);
-                       if (req != null) {
-                               Object o = req.getAttribute(key);
-                               if (o == null)
-                                       o = key;
-                               Serializer s = 
req.getSerializerGroup().getSerializer(s2[0]);
-                               if (s != null)
-                                       s.serialize(w, o);
-                       }
-               } catch (Exception e) {
-                       throw new RuntimeException(e);
+       public void resolveTo(VarResolverSession session, Writer w, String key) 
throws Exception {
+               int i = key.indexOf(',');
+               if (i == -1)
+                       throw new RuntimeException("Invalid format for $SA var. 
 Must be of the format $SA{contentType,key[,defaultValue]}");
+               String[] s2 = split(key);
+               RestRequest req = session.getSessionObject(RestRequest.class, 
RequestVar.SESSION_req);
+               if (req != null) {
+                       Object o = req.getAttribute(key);
+                       if (o == null)
+                               o = key;
+                       Serializer s = 
req.getSerializerGroup().getSerializer(s2[0]);
+                       if (s != null)
+                               s.serialize(w, o);
                }
        }
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/vars/ServletInitParamVar.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/ServletInitParamVar.java
 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/ServletInitParamVar.java
index c1b8c8e..8125f8b 100644
--- 
a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/ServletInitParamVar.java
+++ 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/ServletInitParamVar.java
@@ -19,7 +19,7 @@ import org.apache.juneau.svl.*;
  * Servlet init parameter variable resolver.
  *
  * <p>
- * The format for this var is <js>"$I{key}"</js> or 
<js>"$I{key,defaultValue}"</js>.
+ * The format for this var is <js>"$I{key[,defaultValue]}"</js>.
  *
  * <p>
  * This variable resolver requires that a {@link RestRequest} object be set as 
a context object on the resolver or a

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java
index 698a955..e629a10 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlEncodeVar.java
@@ -21,7 +21,7 @@ import org.apache.juneau.svl.*;
  * URL-encoding variable resolver.
  *
  * <p>
- * The format for this var is <js>"$UE{innerValue}"</js>.
+ * The format for this var is <js>"$UE{uriPart}"</js>.
  *
  * <p>
  * This variable takes the contents inside the variable and replaces it with a 
value returned by calling

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlVar.java
----------------------------------------------------------------------
diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlVar.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlVar.java
index 8ac9b2e..12fa846 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlVar.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/UrlVar.java
@@ -18,7 +18,10 @@ import org.apache.juneau.rest.annotation.*;
 import org.apache.juneau.svl.*;
 
 /**
- * Resolver for resolving URL variables <js>"$U{name}"</js>.
+ * URL variable resolver.
+ *
+ * <p>
+ * The format for this var is <js>"$U{uri}"</js>.
  *
  * <p>
  * The advantage of using this variable is that you can resolve URLs with 
special protocols such as

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/java/org/apache/juneau/rest/vars/WidgetVar.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/WidgetVar.java 
b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/WidgetVar.java
index 715ff9a..1b11155 100644
--- a/juneau-rest/src/main/java/org/apache/juneau/rest/vars/WidgetVar.java
+++ b/juneau-rest/src/main/java/org/apache/juneau/rest/vars/WidgetVar.java
@@ -18,7 +18,10 @@ import org.apache.juneau.rest.widget.*;
 import org.apache.juneau.svl.*;
 
 /**
- * Resolver for resolving widget variables <js>"$W{name}"</js>.
+ * HTML widget variable resolver.
+ *
+ * <p>
+ * The format for this var is <js>"$W{widgetName}"</js>.
  *
  * <p>
  * Widgets are simple class that produce some sort of string based on a 
passed-in HTTP request.
@@ -52,15 +55,11 @@ public class WidgetVar extends SimpleVar {
        }
 
        @Override /* Parameter */
-       public String resolve(VarResolverSession session, String key) {
+       public String resolve(VarResolverSession session, String key) throws 
Exception {
                RestRequest req = session.getSessionObject(RestRequest.class, 
SESSION_req);
                Widget w = req.getWidgets().get(key);
                if (w == null)
                        return "unknown-widget-"+key;
-               try {
-                       return w.getHtml(req);
-               } catch (Exception e) {
-                       return "widget-error-"+e.getLocalizedMessage();
-               }
+               return w.getHtml(req);
        }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bed066ee/juneau-rest/src/main/resources/org/apache/juneau/rest/widget/QueryMenuItem.html
----------------------------------------------------------------------
diff --git 
a/juneau-rest/src/main/resources/org/apache/juneau/rest/widget/QueryMenuItem.html
 
b/juneau-rest/src/main/resources/org/apache/juneau/rest/widget/QueryMenuItem.html
index 6d5bcdb..a149ba9 100644
--- 
a/juneau-rest/src/main/resources/org/apache/juneau/rest/widget/QueryMenuItem.html
+++ 
b/juneau-rest/src/main/resources/org/apache/juneau/rest/widget/QueryMenuItem.html
@@ -1,5 +1,5 @@
 <!--
-/***************************************************************************************************************************
+ 
***************************************************************************************************************************
  * 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
@@ -11,7 +11,7 @@
  * "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.
  *
- 
***************************************************************************************************************************/
+ 
***************************************************************************************************************************
  -->
 <div class='menu-item'>
        <a class='link' onclick='menuClick(this)'>query</a>

Reply via email to