You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2016/10/07 16:33:50 UTC
[08/11] incubator-juneau git commit: JUNEAU-16 - Support for Swagger
documentation
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java
index 3e31577..97f53fd 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java
@@ -284,7 +284,7 @@ public class HtmlSerializer extends XmlSerializer {
typeName = "object";
out.oTag(i, "table").attr(bc.getBeanTypePropertyName(), typeName);
out.appendln(">");
- if (! (aType.getExtendedMeta(HtmlClassMeta.class).isNoTableHeaders() || (ppMeta != null && ppMeta.getExtendedMeta(HtmlBeanPropertyMeta.class).isNoTableHeaders()))) {
+ if (session.isAddKeyValueTableHeaders() && ! (aType.getExtendedMeta(HtmlClassMeta.class).isNoTableHeaders() || (ppMeta != null && ppMeta.getExtendedMeta(HtmlBeanPropertyMeta.class).isNoTableHeaders()))) {
out.sTag(i+1, "tr").nl();
out.sTag(i+2, "th").nl().appendln(i+3, "<string>key</string>").eTag(i+2, "th").nl();
out.sTag(i+2, "th").nl().appendln(i+3, "<string>value</string>").eTag(i+2, "th").nl();
@@ -334,7 +334,7 @@ public class HtmlSerializer extends XmlSerializer {
typeName = "object";
out.oTag(i, "table").attr(bc.getBeanTypePropertyName(), typeName);
out.append('>').nl();
- if (! (m.getClassMeta().getExtendedMeta(HtmlClassMeta.class).isNoTableHeaders() || (ppMeta != null && ppMeta.getExtendedMeta(HtmlBeanPropertyMeta.class).isNoTableHeaders()))) {
+ if (session.isAddKeyValueTableHeaders() && ! (m.getClassMeta().getExtendedMeta(HtmlClassMeta.class).isNoTableHeaders() || (ppMeta != null && ppMeta.getExtendedMeta(HtmlBeanPropertyMeta.class).isNoTableHeaders()))) {
out.sTag(i+1, "tr").nl();
out.sTag(i+2, "th").nl().appendln(i+3, "<string>key</string>").eTag(i+2, "th").nl();
out.sTag(i+2, "th").nl().appendln(i+3, "<string>value</string>").eTag(i+2, "th").nl();
@@ -424,11 +424,9 @@ public class HtmlSerializer extends XmlSerializer {
} else if (cm.isMap() && ! (cm.isBeanMap())) {
Map m2 = session.sort((Map)o);
- Iterator mapEntries = m2.entrySet().iterator();
- while (mapEntries.hasNext()) {
- Map.Entry e = (Map.Entry)mapEntries.next();
+ for (String k : th) {
out.sTag(i+2, "td").nl();
- serializeAnything(session, out, e.getValue(), elementType, e.getKey().toString(), 2, null);
+ serializeAnything(session, out, m2.get(k), elementType, k, 2, null);
out.eTag(i+2, "td").nl();
}
} else {
@@ -437,10 +435,9 @@ public class HtmlSerializer extends XmlSerializer {
m2 = (BeanMap)o;
else
m2 = bc.forBean(o);
-
- Iterator mapEntries = m2.entrySet().iterator();
- while (mapEntries.hasNext()) {
- BeanMapEntry p = (BeanMapEntry)mapEntries.next();
+
+ for (String k : th) {
+ BeanMapEntry p = m2.getProperty(k);
BeanPropertyMeta pMeta = p.getMeta();
out.sTag(i+2, "td").nl();
serializeAnything(session, out, p.getValue(), pMeta.getClassMeta(), p.getKey().toString(), 2, pMeta);
@@ -502,17 +499,33 @@ public class HtmlSerializer extends XmlSerializer {
if (session.canIgnoreValue(cm, null, o1))
return null;
if (cm.isMap() && ! cm.isBeanMap()) {
- Map m = (Map)o1;
- th = new String[m.size()];
- int i = 0;
- for (Object k : m.keySet())
- th[i++] = (k == null ? null : k.toString());
+ Set<String> set = new LinkedHashSet<String>();
+ for (Object o : c) {
+ if (! session.canIgnoreValue(cm, null, o)) {
+ if (! cm.isInstance(o))
+ return null;
+ Map m = session.sort((Map)o);
+ for (Map.Entry e : (Set<Map.Entry>)m.entrySet()) {
+ if (e.getValue() != null)
+ set.add(e.getKey() == null ? null : e.getKey().toString());
+ }
+ }
+ }
+ th = set.toArray(new String[set.size()]);
} else {
- BeanMap<?> bm = (o1 instanceof BeanMap ? (BeanMap)o1 : bc.forBean(o1));
- List<String> l = new LinkedList<String>();
- for (String k : bm.keySet())
- l.add(k);
- th = l.toArray(new String[l.size()]);
+ Set<String> set = new LinkedHashSet<String>();
+ for (Object o : c) {
+ if (! session.canIgnoreValue(cm, null, o)) {
+ if (! cm.isInstance(o))
+ return null;
+ BeanMap<?> bm = (o instanceof BeanMap ? (BeanMap)o : bc.forBean(o));
+ for (Map.Entry<String,Object> e : bm.entrySet()) {
+ if (e.getValue() != null)
+ set.add(e.getKey());
+ }
+ }
+ }
+ th = set.toArray(new String[set.size()]);
}
prevC.add(cm);
s.addAll(Arrays.asList(th));
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java
index 216bfaa..f40a93e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java
@@ -153,8 +153,20 @@ public class HtmlSerializerContext extends XmlSerializerContext {
*/
public static final String HTML_labelParameter = "HtmlSerializer.labelParameter";
+ /**
+ * <b>Configuration property:</b> Add key/value headers on bean/map tables.
+ * <p>
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlSerializer.addKeyValueTableHeaders"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk>
+ * </ul>
+ * <p>
+ */
+ public static final String HTML_addKeyValueTableHeaders = "HtmlSerializer.addKeyValueTableHeaders";
+
final String uriAnchorText;
- final boolean lookForLabelParameters, detectLinksInStrings;
+ final boolean lookForLabelParameters, detectLinksInStrings, addKeyValueTableHeaders;
final String labelParameter;
/**
@@ -170,5 +182,6 @@ public class HtmlSerializerContext extends XmlSerializerContext {
lookForLabelParameters = cf.getProperty(HTML_lookForLabelParameters, Boolean.class, true);
detectLinksInStrings = cf.getProperty(HTML_detectLinksInStrings, Boolean.class, true);
labelParameter = cf.getProperty(HTML_labelParameter, String.class, "label");
+ addKeyValueTableHeaders = cf.getProperty(HTML_addKeyValueTableHeaders, Boolean.class, false);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
index 06127d1..7456956 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
@@ -32,7 +32,7 @@ import org.apache.juneau.xml.*;
public class HtmlSerializerSession extends XmlSerializerSession {
private final AnchorText anchorText;
- private final boolean detectLinksInStrings, lookForLabelParameters;
+ private final boolean detectLinksInStrings, lookForLabelParameters, addKeyValueTableHeaders;
private final Pattern urlPattern = Pattern.compile("http[s]?\\:\\/\\/.*");
private final Pattern labelPattern;
private final String absolutePathUriBase, relativeUriBase;
@@ -62,11 +62,13 @@ public class HtmlSerializerSession extends XmlSerializerSession {
detectLinksInStrings = ctx.detectLinksInStrings;
lookForLabelParameters = ctx.lookForLabelParameters;
labelParameter = ctx.labelParameter;
+ addKeyValueTableHeaders = ctx.addKeyValueTableHeaders;
} else {
anchorText = Enum.valueOf(AnchorText.class, op.getString(HTML_uriAnchorText, ctx.uriAnchorText));
detectLinksInStrings = op.getBoolean(HTML_detectLinksInStrings, ctx.detectLinksInStrings);
lookForLabelParameters = op.getBoolean(HTML_lookForLabelParameters, ctx.lookForLabelParameters);
labelParameter = op.getString(HTML_labelParameter, ctx.labelParameter);
+ addKeyValueTableHeaders = op.getBoolean(HTML_addKeyValueTableHeaders, ctx.addKeyValueTableHeaders);
}
labelPattern = Pattern.compile("[\\?\\&]" + Pattern.quote(labelParameter) + "=([^\\&]*)");
this.absolutePathUriBase = getAbsolutePathUriBase();
@@ -150,4 +152,14 @@ public class HtmlSerializerSession extends XmlSerializerSession {
return o.toString();
}
}
+
+ /**
+ * Returns the {@link HtmlSerializerContext#HTML_addKeyValueTableHeaders} setting value for this session.
+ *
+ * @return The {@link HtmlSerializerContext#HTML_addKeyValueTableHeaders} setting value for this session.
+ */
+ public final boolean isAddKeyValueTableHeaders() {
+ return addKeyValueTableHeaders;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/html/HtmlWriter.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlWriter.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlWriter.java
index 9f588c0..e470746 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlWriter.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlWriter.java
@@ -74,7 +74,7 @@ public class HtmlWriter extends XmlWriter {
else if (test == '\b')
append("<bs/>");
else if (test == '\t')
- append("<tb/>");
+ append("<tb> </tb>");
else if (Character.isISOControl(test))
append("&#" + (int) test + ";");
else
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/ini/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/package.html b/juneau-core/src/main/java/org/apache/juneau/ini/package.html
index b475434..f5d3ac2 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ini/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/ini/package.html
@@ -631,10 +631,10 @@
<ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>,
description=<js>"Sets contents of config file."</js>,
input={
- <ja>@Var</ja>(category=<jsf>CONTENT</jsf>, description=<js>"New contents in INI file format."</js>)
+ <ja>@Var</ja>(in=<js>"body"</js>, description=<js>"New contents in INI file format."</js>)
}
)
- <jk>public</jk> ConfigFile setConfigContents(<ja>@Content</ja> Reader contents) <jk>throws</jk> Exception {
+ <jk>public</jk> ConfigFile setConfigContents(<ja>@Body</ja> Reader contents) <jk>throws</jk> Exception {
<jc>// Create a new in-memory config file based on the contents of the HTTP request.</jc>
ConfigFile cf2 = ConfigMgr.<jsf>DEFAULT</jsf>.create().load(contents);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java
index c5b4728..9ea8892 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/FileUtils.java
@@ -15,12 +15,17 @@ package org.apache.juneau.internal;
import static org.apache.juneau.internal.ThrowableUtils.*;
import java.io.*;
+import java.util.*;
+import java.util.ResourceBundle.*;
/**
* File utilities.
*/
public class FileUtils {
+ private static final ResourceBundle.Control RB_CONTROL = ResourceBundle.Control.getControl(Control.FORMAT_DEFAULT);
+ private static final List<Locale> ROOT_LOCALE = Arrays.asList(Locale.ROOT);
+
/**
* Same as {@link File#mkdirs()} except throws a RuntimeExeption if directory could not be created.
*
@@ -131,4 +136,99 @@ public class FileUtils {
f.deleteOnExit();
return f;
}
+
+ /**
+ * Strips the extension from a file name.
+ *
+ * @param name The file name.
+ * @return The file name without the extension, or <jk>null</jk> if name was <jk>null</jk>.
+ */
+ public static String getBaseName(String name) {
+ if (name == null)
+ return null;
+ int i = name.lastIndexOf('.');
+ if (i == -1)
+ return name;
+ return name.substring(0, i);
+ }
+
+ /**
+ * Returns the extension from a file name.
+ *
+ * @param name The file name.
+ * @return The the extension, or <jk>null</jk> if name was <jk>null</jk>.
+ */
+ public static String getExtension(String name) {
+ if (name == null)
+ return null;
+ int i = name.lastIndexOf('.');
+ if (i == -1)
+ return "";
+ return name.substring(i+1);
+ }
+
+ /**
+ * Returns the candidate file names for the specified file name in the specified locale.
+ * <p>
+ * For example, if looking for the <js>"MyResource.txt"</js> file in the Japanese locale, the iterator will return names 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>
+ * If the locale is null, then it will only return <js>"MyResource.txt"</js>.
+ *
+ * @param fileName The name of the file to get candidate file names on.
+ * @param l The locale.
+ * @return An iterator of file names to look at.
+ */
+ public static Iterable<String> getCandidateFileNames(final String fileName, final Locale l) {
+ return new Iterable<String>() {
+ @Override
+ public Iterator<String> iterator() {
+ return new Iterator<String>() {
+ final Iterator<Locale> locales = getCandidateLocales(l).iterator();
+ String baseName, ext;
+
+ @Override
+ public boolean hasNext() {
+ return locales.hasNext();
+ }
+
+ @Override
+ public String next() {
+ Locale l2 = locales.next();
+ if (l2.toString().isEmpty())
+ return fileName;
+ if (baseName == null)
+ baseName = getBaseName(fileName);
+ if (ext == null)
+ ext = getExtension(fileName);
+ return baseName + "_" + l2.toString() + (ext.isEmpty() ? "" : ('.' + ext));
+ }
+ };
+ }
+ };
+ }
+
+
+ /**
+ * Returns the candidate locales for the specified locale.
+ * <p>
+ * For example, if <code>locale</code> is <js>"ja_JP"</js>, then this method will return:
+ * <ol>
+ * <li><js>"ja_JP"</js>
+ * <li><js>"ja"</js>
+ * <li><js>""</js>
+ * </ol>
+ *
+ * @param locale The locale to get the list of candidate locales for.
+ * @return The list of candidate locales.
+ */
+ public static List<Locale> getCandidateLocales(Locale locale) {
+ if (locale == null)
+ return ROOT_LOCALE;
+ return RB_CONTROL.getCandidateLocales("", locale);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java
index beb7707..c7159b0 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/ReflectionUtils.java
@@ -173,4 +173,34 @@ public final class ReflectionUtils {
}
return null;
}
+
+ /**
+ * Similar to {@link #getResource(Class, String)} except looks for localized versions of the specified resource.
+ * <p>
+ * For example, if looking in the Japanese locale, the order of lookup on the <js>"MyResource.txt"</js> file is:
+ * <ol>
+ * <li><js>"MyResource_ja_JP.txt"</js>
+ * <li><js>"MyResource_ja.txt"</js>
+ * <li><js>"MyResource.txt"</js>
+ * </ol>
+ *
+ * @param c The class to return the resource on.
+ * @param name The resource name.
+ * @param locale The locale of the resource.
+ * @return An input stream on the specified resource, or <jk>null</jk> if the resource could not be found.
+ */
+ public static InputStream getLocalizedResource(Class<?> c, String name, Locale locale) {
+ if (locale == null || locale.toString().isEmpty())
+ return getResource(c, name);
+ while (c != null) {
+ for (String n : FileUtils.getCandidateFileNames(name, locale)) {
+ InputStream is = c.getResourceAsStream(n);
+ if (is != null)
+ return is;
+ }
+ c = c.getSuperclass();
+ }
+ return null;
+ }
}
+
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/jena/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/jena/package.html b/juneau-core/src/main/java/org/apache/juneau/jena/package.html
index 2a08529..2d9a689 100644
--- a/juneau-core/src/main/java/org/apache/juneau/jena/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/jena/package.html
@@ -1087,21 +1087,21 @@
<p class='bcode'>
<jc>// GET person request handler</jc>
<ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/people/{id}/*"</js>, rc={200,404})
- <jk>public</jk> Person getPerson(RestRequest req, <ja>@Attr</ja> <jk>int</jk> id) throws Exception {
+ <jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
properties.put(HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, req.getPathInfo());
<jk>return</jk> findPerson(id);
}
<jc>// POST person handler</jc>
<ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/people"</js>, guards=AdminGuard.<jk>class</jk>, rc={307,404})
- <jk>public void</jk> createPerson(RestResponse res, <ja>@Content</ja> CreatePerson cp) <jk>throws</jk> Exception {
+ <jk>public void</jk> createPerson(RestResponse res, <ja>@Body</ja> CreatePerson cp) <jk>throws</jk> Exception {
Person p = addressBook.createPerson(cp);
res.sendRedirect(p.<jf>uri</jf>);
}
<jc>// DELETE person handler</jc>
<ja>@RestMethod</ja>(name=<js>"DELETE"</js>, path=<js>"/people/{id}"</js>, guards=AdminGuard.<jk>class</jk>, rc={200,404})
- <jk>public</jk> String deletePerson(RestResponse res, <ja>@Attr</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
+ <jk>public</jk> String deletePerson(RestResponse res, <ja>@Path</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
Person p = findPerson(id);
addressBook.remove(p);
<jk>return</jk> <js>"DELETE successful"</js>;
@@ -1150,7 +1150,7 @@
<ja>@Property</ja>(name=SerializerContext.<jsf>SERIALIZER_quoteChar</jsf>, value=<js>"'"</js>)
}
)
- <jk>public</jk> Person getPerson(RestRequest req, <ja>@Attr</ja> <jk>int</jk> id) throws Exception {
+ <jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
properties.put(HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, req.getPathInfo());
<jk>return</jk> findPerson(id);
}
@@ -1176,34 +1176,34 @@
</p>
<p class='bcode'>
<ja>@Provider</ja>
- <ja>@Produces</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonSerializer</jc>
- <js>"application/json+simple"</js>,<js>"text/json+simple"</js>, <jc>// JsonSerializer.Simple</jc>
- <js>"application/json+schema"</js>,<js>"text/json+schema"</js>, <jc>// JsonSchemaSerializer</jc>
- <js>"text/xml"</js>, <jc>// XmlDocSerializer</jc>
- <js>"text/xml+simple"</js>, <jc>// XmlDocSerializer.Simple</jc>
- <js>"text/xml+schema"</js>, <jc>// XmlSchemaDocSerializer</jc>
- <js>"text/html"</js>, <jc>// HtmlDocSerializer</jc>
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingSerializer</jc>
- <js>"text/xml+soap"</js>, <jc>// SoapXmlSerializer</jc>
- <js>"text/xml+rdf"</js>, <jc>// RdfSerializer.Xml</jc>
- <js>"text/xml+rdf+abbrev"</js>, <jc>// RdfSerializer.XmlAbbrev</jc>
- <js>"text/n-triple"</js>, <jc>// RdfSerializer.NTriple</jc>
- <js>"text/turtle"</js>, <jc>// RdfSerializer.Turtle</jc>
- <js>"text/n3"</js>, <jc>// RdfSerializer.N3</jc>
- <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectSerializer</jc>
- })
- <ja>@Consumes</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonParser</jc>
- <js>"text/xml"</js>, <jc>// XmlParser</jc>
- <js>"text/html"</js>, <jc>// HtmlParser</jc>
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingParser</jc>
- <js>"text/xml+rdf"</js>, <jc>// RdfParser.Xml</jc>
- <js>"text/n-triple"</js>, <jc>// RdfParser.NTriple</jc>
- <js>"text/turtle"</js>, <jc>// RdfParser.Turtle</jc>
- <js>"text/n3"</js>, <jc>// RdfParser.N3</jc>
- <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectParser</jc>
- })
+ <ja>@Produces</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonSerializer</jc>
+ <js>"application/json+simple,text/json+simple,"</js>+ <jc>// JsonSerializer.Simple</jc>
+ <js>"application/json+schema,text/json+schema,"</js>+ <jc>// JsonSchemaSerializer</jc>
+ <js>"text/xml,"</js>+ <jc>// XmlDocSerializer</jc>
+ <js>"text/xml+simple,"</js>+ <jc>// XmlDocSerializer.Simple</jc>
+ <js>"text/xml+schema,"</js>+ <jc>// XmlSchemaDocSerializer</jc>
+ <js>"text/html,"</js>+ <jc>// HtmlDocSerializer</jc>
+ <js>"application/x-www-form-urlencoded,"</js>+ <jc>// UrlEncodingSerializer</jc>
+ <js>"text/xml+soap,"</js>+ <jc>// SoapXmlSerializer</jc>
+ <js>"text/xml+rdf,"</js>+ <jc>// RdfSerializer.Xml</jc>
+ <js>"text/xml+rdf+abbrev,"</js>+ <jc>// RdfSerializer.XmlAbbrev</jc>
+ <js>"text/n-triple,"</js>+ <jc>// RdfSerializer.NTriple</jc>
+ <js>"text/turtle,"</js>+ <jc>// RdfSerializer.Turtle</jc>
+ <js>"text/n3,"</js>+ <jc>// RdfSerializer.N3</jc>
+ <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectSerializer</jc>
+ )
+ <ja>@Consumes</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonParser</jc>
+ <js>"text/xml,"</js>+ <jc>// XmlParser</jc>
+ <js>"text/html,"</js>+ <jc>// HtmlParser</jc>
+ <js>"application/x-www-form-urlencoded,"</js>+ <jc>// UrlEncodingParser</jc>
+ <js>"text/xml+rdf,"</js>+ <jc>// RdfParser.Xml</jc>
+ <js>"text/n-triple,"</js>+ <jc>// RdfParser.NTriple</jc>
+ <js>"text/turtle,"</js>+ <jc>// RdfParser.Turtle</jc>
+ <js>"text/n3,"</js>+ <jc>// RdfParser.N3</jc>
+ <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectParser</jc>
+ )
<ja>@JuneauProvider</ja>(
serializers={
JsonSerializer.<jk>class</jk>,
@@ -1307,19 +1307,19 @@
</p>
<p class='bcode'>
<ja>@Provider</ja>
- <ja>@Produces</ja>({
- <js>"text/xml+rdf"</js>, <jc>// RdfSerializer.Xml</jc>
- <js>"text/xml+rdf+abbrev"</js>, <jc>// RdfSerializer.XmlAbbrev</jc>
- <js>"text/n-triple"</js>, <jc>// RdfSerializer.NTriple</jc>
- <js>"text/turtle"</js>, <jc>// RdfSerializer.Turtle</jc>
- <js>"text/n3"</js>, <jc>// RdfSerializer.N3</jc>
- })
- <ja>@Consumes</ja>({
- <js>"text/xml+rdf"</js>, <jc>// RdfParser.Xml</jc>
- <js>"text/n-triple"</js>, <jc>// RdfParser.NTriple</jc>
- <js>"text/turtle"</js>, <jc>// RdfParser.Turtle</jc>
- <js>"text/n3"</js>, <jc>// RdfParser.N3</jc>
- })
+ <ja>@Produces</ja>(
+ <js>"text/xml+rdf,"</js>+ <jc>// RdfSerializer.Xml</jc>
+ <js>"text/xml+rdf+abbrev,"</js>+ <jc>// RdfSerializer.XmlAbbrev</jc>
+ <js>"text/n-triple,"</js>+ <jc>// RdfSerializer.NTriple</jc>
+ <js>"text/turtle,"</js>+ <jc>// RdfSerializer.Turtle</jc>
+ <js>"text/n3"</js>+ <jc>// RdfSerializer.N3</jc>
+ )
+ <ja>@Consumes</ja>(
+ <js>"text/xml+rdf,"</js>+ <jc>// RdfParser.Xml</jc>
+ <js>"text/n-triple,"</js>+ <jc>// RdfParser.NTriple</jc>
+ <js>"text/turtle,"</js>+ <jc>// RdfParser.Turtle</jc>
+ <js>"text/n3"</js> <jc>// RdfParser.N3</jc>
+ )
<ja>@JuneauProvider</ja>(
serializers={
RdfSerializer.Xml.<jk>class</jk>,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java
index af4d5a6..444734b 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java
@@ -90,7 +90,7 @@ import org.apache.juneau.transform.*;
* @author James Bognar (james.bognar@salesforce.com)
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
-@Consumes({"application/json","text/json"})
+@Consumes("application/json,text/json")
public final class JsonParser extends ReaderParser {
/** Default parser, all default settings.*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
index a1df3cc..4bc9eb1 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
@@ -40,7 +40,7 @@ import org.apache.juneau.transform.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Produces(value={"application/json+schema","text/json+schema"},contentType="application/json")
+@Produces(value="application/json+schema,text/json+schema",contentType="application/json")
public final class JsonSchemaSerializer extends JsonSerializer {
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java
index ee0b138..4c8327c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java
@@ -95,7 +95,7 @@ import org.apache.juneau.transform.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Produces({"application/json","text/json"})
+@Produces("application/json,text/json")
public class JsonSerializer extends WriterSerializer {
/** Default serializer, all default settings.*/
@@ -126,7 +126,7 @@ public class JsonSerializer extends WriterSerializer {
}
/** Default serializer, single quotes, simple mode. */
- @Produces(value={"application/json+simple","text/json+simple"},contentType="application/json")
+ @Produces(value="application/json+simple,text/json+simple",contentType="application/json")
public static class Simple extends JsonSerializer {
/** Constructor */
public Simple() {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/json/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/package.html b/juneau-core/src/main/java/org/apache/juneau/json/package.html
index 4c16767..f403f7d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/json/package.html
@@ -1040,21 +1040,21 @@
<p class='bcode'>
<jc>// GET person request handler</jc>
<ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/people/{id}/*"</js>, rc={200,404})
- <jk>public</jk> Person getPerson(RestRequest req, <ja>@Attr</ja> <jk>int</jk> id) throws Exception {
+ <jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
properties.put(HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, req.getPathInfo());
<jk>return</jk> findPerson(id);
}
<jc>// POST person handler</jc>
<ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/people"</js>, guards=AdminGuard.<jk>class</jk>, rc={307,404})
- <jk>public void</jk> createPerson(RestResponse res, <ja>@Content</ja> CreatePerson cp) <jk>throws</jk> Exception {
+ <jk>public void</jk> createPerson(RestResponse res, <ja>@Body</ja> CreatePerson cp) <jk>throws</jk> Exception {
Person p = addressBook.createPerson(cp);
res.sendRedirect(p.<jf>uri</jf>);
}
<jc>// DELETE person handler</jc>
<ja>@RestMethod</ja>(name=<js>"DELETE"</js>, path=<js>"/people/{id}"</js>, guards=AdminGuard.<jk>class</jk>, rc={200,404})
- <jk>public</jk> String deletePerson(RestResponse res, <ja>@Attr</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
+ <jk>public</jk> String deletePerson(RestResponse res, <ja>@Path</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
Person p = findPerson(id);
addressBook.remove(p);
<jk>return</jk> <js>"DELETE successful"</js>;
@@ -1100,7 +1100,7 @@
<ja>@Property</ja>(name=SerializerContext.<jsf>SERIALIZER_quoteChar</jsf>, value=<js>"'"</js>)
}
)
- <jk>public</jk> Person getPerson(RestRequest req, <ja>@Attr</ja> <jk>int</jk> id) throws Exception {
+ <jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
properties.put(HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, req.getPathInfo());
<jk>return</jk> findPerson(id);
}
@@ -1126,25 +1126,25 @@
</p>
<p class='bcode'>
<ja>@Provider</ja>
- <ja>@Produces</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonSerializer</jc>
- <js>"application/json+simple"</js>,<js>"text/json+simple"</js>, <jc>// JsonSerializer.Simple</jc>
- <js>"application/json+schema"</js>,<js>"text/json+schema"</js>, <jc>// JsonSchemaSerializer</jc>
- <js>"text/xml"</js>, <jc>// XmlDocSerializer</jc>
- <js>"text/xml+simple"</js>, <jc>// XmlDocSerializer.Simple</jc>
- <js>"text/xml+schema"</js>, <jc>// XmlSchemaDocSerializer</jc>
- <js>"text/html"</js>, <jc>// HtmlDocSerializer</jc>
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingSerializer</jc>
- <js>"text/xml+soap"</js>, <jc>// SoapXmlSerializer</jc>
+ <ja>@Produces</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonSerializer</jc>
+ <js>"application/json+simple,text/json+simple"</js>+ <jc>// JsonSerializer.Simple</jc>
+ <js>"application/json+schema,text/json+schema"</js>+ <jc>// JsonSchemaSerializer</jc>
+ <js>"text/xml"</js>+ <jc>// XmlDocSerializer</jc>
+ <js>"text/xml+simple"</js>+ <jc>// XmlDocSerializer.Simple</jc>
+ <js>"text/xml+schema"</js>+ <jc>// XmlSchemaDocSerializer</jc>
+ <js>"text/html"</js>+ <jc>// HtmlDocSerializer</jc>
+ <js>"application/x-www-form-urlencoded"</js>+ <jc>// UrlEncodingSerializer</jc>
+ <js>"text/xml+soap"</js>+ <jc>// SoapXmlSerializer</jc>
<js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectSerializer</jc>
- })
- <ja>@Consumes</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonParser</jc>
- <js>"text/xml"</js>, <jc>// XmlParser</jc>
- <js>"text/html"</js>, <jc>// HtmlParser</jc>
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingParser</jc>
+ )
+ <ja>@Consumes</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonParser</jc>
+ <js>"text/xml,"</js>+ <jc>// XmlParser</jc>
+ <js>"text/html,"</js>+ <jc>// HtmlParser</jc>
+ <js>"application/x-www-form-urlencoded,"</js>+ <jc>// UrlEncodingParser</jc>
<js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectParser</jc>
- })
+ )
<ja>@JuneauProvider</ja>(
serializers={
JsonSerializer.<jk>class</jk>,
@@ -1236,14 +1236,14 @@
</p>
<p class='bcode'>
<ja>@Provider</ja>
- <ja>@Produces</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonSerializer</jc>
- <js>"application/json+simple"</js>,<js>"text/json+simple"</js>, <jc>// JsonSerializer.Simple</jc>
- <js>"application/json+schema"</js>,<js>"text/json+schema"</js> <jc>// JsonSchemaSerializer</jc>
- })
- <ja>@Consumes</ja>({
- <js>"application/json"</js>, <js>"text/json"</js> <jc>// JsonParser</jc>
- })
+ <ja>@Produces</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonSerializer</jc>
+ <js>"application/json+simple,text/json+simple,"</js>+ <jc>// JsonSerializer.Simple</jc>
+ <js>"application/json+schema,text/json+schema"</js> <jc>// JsonSchemaSerializer</jc>
+ )
+ <ja>@Consumes</ja>(
+ <js>"application/json,text/json"</js> <jc>// JsonParser</jc>
+ )
<ja>@JuneauProvider</ja>(
serializers={
JsonSerializer.<jk>class</jk>,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java b/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
index e066d3a..7532125 100644
--- a/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
@@ -42,7 +42,7 @@ import org.apache.juneau.transform.*;
* @author James Bognar (james.bognar@salesforce.com)
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
-@Consumes({"octal/msgpack"})
+@Consumes("octal/msgpack")
public final class MsgPackParser extends InputStreamParser {
/** Default parser, all default settings.*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java b/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
index b8cd99c..f138fb5 100644
--- a/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
@@ -41,7 +41,7 @@ import org.apache.juneau.transform.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Produces({"octal/msgpack"})
+@Produces("octal/msgpack")
public class MsgPackSerializer extends OutputStreamSerializer {
/** Default serializer, all default settings.*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/package.html b/juneau-core/src/main/java/org/apache/juneau/package.html
index 558c8a4..e955891 100644
--- a/juneau-core/src/main/java/org/apache/juneau/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/package.html
@@ -189,7 +189,7 @@
</p>
<p class='bcode'>
<jc>// Bean with only one 'name' property</jc>
- <ja>@Bean</ja>(properties={<js>"name"</js>})
+ <ja>@Bean</ja>(properties=<js>"name"</js>)
<jk>public class</jk> Person {
<jk>public</jk> String getName();
<jk>public void</jk> setName(String name);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java b/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
index fcbb007..0a3e1f3 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/Parser.java
@@ -148,7 +148,7 @@ public abstract class Parser extends CoreApi {
Consumes c = ReflectionUtils.getAnnotation(Consumes.class, getClass());
if (c == null)
throw new RuntimeException(MessageFormat.format("Class ''{0}'' is missing the @Consumes annotation", getClass().getName()));
- this.mediaTypes = c.value();
+ this.mediaTypes = StringUtils.split(c.value(), ',');
for (int i = 0; i < mediaTypes.length; i++) {
mediaTypes[i] = mediaTypes[i].toLowerCase(Locale.ENGLISH);
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/parser/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/package.html b/juneau-core/src/main/java/org/apache/juneau/parser/package.html
index 59c4cc8..3c38ac3 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/package.html
@@ -113,7 +113,7 @@
The following example shows a simple parser that converts input streams to images using standard JRE classes.
</p>
<p class='bcode'>
- <ja>@Consumes</ja>({<js>"image/png"</js>,<js>"image/jpeg"</js>})
+ <ja>@Consumes</ja>(<js>"image/png,image/jpeg"</js>)
<jk>public static class</jk> ImageParser <jk>extends</jk> InputStreamParser {
<ja>@Override</ja>
<jk>public</jk> <T> T parse(InputStream in, ClassMeta<T> type, ParserSession session) <jk>throws</jk> ParseException, IOException {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java b/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java
index 6895668..4c3715d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java
@@ -58,7 +58,7 @@ public abstract class Serializer extends CoreApi {
Produces p = ReflectionUtils.getAnnotation(Produces.class, getClass());
if (p == null)
throw new RuntimeException(MessageFormat.format("Class ''{0}'' is missing the @Produces annotation", getClass().getName()));
- this.mediaTypes = p.value();
+ this.mediaTypes = StringUtils.split(p.value(), ',');
for (int i = 0; i < mediaTypes.length; i++) {
mediaTypes[i] = mediaTypes[i].toLowerCase(Locale.ENGLISH);
}
@@ -68,7 +68,7 @@ public abstract class Serializer extends CoreApi {
l.addAll(Arrays.asList(MediaRange.parse(mediaTypes[i])));
mediaRanges = l.toArray(new MediaRange[l.size()]);
- String ct = p.contentType().isEmpty() ? p.value()[0] : p.contentType();
+ String ct = p.contentType().isEmpty() ? this.mediaTypes[0] : p.contentType();
contentType = ct.isEmpty() ? null : ct;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/serializer/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/package.html b/juneau-core/src/main/java/org/apache/juneau/serializer/package.html
index d19a959..06fcb84 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/package.html
@@ -114,7 +114,7 @@
The following example shows a simple serializer that converts images to output streams using standard JRE classes.
</p>
<p class='bcode'>
- <ja>@Produces</ja>({<js>"image/png"</js>,<js>"image/jpeg"</js>})
+ <ja>@Produces</ja>(<js>"image/png,image/jpeg"</js>)
<jk>public static class</jk> ImageSerializer <jk>extends</jk> OutputStreamSerializer {
<ja>@Override</ja>
<jk>public void</jk> serialize(Object o, OutputStream out, SerializerSession session) <jk>throws</jk> IOException, SerializeException {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java b/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
index ef4afa0..0739585 100644
--- a/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
@@ -16,6 +16,7 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
+import org.apache.juneau.internal.*;
/**
* Bean filter builder initialized from the contents of a {@link Bean @Bean} annotation found on a class.
@@ -40,8 +41,8 @@ public final class AnnotationBeanFilterBuilder extends BeanFilterBuilder {
while (li.hasPrevious()) {
Bean b = li.previous();
- if (b.properties().length > 0)
- setProperties(b.properties());
+ if (! b.properties().isEmpty())
+ setProperties(StringUtils.split(b.properties(), ','));
if (! b.typeName().isEmpty())
setTypeName(b.typeName());
@@ -49,8 +50,8 @@ public final class AnnotationBeanFilterBuilder extends BeanFilterBuilder {
if (b.sort())
setSortProperties(true);
- if (b.excludeProperties().length > 0)
- setExcludeProperties(b.excludeProperties());
+ if (! b.excludeProperties().isEmpty())
+ setExcludeProperties(StringUtils.split(b.excludeProperties(), ','));
if (b.propertyNamer() != PropertyNamerDefault.class)
setPropertyNamer(b.propertyNamer());
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/transform/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/package.html b/juneau-core/src/main/java/org/apache/juneau/transform/package.html
index b859e25..45b5652 100644
--- a/juneau-core/src/main/java/org/apache/juneau/transform/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/transform/package.html
@@ -139,7 +139,7 @@
Note that this is equivalent to specifying the following annotation on the bean class:
</p>
<p class='bcode'>
- <ja>@Bean</ja>(properties={<js>"age"</js>,<js>"name"</js>})
+ <ja>@Bean</ja>(properties="age,name"</js>)
<jk>public class</jk> Person {
...
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializer.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializer.java
index 8b8da03..c35489a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UonSerializer.java
@@ -187,7 +187,7 @@ public class UonSerializer extends WriterSerializer {
/**
* Equivalent to <code><jk>new</jk> UonSerializer().setProperty(UonSerializerContext.<jsf>UON_simpleMode</jsf>,<jk>true</jk>);</code>.
*/
- @Produces(value={"text/uon-simple"},contentType="text/uon")
+ @Produces(value="text/uon-simple",contentType="text/uon")
public static class Simple extends UonSerializer {
/** Constructor */
public Simple() {
@@ -219,7 +219,7 @@ public class UonSerializer extends WriterSerializer {
/**
* Equivalent to <code><jk>new</jk> UonSerializer().setProperty(UonSerializerContext.<jsf>UON_simpleMode</jsf>,<jk>true</jk>).setProperty(UonSerializerContext.<jsf>UON_encodeChars</jsf>,<jk>true</jk>);</code>.
*/
- @Produces(value={"text/uon-simple"},contentType="text/uon")
+ @Produces(value="text/uon-simple",contentType="text/uon")
public static class SimpleEncoding extends UonSerializer {
/** Constructor */
public SimpleEncoding() {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
index 714309c..5f50fff 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
@@ -191,7 +191,7 @@ public class UrlEncodingSerializer extends UonSerializer {
/**
* Equivalent to <code><jk>new</jk> UrlEncodingSerializer().setProperty(UonSerializerContext.<jsf>UON_simpleMode</jsf>,<jk>true</jk>);</code>.
*/
- @Produces(value={"application/x-www-form-urlencoded-simple"},contentType="application/x-www-form-urlencoded")
+ @Produces(value="application/x-www-form-urlencoded-simple",contentType="application/x-www-form-urlencoded")
public static class Simple extends UrlEncodingSerializer {
/** Constructor */
public Simple() {
@@ -202,7 +202,7 @@ public class UrlEncodingSerializer extends UonSerializer {
/**
* Equivalent to <code><jk>new</jk> UrlEncodingSerializer().setProperty(UonSerializerContext.<jsf>UON_simpleMode</jsf>,<jk>true</jk>).setProperty(UonSerializerContext.<jsf>URLENC_expandedParams</jsf>,<jk>true</jk>);</code>.
*/
- @Produces(value={"application/x-www-form-urlencoded-simple"},contentType="application/x-www-form-urlencoded")
+ @Produces(value="application/x-www-form-urlencoded-simple",contentType="application/x-www-form-urlencoded")
public static class SimpleExpanded extends Simple {
/** Constructor */
public SimpleExpanded() {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html b/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html
index b7cc2ec..4ccf438 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html
@@ -989,21 +989,21 @@
<p class='bcode'>
<jc>// GET person request handler</jc>
<ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/people/{id}/*"</js>, rc={200,404})
- <jk>public</jk> Person getPerson(RestRequest req, <ja>@Attr</ja> <jk>int</jk> id) throws Exception {
+ <jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
properties.put(HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, req.getPathInfo());
<jk>return</jk> findPerson(id);
}
<jc>// POST person handler</jc>
<ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/people"</js>, guards=AdminGuard.<jk>class</jk>, rc={307,404})
- <jk>public void</jk> createPerson(RestResponse res, <ja>@Content</ja> CreatePerson cp) <jk>throws</jk> Exception {
+ <jk>public void</jk> createPerson(RestResponse res, <ja>@Body</ja> CreatePerson cp) <jk>throws</jk> Exception {
Person p = addressBook.createPerson(cp);
res.sendRedirect(p.<jf>uri</jf>);
}
<jc>// DELETE person handler</jc>
<ja>@RestMethod</ja>(name=<js>"DELETE"</js>, path=<js>"/people/{id}"</js>, guards=AdminGuard.<jk>class</jk>, rc={200,404})
- <jk>public</jk> String deletePerson(RestResponse res, <ja>@Attr</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
+ <jk>public</jk> String deletePerson(RestResponse res, <ja>@Path</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
Person p = findPerson(id);
addressBook.remove(p);
<jk>return</jk> <js>"DELETE successful"</js>;
@@ -1049,7 +1049,7 @@
<ja>@Property</ja>(name=UonSerializerContext.<jsf>UON_simpleMode</jsf>, value=<js>"true"</js>)
}
)
- <jk>public</jk> Person getPerson(RestRequest req, <ja>@Attr</ja> <jk>int</jk> id) throws Exception {
+ <jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
properties.put(HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, req.getPathInfo());
<jk>return</jk> findPerson(id);
}
@@ -1075,27 +1075,27 @@
</p>
<p class='bcode'>
<ja>@Provider</ja>
- <ja>@Produces</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonSerializer</jc>
- <js>"application/json+simple"</js>,<js>"text/json+simple"</js>, <jc>// JsonSerializer.Simple</jc>
- <js>"application/json+schema"</js>,<js>"text/json+schema"</js>, <jc>// JsonSchemaSerializer</jc>
- <js>"text/xml"</js>, <jc>// XmlDocSerializer</jc>
- <js>"text/xml+simple"</js>, <jc>// XmlDocSerializer.Simple</jc>
- <js>"text/xml+schema"</js>, <jc>// XmlSchemaDocSerializer</jc>
- <js>"text/html"</js>, <jc>// HtmlDocSerializer</jc>
- <js>"text/uon"</js>, <jc>// UonSerializer</jc>
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingSerializer</jc>
- <js>"text/xml+soap"</js>, <jc>// SoapXmlSerializer</jc>
- <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectSerializer</jc>
- })
- <ja>@Consumes</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonParser</jc>
- <js>"text/xml"</js>, <jc>// XmlParser</jc>
- <js>"text/html"</js>, <jc>// HtmlParser</jc>
- <js>"text/uon"</js>, <jc>// UonParser</jc>
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingParser</jc>
- <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectParser</jc>
- })
+ <ja>@Produces</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonSerializer</jc>
+ <js>"application/json+simple,text/json+simple,"</js>+ <jc>// JsonSerializer.Simple</jc>
+ <js>"application/json+schema,text/json+schema,"</js>+ <jc>// JsonSchemaSerializer</jc>
+ <js>"text/xml,"</js>+ <jc>// XmlDocSerializer</jc>
+ <js>"text/xml+simple,"</js>+ <jc>// XmlDocSerializer.Simple</jc>
+ <js>"text/xml+schema,"</js>+ <jc>// XmlSchemaDocSerializer</jc>
+ <js>"text/html,"</js>+ <jc>// HtmlDocSerializer</jc>
+ <js>"text/uon,"</js>+ <jc>// UonSerializer</jc>
+ <js>"application/x-www-form-urlencoded,"</js>+ <jc>// UrlEncodingSerializer</jc>
+ <js>"text/xml+soap,"</js>+ <jc>// SoapXmlSerializer</jc>
+ <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectSerializer</jc>
+ )
+ <ja>@Consumes</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonParser</jc>
+ <js>"text/xml,"</js>+ <jc>// XmlParser</jc>
+ <js>"text/html,"</js>+ <jc>// HtmlParser</jc>
+ <js>"text/uon,"</js>+ <jc>// UonParser</jc>
+ <js>"application/x-www-form-urlencoded,"</js>+ <jc>// UrlEncodingParser</jc>
+ <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectParser</jc>
+ )
<ja>@JuneauProvider</ja>(
serializers={
JsonSerializer.<jk>class</jk>,
@@ -1189,12 +1189,12 @@
</p>
<p class='bcode'>
<ja>@Provider</ja>
- <ja>@Produces</ja>({
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingSerializer</jc>
- })
- <ja>@Consumes</ja>({
+ <ja>@Produces</ja>(
+ <js>"application/x-www-form-urlencoded"</js> <jc>// UrlEncodingSerializer</jc>
+ )
+ <ja>@Consumes</ja>(
<js>"application/x-www-form-urlencoded"</js> <jc>// UrlEncodingParser</jc>
- })
+ )
<ja>@JuneauProvider</ja>(
serializers={
UrlEncodingSerializer.<jk>class</jk>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/xml/Namespace.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/Namespace.java b/juneau-core/src/main/java/org/apache/juneau/xml/Namespace.java
index 7884963..3bde183 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/Namespace.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/Namespace.java
@@ -35,7 +35,7 @@ public final class Namespace implements Comparable<Namespace> {
* @param name The long and short name of this schema.
* @param uri The URI of this schema.
*/
- @BeanConstructor(properties={"name","uri"})
+ @BeanConstructor(properties="name,uri")
public Namespace(String name, String uri) {
this.name = name;
this.uri = uri;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
index 4b9b8f7..823db63 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
@@ -53,7 +53,7 @@ import org.apache.juneau.xml.annotation.*;
* @author James Bognar (james.bognar@salesforce.com)
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
-@Consumes({"text/xml","application/xml"})
+@Consumes("text/xml,application/xml")
public class XmlParser extends ReaderParser {
/** Default parser, all default settings.*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-core/src/main/java/org/apache/juneau/xml/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/package.html b/juneau-core/src/main/java/org/apache/juneau/xml/package.html
index c59df27..83eb7cb 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/package.html
@@ -1717,21 +1717,21 @@
<p class='bcode'>
<jc>// GET person request handler</jc>
<ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/people/{id}/*"</js>, rc={200,404})
- <jk>public</jk> Person getPerson(RestRequest req, <ja>@Attr</ja> <jk>int</jk> id) throws Exception {
+ <jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
properties.put(HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, req.getPathInfo());
<jk>return</jk> findPerson(id);
}
<jc>// POST person handler</jc>
<ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/people"</js>, guards=AdminGuard.<jk>class</jk>, rc={307,404})
- <jk>public void</jk> createPerson(RestResponse res, <ja>@Content</ja> CreatePerson cp) <jk>throws</jk> Exception {
+ <jk>public void</jk> createPerson(RestResponse res, <ja>@Body</ja> CreatePerson cp) <jk>throws</jk> Exception {
Person p = addressBook.createPerson(cp);
res.sendRedirect(p.<jf>uri</jf>);
}
<jc>// DELETE person handler</jc>
<ja>@RestMethod</ja>(name=<js>"DELETE"</js>, path=<js>"/people/{id}"</js>, guards=AdminGuard.<jk>class</jk>, rc={200,404})
- <jk>public</jk> String deletePerson(RestResponse res, <ja>@Attr</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
+ <jk>public</jk> String deletePerson(RestResponse res, <ja>@Path</ja> <jk>int</jk> id) <jk>throws</jk> Exception {
Person p = findPerson(id);
addressBook.remove(p);
<jk>return</jk> <js>"DELETE successful"</js>;
@@ -1777,7 +1777,7 @@
<ja>@Property</ja>(name=SerializerContext.<jsf>SERIALIZER_quoteChar</jsf>, value=<js>"'"</js>)
}
)
- <jk>public</jk> Person getPerson(RestRequest req, <ja>@Attr</ja> <jk>int</jk> id) throws Exception {
+ <jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
properties.put(HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, req.getPathInfo());
<jk>return</jk> findPerson(id);
}
@@ -1803,25 +1803,25 @@
</p>
<p class='bcode'>
<ja>@Provider</ja>
- <ja>@Produces</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonSerializer</jc>
- <js>"application/json+simple"</js>,<js>"text/json+simple"</js>, <jc>// JsonSerializer.Simple</jc>
- <js>"application/json+schema"</js>,<js>"text/json+schema"</js>, <jc>// JsonSchemaSerializer</jc>
- <js>"text/xml"</js>, <jc>// XmlDocSerializer</jc>
- <js>"text/xml+simple"</js>, <jc>// XmlDocSerializer.Simple</jc>
- <js>"text/xml+schema"</js>, <jc>// XmlSchemaDocSerializer</jc>
- <js>"text/html"</js>, <jc>// HtmlDocSerializer</jc>
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingSerializer</jc>
- <js>"text/xml+soap"</js>, <jc>// SoapXmlSerializer</jc>
- <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectSerializer</jc>
- })
- <ja>@Consumes</ja>({
- <js>"application/json"</js>, <js>"text/json"</js>, <jc>// JsonParser</jc>
- <js>"text/xml"</js>, <jc>// XmlParser</jc>
- <js>"text/html"</js>, <jc>// HtmlParser</jc>
- <js>"application/x-www-form-urlencoded"</js>, <jc>// UrlEncodingParser</jc>
- <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectParser</jc>
- })
+ <ja>@Produces</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonSerializer</jc>
+ <js>"application/json+simple,text/json+simple,"</js>+ <jc>// JsonSerializer.Simple</jc>
+ <js>"application/json+schema,text/json+schema,"</js>+ <jc>// JsonSchemaSerializer</jc>
+ <js>"text/xml,"</js>+ <jc>// XmlDocSerializer</jc>
+ <js>"text/xml+simple,"</js>+ <jc>// XmlDocSerializer.Simple</jc>
+ <js>"text/xml+schema,"</js>+ <jc>// XmlSchemaDocSerializer</jc>
+ <js>"text/html,"</js>+ <jc>// HtmlDocSerializer</jc>
+ <js>"application/x-www-form-urlencoded,"</js>+ <jc>// UrlEncodingSerializer</jc>
+ <js>"text/xml+soap,"</js>+ <jc>// SoapXmlSerializer</jc>
+ <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectSerializer</jc>
+ )
+ <ja>@Consumes</ja>(
+ <js>"application/json,text/json,"</js>+ <jc>// JsonParser</jc>
+ <js>"text/xml,"</js>+ <jc>// XmlParser</jc>
+ <js>"text/html,"</js>+ <jc>// HtmlParser</jc>
+ <js>"application/x-www-form-urlencoded,"</js>+ <jc>// UrlEncodingParser</jc>
+ <js>"application/x-java-serialized-object"</js> <jc>// JavaSerializedObjectParser</jc>
+ )
<ja>@JuneauProvider</ja>(
serializers={
JsonSerializer.<jk>class</jk>,
@@ -1913,13 +1913,13 @@
</p>
<p class='bcode'>
<ja>@Provider</ja>
- <ja>@Produces</ja>({
- <js>"text/xml"</js>, <jc>// XmlDocSerializer</jc>
- <js>"text/xml+simple"</js>, <jc>// XmlDocSerializer.Simple</jc>
- })
- <ja>@Consumes</ja>({
- <js>"text/xml"</js>, <jc>// XmlParser</jc>
- })
+ <ja>@Produces</ja>(
+ <js>"text/xml,"</js>+ <jc>// XmlDocSerializer</jc>
+ <js>"text/xml+simple"</js> <jc>// XmlDocSerializer.Simple</jc>
+ )
+ <ja>@Consumes</ja>(
+ <js>"text/xml"</js> <jc>// XmlParser</jc>
+ )
<ja>@JuneauProvider</ja>(
serializers={
XmlDocSerializer.<jk>class</jk>,