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/10 00:28:22 UTC
[1/8] incubator-juneau git commit: Doc updates.
Repository: incubator-juneau
Updated Branches:
refs/heads/master 8dde0c9db -> cc399df57
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestAttrVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestAttrVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestAttrVar.java
deleted file mode 100644
index 2b250d7..0000000
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestAttrVar.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.server.vars;
-
-import org.apache.juneau.server.*;
-import org.apache.juneau.svl.*;
-
-/**
- * Request attribute variable resolver.
- * <p>
- * The format for this var is <js>"$A{key}"</js> or <js>"$A{key,defaultValue}"</js>.
- * <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.
- * <p>
- * Values are pulled from the {@link RestRequest#getAttribute(String)} method.
- * <p>
- * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively resolved.
- * Likewise, if the arguments contain any variables, those will be resolved before they are passed to this var.
- *
- * @see org.apache.juneau.svl
- * @author James Bognar (james.bognar@salesforce.com)
- */
-public class RequestAttrVar extends DefaultingVar {
-
- /**
- * Constructor.
- */
- public RequestAttrVar() {
- super("A");
- }
-
- @Override /* Var */
- public String resolve(VarResolverSession session, String key) {
- RestRequest req = session.getSessionObject(RestRequest.class, RequestVar.SESSION_req);
- Object o = req.getAttribute(key);
- return (o == null ? "" : o.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestParamVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestParamVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestParamVar.java
deleted file mode 100644
index 34b888f..0000000
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestParamVar.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.server.vars;
-
-import org.apache.juneau.server.*;
-import org.apache.juneau.svl.*;
-
-/**
- * Request parameter variable resolver.
- * <p>
- * The format for this var is <js>"$P{key}"</js> or <js>"$P{key,defaultValue}"</js>.
- * <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.
- * <p>
- * Values are pulled from the {@link RestRequest#getParameter(String)} method.
- * <p>
- * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively resolved.
- * Likewise, if the arguments contain any variables, those will be resolved before they are passed to this var.
- *
- * @see org.apache.juneau.svl
- * @author James Bognar (james.bognar@salesforce.com)
- */
-public class RequestParamVar extends DefaultingVar {
-
- /**
- * Constructor.
- */
- public RequestParamVar() {
- super("P");
- }
-
- @Override /* Var */
- public String resolve(VarResolverSession session, String key) {
- return session.getSessionObject(RestRequest.class, RequestVar.SESSION_req).getParameter(key);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java
index d4c0150..a5e2d0f 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.server.vars;
+import org.apache.juneau.internal.*;
import org.apache.juneau.server.*;
import org.apache.juneau.svl.*;
@@ -58,10 +59,25 @@ public class RequestVar extends SimpleVar {
super("R");
}
- @Override /* Var */
+ @Override /* Parameter */
public String resolve(VarResolverSession session, String key) {
RestRequest req = session.getSessionObject(RestRequest.class, SESSION_req);
if (key.length() > 0) {
+ String k = key.toString();
+ if (k.indexOf('.') != -1) {
+ String prefix = k.substring(0, k.indexOf('.'));
+ String remainder = k.substring(k.indexOf('.')+1);
+ if ("path".equals(prefix))
+ return req.getPathParameter(remainder);
+ if ("query".equals(prefix))
+ return req.getQueryParameter(remainder);
+ if ("formData".equals(prefix))
+ return req.getFormDataParameter(remainder);
+ if ("header".equals(prefix))
+ return req.getHeader(remainder);
+ if ("attribute".equals(prefix))
+ return StringUtils.toString(req.getAttribute(remainder));
+ }
char c = key.charAt(0);
if (c == 'c') {
if (key.equals("contextPath"))
@@ -69,6 +85,8 @@ public class RequestVar extends SimpleVar {
} else if (c == 'm') {
if (key.equals("method"))
return req.getMethod();
+ if (key.equals("methodSummary"))
+ return req.getMethodSummary();
if (key.equals("methodDescription"))
return req.getMethodDescription();
} else if (c == 'p') {
@@ -99,6 +117,7 @@ public class RequestVar extends SimpleVar {
Object o = req.getProperties().get(key);
if (o != null)
return o.toString();
+ return req.getPathParameter(key);
}
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
index dd292ed..37f2c26 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
@@ -14,7 +14,6 @@ package org.apache.juneau.server.vars;
import java.io.*;
-import org.apache.juneau.annotation.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.server.*;
@@ -23,16 +22,13 @@ 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}"</js> or <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
+ * 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.
* <p>
- * Similar to the {@link RequestAttrVar} class except uses the {@link RestRequest#getAttribute(String)} object
- * and passes the value to the {@link Serializer} whose {@link Produces @Produces} annotation matches the specified content type.
- * <p>
- * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively resolved.
- * Likewise, if the arguments contain any variables, those will be resolved before they are passed to this var.
+ * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively resolved.
+ * Likewise, if the arguments contain any variables, those will be resolved before they are passed to this var.
*
* @see org.apache.juneau.svl
* @author James Bognar (james.bognar@salesforce.com)
@@ -46,16 +42,16 @@ public class SerializedRequestAttrVar extends StreamedVar {
super("SA");
}
- @Override /* Var */
+ @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 $SP var. Must be of the format $SP{contentType,key[,defaultValue]}");
+ throw new RuntimeException("Invalid format for $SA var. Must be of the format $SA{contentType,key[,defaultValue]}");
String[] s2 = StringUtils.split(key, ',');
RestRequest req = session.getSessionObject(RestRequest.class, RequestVar.SESSION_req);
if (req != null) {
- Object o = req.getParameter(key, Object.class);
+ Object o = req.getAttribute(key);
if (o == null)
o = key;
Serializer s = req.getSerializerGroup().getSerializer(s2[0]);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestParamVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestParamVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestParamVar.java
deleted file mode 100644
index 8e86250..0000000
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestParamVar.java
+++ /dev/null
@@ -1,69 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.server.vars;
-
-import java.io.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.internal.*;
-import org.apache.juneau.serializer.*;
-import org.apache.juneau.server.*;
-import org.apache.juneau.svl.*;
-
-/**
- * Serialized request parameter variable resolver.
- * <p>
- * The format for this var is <js>"$SP{contentType,key}"</js> or <js>"$SP{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
- * session object on the resolver session.
- * <p>
- * Similar to the {@link RequestParamVar} class except uses the {@link RestRequest#getParameter(String)} object
- * and passes the value to the {@link Serializer} whose {@link Produces @Produces} annotation matches the specified content type.
- * <p>
- * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively resolved.
- * Likewise, if the arguments contain any variables, those will be resolved before they are passed to this var.
- *
- * @see org.apache.juneau.svl
- * @author James Bognar (james.bognar@salesforce.com)
- */
-public class SerializedRequestParamVar extends StreamedVar {
-
- /**
- * Constructor.
- */
- public SerializedRequestParamVar() {
- super("SP");
- }
-
- @Override /* Var */
- public void resolveTo(VarResolverSession session, Writer w, String key) {
- try {
- int i = key.indexOf(',');
- if (i == -1)
- throw new RuntimeException("Invalid format for $SP var. Must be of the format $SP{contentType,key[,defaultValue]}");
- String[] s2 = StringUtils.split(key, ',');
- RestRequest req = session.getSessionObject(RestRequest.class, RequestVar.SESSION_req);
- if (req != null) {
- Object o = req.getParameter(key, Object.class);
- 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);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
index 66303d0..de092cf 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
@@ -40,7 +40,7 @@ public class ServletInitParamVar extends DefaultingVar {
super("I");
}
- @Override /* Var */
+ @Override /* Parameter */
public String resolve(VarResolverSession session, String key) {
return session.getSessionObject(RestRequest.class, RequestVar.SESSION_req).getServlet().getServletConfig().getInitParameter(key);
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java
index 6846aca..35ee8b1 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java
@@ -37,7 +37,7 @@ public class UrlEncodeVar extends SimpleVar {
super("UE");
}
- @Override /* Var */
+ @Override /* Parameter */
public String resolve(VarResolverSession session, String key) {
return RestUtils.encode(key);
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css b/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css
index d01de24..c0c45b7 100755
--- a/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css
+++ b/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css
@@ -109,8 +109,8 @@ div.data {
div.data td {
vertical-align: top;
- border-bottom:1px solid #E9EACB;
- border-right:1px solid #E9EACB;
+ border-bottom:1px solid #d9dcde;
+ border-right:1px solid #d9dcde;
padding:0.2em 0.5em;
color:#26343F;
font-size:12px;
@@ -141,11 +141,11 @@ a:hover {
}
th, .header {
- border-top:1px solid #CCCC99;
+ border-top:1px solid #d9dcde;
padding: 4px 8px;
font-weight: bold;
text-align:center;
- background-color: #e9eacb;
+ background-color: rgb(244,246,249);
font-family: sans-serif;
font-size: 12px;
color: #26343f;
[8/8] incubator-juneau git commit: Doc updates.
Posted by ja...@apache.org.
Doc updates.
Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/cc399df5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/cc399df5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/cc399df5
Branch: refs/heads/master
Commit: cc399df5744c7830798db96dfb3b0e84af09d732
Parents: 8dde0c9
Author: JamesBognar <ja...@apache.org>
Authored: Sun Oct 9 20:27:54 2016 -0400
Committer: JamesBognar <ja...@apache.org>
Committed: Sun Oct 9 20:28:10 2016 -0400
----------------------------------------------------------------------
.../apache/juneau/client/NameValuePairs.java | 2 +-
.../apache/juneau/client/ResponsePattern.java | 4 +-
.../java/org/apache/juneau/client/RestCall.java | 42 +-
.../juneau/client/SerializedNameValuePair.java | 4 +-
.../java/org/apache/juneau/client/package.html | 2 +-
.../java/org/apache/juneau/BeanContext.java | 36 +-
.../main/java/org/apache/juneau/BeanMap.java | 18 +-
.../java/org/apache/juneau/BeanMapEntry.java | 2 +-
.../main/java/org/apache/juneau/MediaRange.java | 4 +-
.../main/java/org/apache/juneau/ObjectList.java | 12 +-
.../main/java/org/apache/juneau/ObjectMap.java | 72 +-
.../apache/juneau/PropertyNamerDashedLC.java | 4 +-
.../org/apache/juneau/PropertyNamerDefault.java | 4 +-
.../main/java/org/apache/juneau/Visibility.java | 3 +-
.../java/org/apache/juneau/annotation/Bean.java | 61 +-
.../apache/juneau/annotation/BeanProperty.java | 42 +-
.../org/apache/juneau/annotation/Consumes.java | 2 +-
.../java/org/apache/juneau/annotation/Pojo.java | 2 +-
.../org/apache/juneau/annotation/Produces.java | 2 +-
.../java/org/apache/juneau/annotation/URI.java | 2 +-
.../org/apache/juneau/dto/cognos/DataSet.java | 2 +-
.../org/apache/juneau/dto/cognos/package.html | 4 +-
.../apache/juneau/dto/jsonschema/JsonType.java | 2 +-
.../org/apache/juneau/dto/swagger/Contact.java | 4 +-
.../dto/swagger/ExternalDocumentation.java | 6 +-
.../org/apache/juneau/dto/swagger/Header.java | 582 -------
.../apache/juneau/dto/swagger/HeaderInfo.java | 582 +++++++
.../org/apache/juneau/dto/swagger/Info.java | 6 +-
.../org/apache/juneau/dto/swagger/Items.java | 6 +-
.../org/apache/juneau/dto/swagger/License.java | 6 +-
.../apache/juneau/dto/swagger/Operation.java | 24 +-
.../apache/juneau/dto/swagger/Parameter.java | 776 ----------
.../juneau/dto/swagger/ParameterInfo.java | 776 ++++++++++
.../org/apache/juneau/dto/swagger/Response.java | 194 ---
.../apache/juneau/dto/swagger/ResponseInfo.java | 194 +++
.../org/apache/juneau/dto/swagger/Schema.java | 718 ---------
.../apache/juneau/dto/swagger/SchemaInfo.java | 718 +++++++++
.../juneau/dto/swagger/SecurityScheme.java | 6 +-
.../org/apache/juneau/dto/swagger/Swagger.java | 56 +-
.../java/org/apache/juneau/dto/swagger/Tag.java | 6 +-
.../apache/juneau/encoders/EncoderGroup.java | 2 +-
.../juneau/html/HtmlDocSerializerContext.java | 28 +-
.../org/apache/juneau/html/HtmlSerializer.java | 5 +-
.../apache/juneau/html/SimpleHtmlWriter.java | 4 +-
.../java/org/apache/juneau/ini/ConfigFile.java | 14 +-
.../java/org/apache/juneau/ini/ConfigMgr.java | 4 +-
.../java/org/apache/juneau/ini/package.html | 4 +-
.../org/apache/juneau/internal/ClassUtils.java | 4 +-
.../org/apache/juneau/internal/StringUtils.java | 14 +-
.../apache/juneau/jena/RdfCommonContext.java | 6 +-
.../juneau/jena/annotation/RdfSchema.java | 6 +-
.../org/apache/juneau/json/JsonSerializer.java | 3 +-
.../org/apache/juneau/json/annotation/Json.java | 30 +-
.../java/org/apache/juneau/json/package.html | 6 +-
.../java/org/apache/juneau/parser/Parser.java | 60 +-
.../org/apache/juneau/parser/ParserGroup.java | 2 +-
.../juneau/serializer/SerializerContext.java | 86 +-
.../juneau/serializer/SerializerGroup.java | 2 +-
.../juneau/serializer/SerializerWriter.java | 2 +-
.../apache/juneau/serializer/StringObject.java | 2 +-
.../java/org/apache/juneau/svl/package.html | 3 -
.../juneau/transform/BeanFilterBuilder.java | 2 +-
.../apache/juneau/transforms/CalendarSwap.java | 59 +-
.../org/apache/juneau/transforms/DateSwap.java | 44 +-
.../juneau/urlencoding/UonSerializer.java | 2 +-
.../urlencoding/UrlEncodingParserContext.java | 4 +-
.../urlencoding/UrlEncodingSerializer.java | 2 +-
.../UrlEncodingSerializerContext.java | 4 +-
.../org/apache/juneau/urlencoding/package.html | 8 +-
.../main/java/org/apache/juneau/utils/Args.java | 20 +-
.../apache/juneau/utils/PojoIntrospector.java | 4 +-
.../java/org/apache/juneau/utils/PojoQuery.java | 14 +-
.../java/org/apache/juneau/utils/PojoRest.java | 4 +-
.../org/apache/juneau/utils/ProcBuilder.java | 3 +-
.../org/apache/juneau/xml/annotation/Xml.java | 61 +-
.../apache/juneau/xml/annotation/XmlSchema.java | 26 +-
.../doc-files/Samples.AddressBookResource.2.png | Bin 224346 -> 0 bytes
.../Samples.AddressBookResource.Options.png | Bin 0 -> 1029216 bytes
.../doc-files/Samples.ConfigResource.2.png | Bin 42599 -> 0 bytes
.../doc-files/Samples.HelloWorldResource.3.png | Bin 66934 -> 0 bytes
.../Samples.MethodExampleResource.2.png | Bin 71023 -> 322100 bytes
.../src/main/javadoc/doc-files/Server.Html.png | Bin 52497 -> 122741 bytes
.../main/javadoc/doc-files/Server.Options.png | Bin 67005 -> 583155 bytes
.../Server.SystemPropertiesResource.png | Bin 0 -> 98276 bytes
juneau-core/src/main/javadoc/overview.html | 406 +++--
.../juneau/microservice/Microservice.java | 37 +-
.../org/apache/juneau/microservice/package.html | 21 +-
.../microservice/resources/ConfigResource.java | 20 +-
.../resources/DirectoryResource.java | 2 +-
.../server/samples/MethodExampleResource.java | 12 +-
.../juneau/server/samples/RootResources.java | 1 +
.../samples/SystemPropertiesResource.java | 153 ++
.../nls/AddressBookResource.properties | 2 +-
.../apache/juneau/server/test/NlsResource.java | 32 +-
.../server/test/OverlappingMethodsResource.java | 8 +-
.../juneau/server/test/ParamsResource.java | 12 +-
.../apache/juneau/server/ReaderResource.java | 5 +-
.../org/apache/juneau/server/RestConverter.java | 2 +-
.../org/apache/juneau/server/RestGuard.java | 4 +-
.../org/apache/juneau/server/RestMatcher.java | 2 +-
.../org/apache/juneau/server/RestRequest.java | 1433 +++++++++---------
.../org/apache/juneau/server/RestResponse.java | 8 +-
.../org/apache/juneau/server/RestServlet.java | 118 +-
.../apache/juneau/server/annotation/Body.java | 4 +-
.../juneau/server/annotation/FormData.java | 6 +-
.../juneau/server/annotation/HasFormData.java | 5 +-
.../juneau/server/annotation/HasQuery.java | 2 +-
.../apache/juneau/server/annotation/Header.java | 2 +-
.../juneau/server/annotation/Messages.java | 2 +-
.../apache/juneau/server/annotation/Method.java | 2 +-
.../juneau/server/annotation/Parameter.java | 182 +++
.../apache/juneau/server/annotation/Path.java | 2 +-
.../juneau/server/annotation/PathRemainder.java | 2 +-
.../juneau/server/annotation/Properties.java | 2 +-
.../apache/juneau/server/annotation/Query.java | 2 +-
.../juneau/server/annotation/Response.java | 13 +-
.../juneau/server/annotation/RestMethod.java | 63 +-
.../juneau/server/annotation/RestResource.java | 139 +-
.../apache/juneau/server/annotation/Var.java | 150 --
.../server/converters/Introspectable.java | 4 +-
.../doc-files/HelloWorldResourceOptions.png | Bin 67692 -> 172104 bytes
.../doc-files/HelloWorldResourceOptionsJson.png | Bin 27940 -> 167174 bytes
.../org/apache/juneau/server/jaxrs/package.html | 2 +-
.../server/labels/ResourceDescription.java | 2 +-
.../java/org/apache/juneau/server/package.html | 159 +-
.../juneau/server/vars/LocalizationVar.java | 2 +-
.../juneau/server/vars/RequestAttrVar.java | 49 -
.../juneau/server/vars/RequestParamVar.java | 47 -
.../apache/juneau/server/vars/RequestVar.java | 21 +-
.../server/vars/SerializedRequestAttrVar.java | 18 +-
.../server/vars/SerializedRequestParamVar.java | 69 -
.../juneau/server/vars/ServletInitParamVar.java | 2 +-
.../apache/juneau/server/vars/UrlEncodeVar.java | 2 +-
.../org/apache/juneau/server/styles/devops.css | 8 +-
134 files changed, 4417 insertions(+), 4356 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-client/src/main/java/org/apache/juneau/client/NameValuePairs.java
----------------------------------------------------------------------
diff --git a/juneau-client/src/main/java/org/apache/juneau/client/NameValuePairs.java b/juneau-client/src/main/java/org/apache/juneau/client/NameValuePairs.java
index c8e5458..54a769b 100755
--- a/juneau-client/src/main/java/org/apache/juneau/client/NameValuePairs.java
+++ b/juneau-client/src/main/java/org/apache/juneau/client/NameValuePairs.java
@@ -21,7 +21,7 @@ import org.apache.http.client.entity.*;
* Convenience class for constructing instances of <code>List<NameValuePair></code>
* for the {@link UrlEncodedFormEntity} class.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* NameValuePairs params = <jk>new</jk> NameValuePairs()
* .append(<jk>new</jk> BasicNameValuePair(<js>"j_username"</js>, user))
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-client/src/main/java/org/apache/juneau/client/ResponsePattern.java
----------------------------------------------------------------------
diff --git a/juneau-client/src/main/java/org/apache/juneau/client/ResponsePattern.java b/juneau-client/src/main/java/org/apache/juneau/client/ResponsePattern.java
index 428db6f..7620cf9 100755
--- a/juneau-client/src/main/java/org/apache/juneau/client/ResponsePattern.java
+++ b/juneau-client/src/main/java/org/apache/juneau/client/ResponsePattern.java
@@ -19,8 +19,8 @@ import java.util.regex.*;
* Used to find regular expression matches in REST responses made through {@link RestCall}.
* <p>
* Response patterns are applied to REST calls through the {@link RestCall#addResponsePattern(ResponsePattern)} method.
- * <p>
- * <h6 class='topic'>Example</h6>
+ *
+ * <h6 class='topic'>Example:</h6>
* This example shows how to use a response pattern finder to find and capture patterns for <js>"x=number"</js> and <js>"y=string"</js>
* from a response body.
* <p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-client/src/main/java/org/apache/juneau/client/RestCall.java
----------------------------------------------------------------------
diff --git a/juneau-client/src/main/java/org/apache/juneau/client/RestCall.java b/juneau-client/src/main/java/org/apache/juneau/client/RestCall.java
index 506f3a3..6e2b937 100755
--- a/juneau-client/src/main/java/org/apache/juneau/client/RestCall.java
+++ b/juneau-client/src/main/java/org/apache/juneau/client/RestCall.java
@@ -341,17 +341,13 @@ public final class RestCall {
* This method uses {@link #getCapturedResponse()} to read the response text and so does not affect the other output
* methods such as {@link #getResponseAsString()}.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Throw a RestCallException if FAILURE or ERROR is found in the output.</jc>
* restClient.doGet(<jsf>URL</jsf>)
* .failurePattern(<js>"FAILURE|ERROR"</js>)
* .run();
* </p>
- * </dd>
- * </dl>
*
* @param errorPattern A regular expression to look for in the response output.
* @return This object (for method chaining).
@@ -376,17 +372,13 @@ public final class RestCall {
* This method uses {@link #getCapturedResponse()} to read the response text and so does not affect the other output
* methods such as {@link #getResponseAsString()}.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Throw a RestCallException if SUCCESS is not found in the output.</jc>
* restClient.doGet(<jsf>URL</jsf>)
* .successPattern(<js>"SUCCESS"</js>)
* .run();
* </p>
- * </dd>
- * </dl>
*
* @param successPattern A regular expression to look for in the response output.
* @return This object (for method chaining).
@@ -456,9 +448,7 @@ public final class RestCall {
* The response entity is discarded unless one of the pipe methods have been specified to pipe the
* output to an output stream or writer.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jk>try</jk> {
* RestClient client = <jk>new</jk> RestClient();
@@ -468,8 +458,6 @@ public final class RestCall {
* <jc>// Failed!</jc>
* }
* </p>
- * </dd>
- * </dl>
*
* @return This object (for method chaining).
* @throws RestCallException If an exception or non-200 response code occurred during the connection attempt.
@@ -788,22 +776,19 @@ public final class RestCall {
/**
* Convenience method when you want to parse into a Map<K,V> object.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* Map<String,MyBean> m = client.doGet(url).getResponseMap(LinkedHashMap.<jk>class</jk>, String.<jk>class</jk>, MyBean.<jk>class</jk>);
* </p>
- * <p>
- * A simpler approach is often to just extend the map class you want and just use the normal {@link #getResponse(Class)} method:
- * </p>
+ * <p>
+ * A simpler approach is often to just extend the map class you want and just use the normal {@link #getResponse(Class)} method:
+ * </p>
* <p class='bcode'>
* <jk>public static class</jk> MyMap <jk>extends</jk> LinkedHashMap<String,MyBean> {}
*
* Map<String,MyBean> m = client.doGet(url).getResponse(MyMap.<jk>class</jk>);
* </p>
- * </dd>
- * </dl>
*
* @param mapClass The map class to use (e.g. <code>TreeMap</code>)
* @param keyClass The class type of the keys (e.g. <code>String</code>)
@@ -820,22 +805,19 @@ public final class RestCall {
/**
* Convenience method when you want to parse into a Collection<E> object.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* List<MyBean> l = client.doGet(url).getResponseCollection(LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>);
* </p>
- * <p>
- * A simpler approach is often to just extend the collection class you want and just use the normal {@link #getResponse(Class)} method:
+ * <p>
+ * A simpler approach is often to just extend the collection class you want and just use the normal {@link #getResponse(Class)} method:
* </p>
* <p class='bcode'>
* <jk>public static class</jk> MyList <jk>extends</jk> LinkedList<MyBean> {}
*
* List<MyBean> l = client.doGet(url).getResponse(MyList.<jk>class</jk>);
* </p>
- * </dd>
- * </dl>
*
* @param collectionClass The collection class to use (e.g. <code>LinkedList</code>)
* @param entryClass The class type of the values (e.g. <code>MyBean</code>)
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-client/src/main/java/org/apache/juneau/client/SerializedNameValuePair.java
----------------------------------------------------------------------
diff --git a/juneau-client/src/main/java/org/apache/juneau/client/SerializedNameValuePair.java b/juneau-client/src/main/java/org/apache/juneau/client/SerializedNameValuePair.java
index a8fc465..40d9b09 100755
--- a/juneau-client/src/main/java/org/apache/juneau/client/SerializedNameValuePair.java
+++ b/juneau-client/src/main/java/org/apache/juneau/client/SerializedNameValuePair.java
@@ -23,8 +23,8 @@ import org.apache.juneau.urlencoding.*;
/**
* Subclass of {@link NameValuePair} for serializing POJOs as URL-encoded form post entries
* using the {@link UrlEncodingSerializer class}.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* NameValuePairs params = <jk>new</jk> NameValuePairs()
* .append(<jk>new</jk> SerializedNameValuePair(<js>"myPojo"</js>, pojo, UrlEncodingSerializer.<jsf>DEFAULT_SIMPLE</jsf>))
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-client/src/main/java/org/apache/juneau/client/package.html
----------------------------------------------------------------------
diff --git a/juneau-client/src/main/java/org/apache/juneau/client/package.html b/juneau-client/src/main/java/org/apache/juneau/client/package.html
index 9e05091..aa4a893 100755
--- a/juneau-client/src/main/java/org/apache/juneau/client/package.html
+++ b/juneau-client/src/main/java/org/apache/juneau/client/package.html
@@ -110,7 +110,7 @@
<li><code>httpcore-4.4.1.jar</code>
<li><code>httpmime-4.5.jar</code>
</ul>
- <h6 class='topic'>Examples</h6>
+ <h6 class='topic'>Example:</h6>
<p class='bcode'>
<jc>// Examples below use the Juneau Address Book resource example</jc>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
index 8d6dc2d..7e7d5fb 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
@@ -69,7 +69,7 @@ import org.apache.juneau.transform.*;
* <p>
* Settings are specified using the {@link ContextFactory#setProperty(String, Object)} method and related convenience methods.
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a context from scratch.</jc>
* BeanContext beanContext = ContextFactory.<jsm>create</jsm>()
@@ -280,7 +280,7 @@ import org.apache.juneau.transform.*;
* </ol>
*
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// A sample bean class</jc>
* <jk>public class</jk> Person {
@@ -307,7 +307,7 @@ import org.apache.juneau.transform.*;
* <p>
* This package contains annotations that can be applied to
* class definitions to override what properties are detected on a bean.
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Bean class definition where only property 'name' is detected.</jc>
* <ja>@Bean</ja>(properties=<js>"name"</js>)
@@ -1078,15 +1078,11 @@ public class BeanContext extends Context {
* <p>
* If object is not a true bean, then throws a {@link BeanRuntimeException} with an explanation of why it's not a bean.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a bean map around a bean instance</jc>
* BeanMap<Person> bm = BeanContext.<jsf>DEFAULT</jsf>.forBean(<jk>new</jk> Person());
* </p>
- * </dd>
- * </dl>
*
* @param <T> The class of the object being wrapped.
* @param o The object to wrap in a map interface. Must not be null.
@@ -1124,9 +1120,7 @@ public class BeanContext extends Context {
* <p>
* If object is not a true bean, throws a {@link BeanRuntimeException} with an explanation of why it's not a bean.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a bean map for new bean using only properties defined in a superclass</jc>
* BeanMap<MySubBean> bm = BeanContext.<jsf>DEFAULT</jsf>.forBean(<jk>new</jk> MySubBean(), MySuperBean.<jk>class</jk>);
@@ -1134,8 +1128,6 @@ public class BeanContext extends Context {
* <jc>// Construct a bean map for new bean using only properties defined in an interface</jc>
* BeanMap<MySubBean> bm = BeanContext.<jsf>DEFAULT</jsf>.forBean(<jk>new</jk> MySubBean(), MySuperInterface.<jk>class</jk>);
* </p>
- * </dd>
- * </dl>
*
* @param <T> The class of the object being wrapped.
* @param o The object to wrap in a bean interface. Must not be null.
@@ -1166,15 +1158,11 @@ public class BeanContext extends Context {
* <p>
* If object is not a true bean, then throws a {@link BeanRuntimeException} with an explanation of why it's not a bean.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a new bean map wrapped around a new Person object</jc>
* BeanMap<Person> bm = BeanContext.<jsf>DEFAULT</jsf>.newBeanMap(Person.<jk>class</jk>);
* </p>
- * </dd>
- * </dl>
*
* @param <T> The class of the object being wrapped.
* @param c The name of the class to create a new instance of.
@@ -1212,15 +1200,11 @@ public class BeanContext extends Context {
* Creates a new empty bean of the specified type, except used for instantiating inner member classes that must
* be instantiated within another class instance.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a new instance of the specified bean class</jc>
* Person p = BeanContext.<jsf>DEFAULT</jsf>.newBean(Person.<jk>class</jk>);
* </p>
- * </dd>
- * </dl>
*
* @param <T> The class type of the bean being created.
* @param c The class type of the bean being created.
@@ -1680,17 +1664,13 @@ public class BeanContext extends Context {
/**
* Converts class name strings to ClassMeta objects.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <ul>
* <li><js>"java.lang.String"</js>
* <li><js>"com.ibm.sample.MyBean[]"</js>
* <li><js>"java.util.HashMap<java.lang.String,java.lang.Integer>"</js>
* <li><js>"[Ljava.lang.String;"</js> (i.e. the value of <code>String[].<jk>class</jk>.getName()</code>)
* </ul>
- * </dd>
- * </dl>
*
* @param s The class name.
* @return The ClassMeta corresponding to the class name string.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/BeanMap.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanMap.java b/juneau-core/src/main/java/org/apache/juneau/BeanMap.java
index ab3a9c0..5410b90 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanMap.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanMap.java
@@ -162,9 +162,7 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
* {@link BeanProperty#swap() @BeanProperty.swap()} annotation, the value being passed in must be
* a String containing an ISO8601 date-time string value.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a bean with a 'birthDate' Date field</jc>
* Person p = <jk>new</jk> Person();
@@ -178,8 +176,6 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
* <jc>// Set the field</jc>
* myBeanMap.put(<js>"birthDate"</js>, <js>"'1901-03-03T04:05:06-5000'"</js>);
* </p>
- * </dd>
- * </dl>
*
* @param property The name of the property to set.
* @param value The value to set the property to.
@@ -246,9 +242,7 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
* {@link BeanProperty#swap() @BeanProperty.swap()} annotation, this method will return a String
* containing an ISO8601 date-time string value.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a bean with a 'birthDate' Date field</jc>
* Person p = <jk>new</jk> Person();
@@ -263,8 +257,6 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
* <jc>// Get the field as a string (i.e. "'1901-03-03T04:05:06-5000'")</jc>
* String s = myBeanMap.get(<js>"birthDate"</js>);
* </p>
- * </dd>
- * </dl>
*
* @param property The name of the property to get.
* @throws RuntimeException if any of the following occur.
@@ -291,14 +283,10 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
* depends on the default parser specified by the {@link BeanContext#BEAN_defaultParser} property
* value on the config that created the context that created this map.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* aPersonBean.load(<js>"{name:'John Smith',age:21}"</js>)
* </p>
- * </dd>
- * </dl>
*
* @param input The text that will get parsed into a map and then added to this map.
* @return This object (for method chaining).
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java b/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java
index 5730005..b2c5ded 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java
@@ -22,7 +22,7 @@ import org.apache.juneau.transform.*;
* <p>
* This class can be used to get and set property values on a bean, or to get metadata on a property.
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a new bean</jc>
* Person p = <jk>new</jk> Person();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/MediaRange.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/MediaRange.java b/juneau-core/src/main/java/org/apache/juneau/MediaRange.java
index 9f84421..36d862f 100644
--- a/juneau-core/src/main/java/org/apache/juneau/MediaRange.java
+++ b/juneau-core/src/main/java/org/apache/juneau/MediaRange.java
@@ -28,8 +28,8 @@ public final class MediaRange implements Comparable<MediaRange> {
/**
* Returns the media type enclosed by this media range.
- * <p>
- * Examples:
+ *
+ * <h6 class='topic'>Examples:</h6>
* <ul>
* <li><js>"text/html"</js>
* <li><js>"text/*"</js>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/ObjectList.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ObjectList.java b/juneau-core/src/main/java/org/apache/juneau/ObjectList.java
index aad705a..a95d578 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ObjectList.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ObjectList.java
@@ -32,7 +32,7 @@ import org.apache.juneau.utils.*;
* constructor is provided for converting a JSON array string directly into a {@link List}. It also contains
* accessor methods for to avoid common typecasting when accessing elements in a list.
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct an empty List</jc>
* List l = <jk>new</jk> ObjectList();
@@ -458,10 +458,8 @@ public class ObjectList extends LinkedList<Object> {
* <p>
* See {@link BeanContext#convertToType(Object, ClassMeta)} for a description of valid conversions.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Iterate over a list of ObjectMaps.</jc>
* ObjectList l = <jk>new</jk> ObjectList(<js>"[{foo:'bar'},{baz:123}]"</js>);
* for (ObjectMap m : l.elements(ObjectMap.<jk>class</jk>)) {
@@ -480,9 +478,7 @@ public class ObjectList extends LinkedList<Object> {
* for (Person p : l.elements(Person.<jk>class</jk>)) {
* <jc>// Do something with p.</jc>
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @param <E> The child object type.
* @param childType The child object type.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java b/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
index 76fa749..73e7443 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
@@ -37,7 +37,7 @@ import org.apache.juneau.utils.*;
* constructor is provided for converting a JSON object string directly into a {@link Map}. It also contains
* accessor methods for to avoid common typecasting when accessing elements in a list.
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct an empty Map</jc>
* Map m = <jk>new</jk> ObjectMap();
@@ -1067,23 +1067,22 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* <p>
* This method can be used to convert <code>ObjectMap</code> objects to a variety of POJO types.
*
- * <dl>
- * <dt>Example of valid class types:</dt>
- * <dd>
- * <p>
- * An object map can be converted to a bean.
- * </p>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Examples of valid class types:</h6>
+ * <p>
+ * An object map can be converted to a bean.
+ * </p>
+ * <p class='bcode'>
* {
* _type: <js>'com.ibm.sample.addressBook.Person'</js>,
* name: <js>'John Smith'</js>,
* ...
* }
- * </p>
- * <p>
- * It can also be converted into another map type.
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * It can also be converted into another map type.
+ * </p>
+ * <p class='bcode'>
* <jc>// Generic TreeMap (String keys, Object values)</jc>
* {
* _type: <js>'java.util.TreeMap'</js>,
@@ -1096,11 +1095,11 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* name: <js>'John Smith'</js>,
* ...
* }
- * </p>
- * <p>
- * It can also be converted to Collections objects if map defines an <code>items</code> entry of type array.
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * It can also be converted to Collections objects if map defines an <code>items</code> entry of type array.
+ * </p>
+ * <p class='bcode'>
* <jc>// LinkedList of strings</jc>
* {
* _type: <js>'java.util.LinkedList'</js>,
@@ -1111,11 +1110,11 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* _type: <js>'java.util.LinkedList<com.ibm.sample.addressBook.Person>'</js>,
* items: [ { name: <js>'John Smith'</js>, ... }, ... ]
* }
- * </p>
- * <p>
- * It can also be converted to arrays.
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * It can also be converted to arrays.
+ * </p>
+ * <p class='bcode'>
* <jc>// Array of strings</jc>
* {
* _type: <js>'java.lang.String[]'</js>,
@@ -1126,25 +1125,22 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* _type: <js>'com.ibm.sample.addressBook.Person[]'</js>,
* items: [ { name: <js>'John Smith'</js>, ... }, ... ]
* }
- * </p>
- * <p>
- * It can also be converted to any type that can be handled by the {@link BeanContext#convertToType(Object, Class)} method.
- * In this case, the value is specified by an <code>value</code> entry of any type.
- * For example, if the bean context has a {@link CalendarSwap} associated with it, it can convert a string value to a calendar.
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * It can also be converted to any type that can be handled by the {@link BeanContext#convertToType(Object, Class)} method.
+ * In this case, the value is specified by an <code>value</code> entry of any type.
+ * For example, if the bean context has a {@link CalendarSwap} associated with it, it can convert a string value to a calendar.
+ * <p class='bcode'>
* {
* _type: <js>'java.util.GregorianCalendar'</js>,
* value: <js>'2001-07-04T15:30:45-05:00'</js>
* }
- * </p>
- * </dd>
- * <dt>Notes:</dt>
- * <dd>
- * <ul>
- * <li>This method is recursive. It will also recursively convert any descendant entries to POJOs.
- * </ul>
- * </dd>
- * </dl>
+ * </p>
+ *
+ * <h6 class='topic'>Notes:</h6>
+ * <ul>
+ * <li>This method is recursive. It will also recursively convert any descendant entries to POJOs.
+ * </ul>
*
* @return The new Java object of type specified by the <js>"_class"</js> entry value, or this
* same object if entry does not exist.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDashedLC.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDashedLC.java b/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDashedLC.java
index 6a1e57e..f6012d6 100644
--- a/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDashedLC.java
+++ b/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDashedLC.java
@@ -14,8 +14,8 @@ package org.apache.juneau;
/**
* Converts property names to dashed-lower-case format.
- * <p>
- * Examples:
+ *
+ * <h6 class='topic'>Examples:</h6>
* <ul>
* <li><js>"fooBar"</js> -> <js>"foo-bar"</js>
* <li><js>"fooBarURL"</js> -> <js>"foo-bar-url"</js>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDefault.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDefault.java b/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDefault.java
index 054f6fc..66e6381 100644
--- a/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDefault.java
+++ b/juneau-core/src/main/java/org/apache/juneau/PropertyNamerDefault.java
@@ -16,8 +16,8 @@ import java.beans.*;
/**
* Default property namer.
- * <p>
- * Examples:
+ *
+ * <h6 class='topic'>Examples:</h6>
* <ul>
* <li><js>"fooBar"</js> -> <js>"fooBar"</js>
* <li><js>"fooBarURL"</js> -> <js>"fooBarURL"</js>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/Visibility.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/Visibility.java b/juneau-core/src/main/java/org/apache/juneau/Visibility.java
index ec60481..3631075 100644
--- a/juneau-core/src/main/java/org/apache/juneau/Visibility.java
+++ b/juneau-core/src/main/java/org/apache/juneau/Visibility.java
@@ -47,7 +47,8 @@ public enum Visibility {
/**
* Identifies if the specified mod matches this visibility.
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <code>
* <jsf>PUBLIC</jsf>.isVisible(MyPublicClass.<jk>class</jk>.getModifiers()); <jc>//true</jk>
* <jsf>PUBLIC</jsf>.isVisible(MyPrivateClass.<jk>class</jk>.getModifiers()); <jc>//false</jk>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java b/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java
index 9acee0f..bc9cb68 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java
@@ -53,10 +53,9 @@ public @interface Bean {
* a simple name/value mapping of names to classes.
* Names do not need to be universally unique. However, they must be unique within a dictionary.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <ja>@Bean</ja>(typeName=<js>"foo"</js>)
* <jk>public class</jk> Foo {
* <jc>// A bean property where the object types cannot be inferred since it's an Object[].</jc>
@@ -69,30 +68,29 @@ public @interface Bean {
*
* <ja>@Bean</ja>(typeName=<js>"baz"</js>)
* <jk>public class</jk> Baz {}
- * </p>
- * <p>
- * When serialized as XML, the bean is rendered as:
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * When serialized as XML, the bean is rendered as:
+ * </p>
+ * <p class='bcode'>
* <xt><foo></xt>
* <xt><x></xt>
* <xt><bar/>v
* <xt><baz/></xt>
* <xt></x></xt>
* <xt></foo></xt>
- * </p>
- * <p>
- * When serialized as JSON, <js>'n'</js> attributes would be added when needed to infer the type during parsing:
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * When serialized as JSON, <js>'n'</js> attributes would be added when needed to infer the type during parsing:
+ * </p>
+ * <p class='bcode'>
* {
* <jsa>x</jsa>: [
* {<jsa>_type</jsa>:<jss>'bar'</jss>},
* {<jsa>_type</jsa>:<jss>'baz'</jss>}
* ]
* } *
- * </dd>
- * </dl>
+ * </p>
*/
String typeName() default "";
@@ -103,18 +101,15 @@ public @interface Bean {
* <p>
* This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getProperties()} method.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Address class with only street/city/state properties (in that order).</jc>
* <jc>// All other properties are ignored.</jc>
* <ja>@Bean</ja>(properties=<js>"street,city,state"</js>)
* <jk>public class</jk> Address {
* ...
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
String properties() default "";
@@ -141,18 +136,14 @@ public @interface Bean {
* <p>
* This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getExcludeProperties()} method.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Address class with only street/city/state properties (in that order).</jc>
* <jc>// All other properties are ignored.</jc>
* <ja>@Bean</ja>(excludeProperties=<js>"city,state"</js>})
* <jk>public class</jk> Address {
* ...
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
String excludeProperties() default "";
@@ -165,18 +156,14 @@ public @interface Bean {
* <p>
* This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getPropertyNamer()} method.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Define a class with dashed-lowercase property names.</jc>
* <ja>@Bean</ja>(propertyNamer=PropertyNamerDashedLC.<jk>class</jk>)
* <jk>public class</jk> MyClass {
* ...
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
Class<? extends PropertyNamer> propertyNamer() default PropertyNamerDefault.class;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java
index dd0fa36..829d8a7 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java
@@ -70,19 +70,16 @@ public @interface BeanProperty {
* <p>
* This property must denote a concrete bean class with a no-arg constructor.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>public class</jk> MyBean {
*
* <jc>// Identify concrete map type.</jc>
* <ja>@BeanProperty</ja>(type=HashMap.<jk>class</jk>)
* <jk>public</jk> Map <jf>p1</jf>;
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
Class<?> type() default Object.class;
@@ -91,19 +88,15 @@ public @interface BeanProperty {
* the class types of the contents of the bean property object when the generic parameter
* types are interfaces or abstract classes.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>public class</jk> MyBean {
*
* <jc>// Identify concrete map type with String keys and Integer values.</jc>
* <ja>@BeanProperty</ja>(type=HashMap.<jk>class</jk>, params={String.<jk>class</jk>,Integer.<jk>class</jk>})
* <jk>public</jk> Map <jf>p1</jf>;
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
Class<?>[] params() default {};
@@ -117,19 +110,15 @@ public @interface BeanProperty {
* Typically used for rendering {@link Date Dates} and {@link Calendar Calendars}
* as a particular string format.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>public class</jk> MyClass {
*
* <jc>// During serialization, convert to ISO8601 date-time string.</jc>
* <ja>@BeanProperty</ja>(pojoSwap=CalendarSwap.ISO8601DT.<jk>class</jk>)
* <jk>public</jk> Calendar getTime();
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
Class<?> swap() default Null.class;
@@ -144,10 +133,9 @@ public @interface BeanProperty {
* <li>Bean/Map collections - Same, but applied to each element in the collection.
* </ul>
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>public class</jk> MyClass {
*
* <jc>// Only render 'f1' when serializing this bean property.</jc>
@@ -162,9 +150,7 @@ public @interface BeanProperty {
*
* <jc>// Renders "{x1:{f1:1}}"</jc>
* String json = JsonSerializer.<jsf>DEFAULT</jsf>.serialize(<jk>new</jk> MyClass());
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
String properties() default "";
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/annotation/Consumes.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/Consumes.java b/juneau-core/src/main/java/org/apache/juneau/annotation/Consumes.java
index 7e95a2d..22ba865 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/Consumes.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/Consumes.java
@@ -33,7 +33,7 @@ import org.apache.juneau.parser.*;
* be overridden by subclasses to return the media types programmatically.
*
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p>
* Standard example:
* <p class='bcode'>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java b/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java
index baaac26..b427cbc 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java
@@ -41,7 +41,7 @@ public @interface Pojo {
* <li>Any other class. Will get interpreted as a {@link SurrogateSwap}.
* </ul>
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p>
* In this case, a swap is being applied to a bean that will force it to be serialized as a <code>String</code>
* <p class='bcode'>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/annotation/Produces.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/Produces.java b/juneau-core/src/main/java/org/apache/juneau/annotation/Produces.java
index 3091397..80133d7 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/Produces.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/Produces.java
@@ -33,7 +33,7 @@ import org.apache.juneau.serializer.*;
* be overridden by subclasses to return the media types programmatically.
*
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p>
* Standard example:
* <p class='bcode'>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/annotation/URI.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/URI.java b/juneau-core/src/main/java/org/apache/juneau/annotation/URI.java
index 0fd2a2d..521dd85 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/URI.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/URI.java
@@ -34,7 +34,7 @@ import org.apache.juneau.serializer.*;
* <p>
* This annotation can be applied to classes, interfaces, or bean property methods for fields.
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
*
* <jc>// Applied to a class whose toString() method returns a URI.</jc>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java
index cd46bcc..d87827f 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java
@@ -47,7 +47,7 @@ import org.apache.juneau.xml.annotation.*;
* <p>
* Only 2-dimentional POJOs (arrays or collections of maps or beans) can be serialized to Cognos.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p>
* The construct shown above is a serialized <code>AddressBook</code> object which is a subclass of <code>LinkedList<Person></code>.
* The code for generating the XML is as follows...
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html
index 3604359..92ee6bb 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html
@@ -79,7 +79,7 @@
<li>{@code MyBean[]}
<li>{@code HashMap[]}
</ul>
- <h6 class='topic'>Example</h6>
+ <h6 class='topic'>Example:</h6>
<p>
The following example shows how to generate Cognos-XML from a POJO.
The example uses the <a class='doclink' href='../../doc-files/AddressBook.html'>AddressBook</a> sample POJO.
@@ -167,7 +167,7 @@
<p>
The {@link org.apache.juneau.dto.cognos.DataSet} class can be reconstructed from Cognos/XML using one of the standard XML parsers.
</p>
- <h6 class='topic'>Example</h6>
+ <h6 class='topic'>Example:</h6>
<p class='bcode'>
<jc>// Parse XML back into original DataSet</jc>
DataSet ds = XmlParser.<jsf>DEFAULT</jsf>.parse(xml, DataSet.<jk>class</jk>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/JsonType.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/JsonType.java b/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/JsonType.java
index 6d76f20..f755188 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/JsonType.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/JsonType.java
@@ -19,7 +19,7 @@ package org.apache.juneau.dto.jsonschema;
* that override the default serialization/parsing behavior of <code>Enum</code> types
* so that they are represented in lowercase form (as per the specification).
*
- * <h6 class='figure'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* // Produces 'number', not 'NUMBER'.
* String json = JsonSerializer.DEFAULT.serialize(JsonType.NUMBER);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Contact.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Contact.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Contact.java
index 5f0002f..a69fc47 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Contact.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Contact.java
@@ -16,8 +16,8 @@ import org.apache.juneau.annotation.*;
/**
* Contact information for the exposed API.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* {
* <js>"name"</js>: <js>"API Support"</js>,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ExternalDocumentation.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ExternalDocumentation.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ExternalDocumentation.java
index 3a927c9..cb7b70c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ExternalDocumentation.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ExternalDocumentation.java
@@ -16,8 +16,8 @@ import org.apache.juneau.annotation.*;
/**
* Allows referencing an external resource for extended documentation.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* {
* <js>"description"</js>: <js>"Find more info here"</js>,
@@ -35,7 +35,7 @@ public class ExternalDocumentation {
/**
* Convenience method for creating a new ExternalDocumentation object.
- *
+ *
* @param url Required. The URL for the target documentation. Value MUST be in the format of a URL.
* @return A new ExternalDocumentation object.
*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Header.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Header.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Header.java
deleted file mode 100644
index f3d0c94..0000000
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Header.java
+++ /dev/null
@@ -1,582 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.dto.swagger;
-
-import java.util.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.internal.*;
-import org.apache.juneau.json.*;
-
-/**
- * Describes a single HTTP header.
- * <p>
- * Example:
- * <p class='bcode'>
- * {
- * <js>"description"</js>: <js>"The number of allowed requests in the current period"</js>,
- * <js>"type"</js>: <js>"integer"</js>
- * }
- * </p>
- *
- * @author james.bognar
- */
-@Bean(properties="description,type,format,items,collectionFormat,default,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,enum,multipleOf")
-public class Header {
-
- private static final String[] VALID_TYPES = {"string", "number", "integer", "boolean", "array"};
- private static final String[] VALID_COLLECTION_FORMATS = {"csv","ssv","tsv","pipes","multi"};
-
- private String description;
- private String type;
- private String format;
- private Items items;
- private String collectionFormat;
- private Object _default;
- private Number maximum;
- private Boolean exclusiveMaximum;
- private Number minimum;
- private Boolean exclusiveMinimum;
- private Integer maxLength;
- private Integer minLength;
- private String pattern;
- private Integer maxItems;
- private Integer minItems;
- private Boolean uniqueItems;
- private List<Object> _enum;
- private Number multipleOf;
- private boolean strict;
-
- /**
- * Convenience method for creating a new Header object.
- *
- * @param type Required. The type of the object.
- * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
- * @return A new Header object.
- */
- public static Header create(String type) {
- return new Header().setType(type);
- }
-
- /**
- * Same as {@link #create(String)} except methods will throw runtime exceptions if you attempt
- * to pass in invalid values per the Swagger spec.
- *
- * @param type Required. The type of the object.
- * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
- * @return A new Header object.
- */
- public static Header createStrict(String type) {
- return new Header().setStrict().setType(type);
- }
-
- private Header setStrict() {
- this.strict = true;
- return this;
- }
-
- /**
- * Bean property getter: <property>description</property>.
- * <p>
- * A short description of the header.
- *
- * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Bean property setter: <property>description</property>.
- * <p>
- * A short description of the header.
- *
- * @param description The new value for the <property>description</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setDescription(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * Bean property getter: <property>type</property>.
- * <p>
- * Required. The type of the object.
- * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
- *
- * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Bean property setter: <property>type</property>.
- * <p>
- * Required. The type of the object.
- * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
- *
- * @param type The new value for the <property>type</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setType(String type) {
- if (strict && ! ArrayUtils.contains(type, VALID_TYPES))
- throw new RuntimeException("Invalid value passed in to setType(String). Value='"+type+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_TYPES));
- this.type = type;
- return this;
- }
-
- /**
- * Bean property getter: <property>format</property>.
- * <p>
- * The extending format for the previously mentioned <code>type</code>. See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
- *
- * @return The value of the <property>format</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getFormat() {
- return format;
- }
-
- /**
- * Bean property setter: <property>format</property>.
- * <p>
- * The extending format for the previously mentioned <code>type</code>. See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
- *
- * @param format The new value for the <property>format</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setFormat(String format) {
- this.format = format;
- return this;
- }
-
- /**
- * Bean property getter: <property>items</property>.
- * <p>
- * Required if <code>type</code> is <js>"array"</js>.
- * Describes the type of items in the array.
- *
- * @return The value of the <property>items</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Items getItems() {
- return items;
- }
-
- /**
- * Bean property setter: <property>items</property>.
- * <p>
- * Required if <code>type</code> is <js>"array"</js>.
- * Describes the type of items in the array.
- *
- * @param items The new value for the <property>items</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setItems(Items items) {
- this.items = items;
- return this;
- }
-
- /**
- * Bean property getter: <property>collectionFormat</property>.
- * <p>
- * Determines the format of the array if type array is used.
- * <p>
- * Possible values are:
- * <ul>
- * <li><code>csv</code> - comma separated values <code>foo,bar</code>.
- * <li><code>ssv</code> - space separated values <code>foo bar</code>.
- * <li><code>tsv</code> - tab separated values <code>foo\tbar</code>.
- * <li><code>pipes</code> - pipe separated values <code>foo|bar</code>.
- * </ul>
- * <p>
- * Default value is <code>csv</code>.
- *
- * @return The value of the <property>collectionFormat</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getCollectionFormat() {
- return collectionFormat;
- }
-
- /**
- * Bean property setter: <property>collectionFormat</property>.
- * <p>
- * Determines the format of the array if type array is used.
- * <p>
- * Possible values are:
- * <ul>
- * <li><code>csv</code> - comma separated values <code>foo,bar</code>.
- * <li><code>ssv</code> - space separated values <code>foo bar</code>.
- * <li><code>tsv</code> - tab separated values <code>foo\tbar</code>.
- * <li><code>pipes</code> - pipe separated values <code>foo|bar</code>.
- * </ul>
- * <p>
- * Default value is <code>csv</code>.
- *
- * @param collectionFormat The new value for the <property>collectionFormat</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setCollectionFormat(String collectionFormat) {
- if (strict && ! ArrayUtils.contains(collectionFormat, VALID_COLLECTION_FORMATS))
- throw new RuntimeException("Invalid value passed in to setCollectionFormat(String). Value='"+collectionFormat+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_COLLECTION_FORMATS));
- this.collectionFormat = collectionFormat;
- return this;
- }
-
- /**
- * Bean property getter: <property>default</property>.
- * <p>
- * Declares the value of the header that the server will use if none is provided.
- * (Note: <js>"default"</js> has no meaning for required items.)
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
- * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for the header.
- *
- * @return The value of the <property>_default</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Object getDefault() {
- return _default;
- }
-
- /**
- * Bean property setter: <property>default</property>.
- * <p>
- * Declares the value of the header that the server will use if none is provided.
- * (Note: <js>"default"</js> has no meaning for required items.)
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
- * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for the header.
- *
- * @param _default The new value for the <property>_default</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setDefault(Object _default) {
- this._default = _default;
- return this;
- }
-
- /**
- * Bean property getter: <property>maximum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
- *
- * @return The value of the <property>maximum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMaximum() {
- return maximum;
- }
-
- /**
- * Bean property setter: <property>maximum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
- *
- * @param maximum The new value for the <property>maximum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setMaximum(Number maximum) {
- this.maximum = maximum;
- return this;
- }
-
- /**
- * Bean property getter: <property>exclusiveMaximum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
- *
- * @return The value of the <property>exclusiveMaximum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getExclusiveMaximum() {
- return exclusiveMaximum;
- }
-
- /**
- * Bean property setter: <property>exclusiveMaximum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
- *
- * @param exclusiveMaximum The new value for the <property>exclusiveMaximum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setExclusiveMaximum(Boolean exclusiveMaximum) {
- this.exclusiveMaximum = exclusiveMaximum;
- return this;
- }
-
- /**
- * Bean property getter: <property>minimum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
- *
- * @return The value of the <property>minimum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMinimum() {
- return minimum;
- }
-
- /**
- * Bean property setter: <property>minimum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
- *
- * @param minimum The new value for the <property>minimum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setMinimum(Number minimum) {
- this.minimum = minimum;
- return this;
- }
-
- /**
- * Bean property getter: <property>exclusiveMinimum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
- *
- * @return The value of the <property>exclusiveMinimum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getExclusiveMinimum() {
- return exclusiveMinimum;
- }
-
- /**
- * Bean property setter: <property>exclusiveMinimum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
- *
- * @param exclusiveMinimum The new value for the <property>exclusiveMinimum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setExclusiveMinimum(Boolean exclusiveMinimum) {
- this.exclusiveMinimum = exclusiveMinimum;
- return this;
- }
-
- /**
- * Bean property getter: <property>maxLength</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor26'>http://json-schema.org/latest/json-schema-validation.html#anchor26</a>.
- *
- * @return The value of the <property>maxLength</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMaxLength() {
- return maxLength;
- }
-
- /**
- * Bean property setter: <property>maxLength</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor26'>http://json-schema.org/latest/json-schema-validation.html#anchor26</a>.
- *
- * @param maxLength The new value for the <property>maxLength</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setMaxLength(Integer maxLength) {
- this.maxLength = maxLength;
- return this;
- }
-
- /**
- * Bean property getter: <property>minLength</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor29'>http://json-schema.org/latest/json-schema-validation.html#anchor29</a>.
- *
- * @return The value of the <property>minLength</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMinLength() {
- return minLength;
- }
-
- /**
- * Bean property setter: <property>minLength</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor29'>http://json-schema.org/latest/json-schema-validation.html#anchor29</a>.
- *
- * @param minLength The new value for the <property>minLength</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setMinLength(Integer minLength) {
- this.minLength = minLength;
- return this;
- }
-
- /**
- * Bean property getter: <property>pattern</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor33'>http://json-schema.org/latest/json-schema-validation.html#anchor33</a>.
- *
- * @return The value of the <property>pattern</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getPattern() {
- return pattern;
- }
-
- /**
- * Bean property setter: <property>pattern</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor33'>http://json-schema.org/latest/json-schema-validation.html#anchor33</a>.
- *
- * @param pattern The new value for the <property>pattern</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setPattern(String pattern) {
- this.pattern = pattern;
- return this;
- }
-
- /**
- * Bean property getter: <property>maxItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor42'>http://json-schema.org/latest/json-schema-validation.html#anchor42</a>.
- *
- * @return The value of the <property>maxItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMaxItems() {
- return maxItems;
- }
-
- /**
- * Bean property setter: <property>maxItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor42'>http://json-schema.org/latest/json-schema-validation.html#anchor42</a>.
- *
- * @param maxItems The new value for the <property>maxItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setMaxItems(Integer maxItems) {
- this.maxItems = maxItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>minItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor45'>http://json-schema.org/latest/json-schema-validation.html#anchor45</a>.
- *
- * @return The value of the <property>minItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMinItems() {
- return minItems;
- }
-
- /**
- * Bean property setter: <property>minItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor45'>http://json-schema.org/latest/json-schema-validation.html#anchor45</a>.
- *
- * @param minItems The new value for the <property>minItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setMinItems(Integer minItems) {
- this.minItems = minItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>uniqueItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor49'>http://json-schema.org/latest/json-schema-validation.html#anchor49</a>.
- *
- * @return The value of the <property>uniqueItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getUniqueItems() {
- return uniqueItems;
- }
-
- /**
- * Bean property setter: <property>uniqueItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor49'>http://json-schema.org/latest/json-schema-validation.html#anchor49</a>.
- *
- * @param uniqueItems The new value for the <property>uniqueItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setUniqueItems(Boolean uniqueItems) {
- this.uniqueItems = uniqueItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>enum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
- *
- * @return The value of the <property>enum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public List<Object> getEnum() {
- return _enum;
- }
-
- /**
- * Bean property setter: <property>enum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
- *
- * @param _enum The new value for the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setEnum(List<Object> _enum) {
- this._enum = _enum;
- return this;
- }
-
- /**
- * Bean property adder: <property>enum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
- *
- * @param _enum The new values to add to the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- @SuppressWarnings("hiding")
- public Header addEnum(Object..._enum) {
- return addEnum(Arrays.asList(_enum));
- }
-
- /**
- * Bean property adder: <property>enum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
- *
- * @param _enum The new values to add to the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- @SuppressWarnings("hiding")
- public Header addEnum(Collection<Object> _enum) {
- if (this._enum == null)
- this._enum = new LinkedList<Object>();
- this._enum.addAll(_enum);
- return this;
- }
-
- /**
- * Bean property getter: <property>multipleOf</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor14'>http://json-schema.org/latest/json-schema-validation.html#anchor14</a>.
- *
- * @return The value of the <property>multipleOf</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMultipleOf() {
- return multipleOf;
- }
-
- /**
- * Bean property setter: <property>multipleOf</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor14'>http://json-schema.org/latest/json-schema-validation.html#anchor14</a>.
- *
- * @param multipleOf The new value for the <property>multipleOf</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Header setMultipleOf(Number multipleOf) {
- this.multipleOf = multipleOf;
- return this;
- }
-}
[6/8] incubator-juneau git commit: Doc updates.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ParameterInfo.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ParameterInfo.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ParameterInfo.java
new file mode 100644
index 0000000..800cb66
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ParameterInfo.java
@@ -0,0 +1,776 @@
+// ***************************************************************************************************************************
+// * 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.dto.swagger;
+
+import java.util.*;
+
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.json.*;
+
+/**
+ * Describes a single operation parameter.
+ * <p>
+ * A unique parameter is defined by a combination of a name and location.
+ * <p>
+ * There are five possible parameter types.
+ * <ul>
+ * <li><js>"path"</js> - Used together with Path Templating, where the parameter value is actually part of the operation's URL.
+ * This does not include the host or base path of the API.
+ * For example, in <code>/items/{itemId}</code>, the path parameter is <code>itemId</code>.
+ * <li><js>"query"</js> - Parameters that are appended to the URL.
+ * For example, in <code>/items?id=###</code>, the query parameter is <code>id</code>.
+ * <li><js>"header"</js> - Custom headers that are expected as part of the request.
+ * <li><js>"body"</js> - The payload that's appended to the HTTP request.
+ * Since there can only be one payload, there can only be one body parameter.
+ * The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only.
+ * Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
+ * <li><js>"formData"</js> - Used to describe the payload of an HTTP request when either <code>application/x-www-form-urlencoded</code>, <code>multipart/form-data</code> or both are used as the content type of the request (in Swagger's definition, the consumes property of an operation).
+ * This is the only parameter type that can be used to send files, thus supporting the file type.
+ * Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation.
+ * Form parameters have a different format based on the content-type used (for further details, consult <code>http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4</code>):
+ * <ul>
+ * <li><js>"application/x-www-form-urlencoded"</js> - Similar to the format of Query parameters but as a payload.
+ * For example, <code>foo=1&bar=swagger</code> - both <code>foo</code> and <code>bar</code> are form parameters.
+ * This is normally used for simple parameters that are being transferred.
+ * <li><js>"multipart/form-data"</js> - each parameter takes a section in the payload with an internal header.
+ * For example, for the header <code>Content-Disposition: form-data; name="submit-name"<code> the name of the parameter is <code>submit-name</code>.
+ * This type of form parameters is more commonly used for file transfers.
+ * </ul>
+ * </li>
+ * </ul>
+ *
+ * @author james.bognar
+ */
+@Bean(properties="in,name,type,description,required,schema,format,allowEmptyValue,items,collectionFormat,default,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,enum,multipleOf")
+public class ParameterInfo {
+
+ private static final String[] VALID_IN = {"query", "header", "path", "formData", "body"};
+ private static final String[] VALID_TYPES = {"string", "number", "integer", "boolean", "array", "file"};
+ private static final String[] VALID_COLLECTION_FORMATS = {"csv", "ssv", "tsv", "pipes", "multi"};
+
+ private String name;
+ private String in;
+ private String description;
+ private Boolean required;
+ private SchemaInfo schema;
+ private String type;
+ private String format;
+ private Boolean allowEmptyValue;
+ private Items items;
+ private String collectionFormat;
+ private Object _default;
+ private Number maximum;
+ private Boolean exclusiveMaximum;
+ private Number minimum;
+ private Boolean exclusiveMinimum;
+ private Integer maxLength;
+ private Integer minLength;
+ private String pattern;
+ private Integer maxItems;
+ private Integer minItems;
+ private Boolean uniqueItems;
+ private List<Object> _enum;
+ private Number multipleOf;
+ private boolean strict;
+
+ /**
+ * Convenience method for creating a new Parameter object.
+ *
+ * @param in Required. The location of the parameter.
+ * Possible values are <js>"query"</js>, <js>"header"</js>, <js>"path"</js>, <js>"formData"</js> or <js>"body"</js>.
+ * @param name Required. The name of the parameter.
+ * Parameter names are case sensitive.
+ * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
+ * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
+ * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
+ * @return A new Parameter object.
+ */
+ public static ParameterInfo create(String in, String name) {
+ return new ParameterInfo().setIn(in).setName(name);
+ }
+
+ /**
+ * Same as {@link #create(String, String)} except methods will throw runtime exceptions if you attempt
+ * to pass in invalid values per the Swagger spec.
+ *
+ * @param in Required. The location of the parameter.
+ * Possible values are <js>"query"</js>, <js>"header"</js>, <js>"path"</js>, <js>"formData"</js> or <js>"body"</js>.
+ * @param name Required. The name of the parameter.
+ * Parameter names are case sensitive.
+ * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
+ * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
+ * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
+ * @return A new Parameter object.
+ */
+ public static ParameterInfo createStrict(String in, String name) {
+ return new ParameterInfo().setStrict().setIn(in).setName(name);
+ }
+
+ private ParameterInfo setStrict() {
+ this.strict = true;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>name</property>.
+ * <p>
+ * Required. The name of the parameter.
+ * Parameter names are case sensitive.
+ * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
+ * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
+ * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
+ *
+ * @return The value of the <property>name</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Bean property setter: <property>name</property>.
+ * <p>
+ * Required. The name of the parameter.
+ * Parameter names are case sensitive.
+ * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
+ * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
+ * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
+ *
+ * @param name The new value for the <property>name</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setName(String name) {
+ if (! "body".equals(in))
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>in</property>.
+ * <p>
+ * Required. The location of the parameter.
+ * Possible values are <js>"query"</js>, <js>"header"</js>, <js>"path"</js>, <js>"formData"</js> or <js>"body"</js>.
+ *
+ * @return The value of the <property>in</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getIn() {
+ return in;
+ }
+
+ /**
+ * Bean property setter: <property>in</property>.
+ * <p>
+ * Required. The location of the parameter.
+ * Possible values are <js>"query"</js>, <js>"header"</js>, <js>"path"</js>, <js>"formData"</js> or <js>"body"</js>.
+ *
+ * @param in The new value for the <property>in</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setIn(String in) {
+ if (strict && ! ArrayUtils.contains(in, VALID_IN))
+ throw new RuntimeException("Invalid value passed in to setIn(String). Value='"+in+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_IN));
+ this.in = in;
+ if ("path".equals(in))
+ required = true;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>description</property>.
+ * <p>
+ * A brief description of the parameter.
+ * This could contain examples of use.
+ * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
+ *
+ * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Bean property setter: <property>description</property>.
+ * <p>
+ * A brief description of the parameter.
+ * This could contain examples of use.
+ * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
+ *
+ * @param description The new value for the <property>description</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>required</property>.
+ * <p>
+ * Determines whether this parameter is mandatory.
+ * If the parameter is <code>in</code> <js>"path"</js>, this property is required and its value MUST be <jk>true</jk>.
+ * Otherwise, the property MAY be included and its default value is <jk>false</jk>.
+ *
+ * @return The value of the <property>required</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getRequired() {
+ return required;
+ }
+
+ /**
+ * Bean property setter: <property>required</property>.
+ * <p>
+ * Determines whether this parameter is mandatory.
+ * If the parameter is <code>in</code> <js>"path"</js>, this property is required and its value MUST be <jk>true</jk>.
+ * Otherwise, the property MAY be included and its default value is <jk>false</jk>.
+ *
+ * @param required The new value for the <property>required</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setRequired(Boolean required) {
+ this.required = required;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>schema</property>.
+ * <p>
+ * Required. The schema defining the type used for the body parameter.
+ *
+ * @return The value of the <property>schema</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public SchemaInfo getSchema() {
+ return schema;
+ }
+
+ /**
+ * Bean property setter: <property>schema</property>.
+ * <p>
+ * Required. The schema defining the type used for the body parameter.
+ *
+ * @param schema The new value for the <property>schema</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setSchema(SchemaInfo schema) {
+ this.schema = schema;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>type</property>.
+ * <p>
+ * Required. The type of the parameter.
+ * Since the parameter is not located at the request body, it is limited to simple types (that is, not an object).
+ * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, <js>"array"</js> or <js>"file"</js>.
+ * If type is <js>"file"</js>, the <code>consumes</code> MUST be either <js>"multipart/form-data"</js>, <js>"application/x-www-form-urlencoded"</js> or both and the parameter MUST be <code>in</code> <js>"formData"</js>.
+ *
+ * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Bean property setter: <property>type</property>.
+ * <p>
+ * Required. The type of the parameter.
+ * Since the parameter is not located at the request body, it is limited to simple types (that is, not an object).
+ * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, <js>"array"</js> or <js>"file"</js>.
+ * If type is <js>"file"</js>, the <code>consumes</code> MUST be either <js>"multipart/form-data"</js>, <js>"application/x-www-form-urlencoded"</js> or both and the parameter MUST be <code>in</code> <js>"formData"</js>.
+ *
+ * @param type The new value for the <property>type</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setType(String type) {
+ if (strict && ! ArrayUtils.contains(type, VALID_TYPES))
+ throw new RuntimeException("Invalid value passed in to setType(String). Value='"+type+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_TYPES));
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>format</property>.
+ * <p>
+ * The extending format for the previously mentioned type.
+ * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
+ *
+ * @return The value of the <property>format</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getFormat() {
+ return format;
+ }
+
+ /**
+ * Bean property setter: <property>format</property>.
+ * <p>
+ * The extending format for the previously mentioned type.
+ * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
+ *
+ * @param format The new value for the <property>format</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setFormat(String format) {
+ this.format = format;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>allowEmptyValue</property>.
+ * <p>
+ * Sets the ability to pass empty-valued parameters.
+ * This is valid only for either <code>query</code> or <code>formData</code> parameters and allows you to send a parameter with a name only or an empty value.
+ * Default value is <jk>false</jk>.
+ *
+ * @return The value of the <property>allowEmptyValue</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getAllowEmptyValue() {
+ return allowEmptyValue;
+ }
+
+ /**
+ * Bean property setter: <property>allowEmptyValue</property>.
+ * <p>
+ * Sets the ability to pass empty-valued parameters.
+ * This is valid only for either <code>query</code> or <code>formData</code> parameters and allows you to send a parameter with a name only or an empty value.
+ * Default value is <jk>false</jk>.
+ *
+ * @param allowEmptyValue The new value for the <property>allowEmptyValue</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setAllowEmptyValue(Boolean allowEmptyValue) {
+ this.allowEmptyValue = allowEmptyValue;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>items</property>.
+ * <p>
+ * Required if <code>type</code> is <js>"array"</js>.
+ * Describes the type of items in the array.
+ *
+ * @return The value of the <property>items</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Items getItems() {
+ return items;
+ }
+
+ /**
+ * Bean property setter: <property>items</property>.
+ * <p>
+ * Required if <code>type</code> is <js>"array"</js>.
+ * Describes the type of items in the array.
+ *
+ * @param items The new value for the <property>items</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setItems(Items items) {
+ this.items = items;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>collectionFormat</property>.
+ * <p>
+ * Determines the format of the array if type array is used.
+ * <p>
+ * Possible values are:
+ * <ul>
+ * <li><code>csv</code> - comma separated values <code>foo,bar</code>.
+ * <li><code>ssv</code> - space separated values <code>foo bar</code>.
+ * <li><code>tsv</code> - tab separated values <code>foo\tbar</code>.
+ * <li><code>pipes</code> - pipe separated values <code>foo|bar</code>.
+ * <li><code>multi</code> - corresponds to multiple parameter instances instead of multiple values for a single instance <code>foo=bar&foo=baz</code>.
+ * This is valid only for parameters <code>in</code> <js>"query"</js> or <js>"formData"</js>.
+ * </ul>
+ * <p>
+ * Default value is <code>csv</code>.
+ *
+ * @return The value of the <property>collectionFormat</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getCollectionFormat() {
+ return collectionFormat;
+ }
+
+ /**
+ * Bean property setter: <property>collectionFormat</property>.
+ * <p>
+ * Determines the format of the array if type array is used.
+ * <p>
+ * Possible values are:
+ * <ul>
+ * <li><code>csv</code> - comma separated values <code>foo,bar</code>.
+ * <li><code>ssv</code> - space separated values <code>foo bar</code>.
+ * <li><code>tsv</code> - tab separated values <code>foo\tbar</code>.
+ * <li><code>pipes</code> - pipe separated values <code>foo|bar</code>.
+ * <li><code>multi</code> - corresponds to multiple parameter instances instead of multiple values for a single instance <code>foo=bar&foo=baz</code>.
+ * This is valid only for parameters <code>in</code> <js>"query"</js> or <js>"formData"</js>.
+ * </ul>
+ * <p>
+ * Default value is <code>csv</code>.
+ *
+ * @param collectionFormat The new value for the <property>collectionFormat</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setCollectionFormat(String collectionFormat) {
+ if (strict && ! ArrayUtils.contains(collectionFormat, VALID_COLLECTION_FORMATS))
+ throw new RuntimeException("Invalid value passed in to setCollectionFormat(String). Value='"+collectionFormat+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_COLLECTION_FORMATS));
+ this.collectionFormat = collectionFormat;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>default</property>.
+ * <p>
+ * Declares the value of the parameter that the server will use if none is provided, for example a <js>"count"</js> to control the number of results per page might default to 100 if not supplied by the client in the request.
+ * (Note: <js>"default"</js> has no meaning for required parameters.)
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
+ * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for this parameter.
+ *
+ * @return The value of the <property>default</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Object getDefault() {
+ return _default;
+ }
+
+ /**
+ * Bean property setter: <property>default</property>.
+ * <p>
+ * Declares the value of the parameter that the server will use if none is provided, for example a <js>"count"</js> to control the number of results per page might default to 100 if not supplied by the client in the request.
+ * (Note: <js>"default"</js> has no meaning for required parameters.)
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
+ * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for this parameter.
+ *
+ * @param _default The new value for the <property>default</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setDefault(Object _default) {
+ this._default = _default;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maximum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
+ *
+ * @return The value of the <property>maximum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMaximum() {
+ return maximum;
+ }
+
+ /**
+ * Bean property setter: <property>maximum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
+ *
+ * @param maximum The new value for the <property>maximum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setMaximum(Number maximum) {
+ this.maximum = maximum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>exclusiveMaximum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
+ *
+ * @return The value of the <property>exclusiveMaximum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getExclusiveMaximum() {
+ return exclusiveMaximum;
+ }
+
+ /**
+ * Bean property setter: <property>exclusiveMaximum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
+ *
+ * @param exclusiveMaximum The new value for the <property>exclusiveMaximum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setExclusiveMaximum(Boolean exclusiveMaximum) {
+ this.exclusiveMaximum = exclusiveMaximum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minimum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
+ *
+ * @return The value of the <property>minimum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMinimum() {
+ return minimum;
+ }
+
+ /**
+ * Bean property setter: <property>minimum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
+ *
+ * @param minimum The new value for the <property>minimum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setMinimum(Number minimum) {
+ this.minimum = minimum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>exclusiveMinimum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
+ *
+ * @return The value of the <property>exclusiveMinimum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getExclusiveMinimum() {
+ return exclusiveMinimum;
+ }
+
+ /**
+ * Bean property setter: <property>exclusiveMinimum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
+ *
+ * @param exclusiveMinimum The new value for the <property>exclusiveMinimum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setExclusiveMinimum(Boolean exclusiveMinimum) {
+ this.exclusiveMinimum = exclusiveMinimum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maxLength</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor26'>http://json-schema.org/latest/json-schema-validation.html#anchor26</a>.
+ *
+ * @return The value of the <property>maxLength</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ /**
+ * Bean property setter: <property>maxLength</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor26'>http://json-schema.org/latest/json-schema-validation.html#anchor26</a>.
+ *
+ * @param maxLength The new value for the <property>maxLength</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setMaxLength(Integer maxLength) {
+ this.maxLength = maxLength;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minLength</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor29'>http://json-schema.org/latest/json-schema-validation.html#anchor29</a>.
+ *
+ * @return The value of the <property>minLength</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMinLength() {
+ return minLength;
+ }
+
+ /**
+ * Bean property setter: <property>minLength</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor29'>http://json-schema.org/latest/json-schema-validation.html#anchor29</a>.
+ *
+ * @param minLength The new value for the <property>minLength</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setMinLength(Integer minLength) {
+ this.minLength = minLength;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>pattern</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor33'>http://json-schema.org/latest/json-schema-validation.html#anchor33</a>.
+ *
+ * @return The value of the <property>pattern</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getPattern() {
+ return pattern;
+ }
+
+ /**
+ * Bean property setter: <property>pattern</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor33'>http://json-schema.org/latest/json-schema-validation.html#anchor33</a>.
+ *
+ * @param pattern The new value for the <property>pattern</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setPattern(String pattern) {
+ this.pattern = pattern;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maxItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor42'>http://json-schema.org/latest/json-schema-validation.html#anchor42</a>.
+ *
+ * @return The value of the <property>maxItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMaxItems() {
+ return maxItems;
+ }
+
+ /**
+ * Bean property setter: <property>maxItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor42'>http://json-schema.org/latest/json-schema-validation.html#anchor42</a>.
+ *
+ * @param maxItems The new value for the <property>maxItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setMaxItems(Integer maxItems) {
+ this.maxItems = maxItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor45'>http://json-schema.org/latest/json-schema-validation.html#anchor45</a>.
+ *
+ * @return The value of the <property>minItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMinItems() {
+ return minItems;
+ }
+
+ /**
+ * Bean property setter: <property>minItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor45'>http://json-schema.org/latest/json-schema-validation.html#anchor45</a>.
+ *
+ * @param minItems The new value for the <property>minItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setMinItems(Integer minItems) {
+ this.minItems = minItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>uniqueItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor49'>http://json-schema.org/latest/json-schema-validation.html#anchor49</a>.
+ *
+ * @return The value of the <property>uniqueItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getUniqueItems() {
+ return uniqueItems;
+ }
+
+ /**
+ * Bean property setter: <property>uniqueItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor49'>http://json-schema.org/latest/json-schema-validation.html#anchor49</a>.
+ *
+ * @param uniqueItems The new value for the <property>uniqueItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setUniqueItems(Boolean uniqueItems) {
+ this.uniqueItems = uniqueItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>enum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
+ *
+ * @return The value of the <property>enum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public List<Object> getEnum() {
+ return _enum;
+ }
+
+ /**
+ * Bean property setter: <property>enum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
+ *
+ * @param _enum The new value for the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setEnum(List<Object> _enum) {
+ this._enum = _enum;
+ return this;
+ }
+
+ /**
+ * Bean property adder: <property>enum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
+ *
+ * @param _enum The new values to add to the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ @SuppressWarnings("hiding")
+ public ParameterInfo addEnum(Object..._enum) {
+ return addEnum(Arrays.asList(_enum));
+ }
+
+ /**
+ * Bean property adder: <property>enum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
+ *
+ * @param _enum The new values to add to the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ @SuppressWarnings("hiding")
+ public ParameterInfo addEnum(Collection<Object> _enum) {
+ if (this._enum == null)
+ this._enum = new LinkedList<Object>();
+ this._enum.addAll(_enum);
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>multipleOf</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor14'>http://json-schema.org/latest/json-schema-validation.html#anchor14</a>.
+ *
+ * @return The value of the <property>multipleOf</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMultipleOf() {
+ return multipleOf;
+ }
+
+ /**
+ * Bean property setter: <property>multipleOf</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor14'>http://json-schema.org/latest/json-schema-validation.html#anchor14</a>.
+ *
+ * @param multipleOf The new value for the <property>multipleOf</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ParameterInfo setMultipleOf(Number multipleOf) {
+ this.multipleOf = multipleOf;
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Response.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Response.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Response.java
deleted file mode 100644
index 6b4e58b..0000000
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Response.java
+++ /dev/null
@@ -1,194 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.dto.swagger;
-
-import java.util.*;
-
-import org.apache.juneau.annotation.*;
-
-/**
- * Describes a single response from an API Operation.
- * <p>
- * Example:
- * <p class='bcode'>
- * {
- * <js>"description"</js>: <js>"A complex object array response"</js>,
- * <js>"schema"</js>: {
- * <js>"type"</js>: <js>"array"</js>,
- * <js>"items"</js>: {
- * <js>"$ref"</js>: <js>"#/definitions/VeryComplexType"</js>
- * }
- * }
- * }
- * </p>
- * @author james.bognar
- */
-@Bean(properties="description,schema,headers,examples")
-public class Response {
-
- private String description;
- private Schema schema;
- private Map<String,Header> headers;
- private Map<String,Object> examples;
-
- /**
- * Convenience method for creating a new Response object.
- *
- * @param description A short description of the response.
- * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
- * @return A new Header object.
- */
- public static Response create(String description) {
- return new Response().setDescription(description);
- }
-
- /**
- * Bean property getter: <property>description</property>.
- * <p>
- * Required. A short description of the response.
- * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
- *
- * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Bean property setter: <property>description</property>.
- * <p>
- * Required. A short description of the response.
- * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
- *
- * @param description The new value for the <property>description</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Response setDescription(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * Bean property getter: <property>schema</property>.
- * <p>
- * A definition of the response structure.
- * It can be a primitive, an array or an object.
- * If this field does not exist, it means no content is returned as part of the response.
- * As an extension to the <a href='http://swagger.io/specification/#schemaObject'>Schema Object</a>, its root type value may also be <js>"file"</js>.
- * This SHOULD be accompanied by a relevant produces mime-type.
- *
- * @return The value of the <property>schema</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Schema getSchema() {
- return schema;
- }
-
- /**
- * Bean property setter: <property>schema</property>.
- * <p>
- * A definition of the response structure.
- * It can be a primitive, an array or an object.
- * If this field does not exist, it means no content is returned as part of the response.
- * As an extension to the <a href='http://swagger.io/specification/#schemaObject'>Schema Object</a>, its root type value may also be <js>"file"</js>.
- * This SHOULD be accompanied by a relevant produces mime-type.
- *
- * @param schema The new value for the <property>schema</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Response setSchema(Schema schema) {
- this.schema = schema;
- return this;
- }
-
- /**
- * Bean property getter: <property>headers</property>.
- * <p>
- * A list of headers that are sent with the response.
- *
- * @return The value of the <property>headers</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Map<String,Header> getHeaders() {
- return headers;
- }
-
- /**
- * Bean property setter: <property>headers</property>.
- * <p>
- * A list of headers that are sent with the response.
- *
- * @param headers The new value for the <property>headers</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Response setHeaders(Map<String,Header> headers) {
- this.headers = headers;
- return this;
- }
-
- /**
- * Bean property adder: <property>headers</property>.
- * <p>
- * A list of headers that are sent with the response.
- *
- * @param name The header name.
- * @param header The header descriptions
- * @return This object (for method chaining).
- */
- public Response addHeader(String name, Header header) {
- if (headers == null)
- headers = new TreeMap<String,Header>();
- headers.put(name, header);
- return this;
- }
-
- /**
- * Bean property getter: <property>examples</property>.
- * <p>
- * An example of the response message.
- * Keys must be MIME-type strings.
- *
- * @return The value of the <property>examples</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Map<String,Object> getExamples() {
- return examples;
- }
-
- /**
- * Bean property setter: <property>examples</property>.
- * <p>
- * An example of the response message.
- * Keys must be MIME-type strings.
- *
- * @param examples The new value for the <property>examples</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Response setExamples(Map<String,Object> examples) {
- this.examples = examples;
- return this;
- }
-
- /**
- * Bean property adder: <property>examples</property>.
- * <p>
- * An example of the response message.
- *
- * @param mimeType The mimeType of the example.
- * @param example The example output.
- * @return This object (for method chaining).
- */
- public Response addExample(String mimeType, Object example) {
- if (examples == null)
- examples = new TreeMap<String,Object>();
- examples.put(mimeType, example);
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ResponseInfo.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ResponseInfo.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ResponseInfo.java
new file mode 100644
index 0000000..a57ce9a
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/ResponseInfo.java
@@ -0,0 +1,194 @@
+// ***************************************************************************************************************************
+// * 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.dto.swagger;
+
+import java.util.*;
+
+import org.apache.juneau.annotation.*;
+
+/**
+ * Describes a single response from an API Operation.
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
+ * {
+ * <js>"description"</js>: <js>"A complex object array response"</js>,
+ * <js>"schema"</js>: {
+ * <js>"type"</js>: <js>"array"</js>,
+ * <js>"items"</js>: {
+ * <js>"$ref"</js>: <js>"#/definitions/VeryComplexType"</js>
+ * }
+ * }
+ * }
+ * </p>
+ * @author james.bognar
+ */
+@Bean(properties="description,schema,headers,examples")
+public class ResponseInfo {
+
+ private String description;
+ private SchemaInfo schema;
+ private Map<String,HeaderInfo> headers;
+ private Map<String,Object> examples;
+
+ /**
+ * Convenience method for creating a new Response object.
+ *
+ * @param description A short description of the response.
+ * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
+ * @return A new Header object.
+ */
+ public static ResponseInfo create(String description) {
+ return new ResponseInfo().setDescription(description);
+ }
+
+ /**
+ * Bean property getter: <property>description</property>.
+ * <p>
+ * Required. A short description of the response.
+ * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
+ *
+ * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Bean property setter: <property>description</property>.
+ * <p>
+ * Required. A short description of the response.
+ * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
+ *
+ * @param description The new value for the <property>description</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ResponseInfo setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>schema</property>.
+ * <p>
+ * A definition of the response structure.
+ * It can be a primitive, an array or an object.
+ * If this field does not exist, it means no content is returned as part of the response.
+ * As an extension to the <a href='http://swagger.io/specification/#schemaObject'>Schema Object</a>, its root type value may also be <js>"file"</js>.
+ * This SHOULD be accompanied by a relevant produces mime-type.
+ *
+ * @return The value of the <property>schema</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public SchemaInfo getSchema() {
+ return schema;
+ }
+
+ /**
+ * Bean property setter: <property>schema</property>.
+ * <p>
+ * A definition of the response structure.
+ * It can be a primitive, an array or an object.
+ * If this field does not exist, it means no content is returned as part of the response.
+ * As an extension to the <a href='http://swagger.io/specification/#schemaObject'>Schema Object</a>, its root type value may also be <js>"file"</js>.
+ * This SHOULD be accompanied by a relevant produces mime-type.
+ *
+ * @param schema The new value for the <property>schema</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ResponseInfo setSchema(SchemaInfo schema) {
+ this.schema = schema;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>headers</property>.
+ * <p>
+ * A list of headers that are sent with the response.
+ *
+ * @return The value of the <property>headers</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Map<String,HeaderInfo> getHeaders() {
+ return headers;
+ }
+
+ /**
+ * Bean property setter: <property>headers</property>.
+ * <p>
+ * A list of headers that are sent with the response.
+ *
+ * @param headers The new value for the <property>headers</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ResponseInfo setHeaders(Map<String,HeaderInfo> headers) {
+ this.headers = headers;
+ return this;
+ }
+
+ /**
+ * Bean property adder: <property>headers</property>.
+ * <p>
+ * A list of headers that are sent with the response.
+ *
+ * @param name The header name.
+ * @param header The header descriptions
+ * @return This object (for method chaining).
+ */
+ public ResponseInfo addHeader(String name, HeaderInfo header) {
+ if (headers == null)
+ headers = new TreeMap<String,HeaderInfo>();
+ headers.put(name, header);
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>examples</property>.
+ * <p>
+ * An example of the response message.
+ * Keys must be MIME-type strings.
+ *
+ * @return The value of the <property>examples</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Map<String,Object> getExamples() {
+ return examples;
+ }
+
+ /**
+ * Bean property setter: <property>examples</property>.
+ * <p>
+ * An example of the response message.
+ * Keys must be MIME-type strings.
+ *
+ * @param examples The new value for the <property>examples</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public ResponseInfo setExamples(Map<String,Object> examples) {
+ this.examples = examples;
+ return this;
+ }
+
+ /**
+ * Bean property adder: <property>examples</property>.
+ * <p>
+ * An example of the response message.
+ *
+ * @param mimeType The mimeType of the example.
+ * @param example The example output.
+ * @return This object (for method chaining).
+ */
+ public ResponseInfo addExample(String mimeType, Object example) {
+ if (examples == null)
+ examples = new TreeMap<String,Object>();
+ examples.put(mimeType, example);
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Schema.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Schema.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Schema.java
deleted file mode 100644
index fd782a8..0000000
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Schema.java
+++ /dev/null
@@ -1,718 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.dto.swagger;
-
-import java.util.*;
-
-import org.apache.juneau.annotation.*;
-
-/**
- * The Schema Object allows the definition of input and output data types.
- * <p>
- * These types can be objects, but also primitives and arrays.
- * This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it.
- * On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
- * <p>
- * Further information about the properties can be found in JSON Schema Core and JSON Schema Validation.
- * Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.
- *
- * @author james.bognar
- */
-@Bean(properties="format,title,description,default,multipleOf,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,maxProperties,minProperties,required,enum,type,items,allOf,properties,additionalProperties,discriminator,readOnly,xml,externalDocs,example")
-public class Schema {
-
- private String format;
- private String title;
- private String description;
- private Object _default;
- private Number multipleOf;
- private Number maximum;
- private Boolean exclusiveMaximum;
- private Number minimum;
- private Boolean exclusiveMinimum;
- private Integer maxLength;
- private Integer minLength;
- private String pattern;
- private Integer maxItems;
- private Integer minItems;
- private Boolean uniqueItems;
- private Integer maxProperties;
- private Integer minProperties;
- private Boolean required;
- private List<Object> _enum;
- private String type;
- private Items items;
- private List<Object> allOf;
- private Map<String,Map<String,Object>> properties;
- private Map<String,Object> additionalProperties;
- private String discriminator;
- private Boolean readOnly;
- private Xml xml;
- private ExternalDocumentation externalDocs;
- private Object example;
-
- /**
- * Bean property getter: <property>format</property>.
- * <p>
- * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
- *
- * @return The value of the <property>format</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getFormat() {
- return format;
- }
-
- /**
- * Bean property setter: <property>format</property>.
- * <p>
- * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
- *
- * @param format The new value for the <property>format</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setFormat(String format) {
- this.format = format;
- return this;
- }
-
- /**
- * Bean property getter: <property>title</property>.
- *
- * @return The value of the <property>title</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * Bean property setter: <property>title</property>.
- *
- * @param title The new value for the <property>title</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setTitle(String title) {
- this.title = title;
- return this;
- }
-
- /**
- * Bean property getter: <property>description</property>.
- * <p>
- * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
- *
- * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Bean property setter: <property>description</property>.
- * <p>
- * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
- *
- * @param description The new value for the <property>description</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setDescription(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * Bean property getter: <property>default</property>.
- * <p>
- * Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
- *
- * @return The value of the <property>default</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Object getDefault() {
- return _default;
- }
-
- /**
- * Bean property setter: <property>default</property>.
- * <p>
- * Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
- *
- * @param _default The new value for the <property>default</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setDefault(Object _default) {
- this._default = _default;
- return this;
- }
-
- /**
- * Bean property getter: <property>multipleOf</property>.
- *
- * @return The value of the <property>multipleOf</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMultipleOf() {
- return multipleOf;
- }
-
- /**
- * Bean property setter: <property>multipleOf</property>.
- *
- * @param multipleOf The new value for the <property>multipleOf</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMultipleOf(Number multipleOf) {
- this.multipleOf = multipleOf;
- return this;
- }
-
- /**
- * Bean property getter: <property>maximum</property>.
- *
- * @return The value of the <property>maximum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMaximum() {
- return maximum;
- }
-
- /**
- * Bean property setter: <property>maximum</property>.
- *
- * @param maximum The new value for the <property>maximum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMaximum(Number maximum) {
- this.maximum = maximum;
- return this;
- }
-
- /**
- * Bean property getter: <property>exclusiveMaximum</property>.
- *
- * @return The value of the <property>exclusiveMaximum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getExclusiveMaximum() {
- return exclusiveMaximum;
- }
-
- /**
- * Bean property setter: <property>exclusiveMaximum</property>.
- *
- * @param exclusiveMaximum The new value for the <property>exclusiveMaximum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setExclusiveMaximum(Boolean exclusiveMaximum) {
- this.exclusiveMaximum = exclusiveMaximum;
- return this;
- }
-
- /**
- * Bean property getter: <property>minimum</property>.
- *
- * @return The value of the <property>minimum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMinimum() {
- return minimum;
- }
-
- /**
- * Bean property setter: <property>minimum</property>.
- *
- * @param minimum The new value for the <property>minimum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMinimum(Number minimum) {
- this.minimum = minimum;
- return this;
- }
-
- /**
- * Bean property getter: <property>exclusiveMinimum</property>.
- *
- * @return The value of the <property>exclusiveMinimum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getExclusiveMinimum() {
- return exclusiveMinimum;
- }
-
- /**
- * Bean property setter: <property>exclusiveMinimum</property>.
- *
- * @param exclusiveMinimum The new value for the <property>exclusiveMinimum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setExclusiveMinimum(Boolean exclusiveMinimum) {
- this.exclusiveMinimum = exclusiveMinimum;
- return this;
- }
-
- /**
- * Bean property getter: <property>maxLength</property>.
- *
- * @return The value of the <property>maxLength</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMaxLength() {
- return maxLength;
- }
-
- /**
- * Bean property setter: <property>maxLength</property>.
- *
- * @param maxLength The new value for the <property>maxLength</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMaxLength(Integer maxLength) {
- this.maxLength = maxLength;
- return this;
- }
-
- /**
- * Bean property getter: <property>minLength</property>.
- *
- * @return The value of the <property>minLength</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMinLength() {
- return minLength;
- }
-
- /**
- * Bean property setter: <property>minLength</property>.
- *
- * @param minLength The new value for the <property>minLength</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMinLength(Integer minLength) {
- this.minLength = minLength;
- return this;
- }
-
- /**
- * Bean property getter: <property>pattern</property>.
- *
- * @return The value of the <property>pattern</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getPattern() {
- return pattern;
- }
-
- /**
- * Bean property setter: <property>pattern</property>.
- *
- * @param pattern The new value for the <property>pattern</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setPattern(String pattern) {
- this.pattern = pattern;
- return this;
- }
-
- /**
- * Bean property getter: <property>maxItems</property>.
- *
- * @return The value of the <property>maxItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMaxItems() {
- return maxItems;
- }
-
- /**
- * Bean property setter: <property>maxItems</property>.
- *
- * @param maxItems The new value for the <property>maxItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMaxItems(Integer maxItems) {
- this.maxItems = maxItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>minItems</property>.
- *
- * @return The value of the <property>minItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMinItems() {
- return minItems;
- }
-
- /**
- * Bean property setter: <property>minItems</property>.
- *
- * @param minItems The new value for the <property>minItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMinItems(Integer minItems) {
- this.minItems = minItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>uniqueItems</property>.
- *
- * @return The value of the <property>uniqueItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getUniqueItems() {
- return uniqueItems;
- }
- /**
- * Bean property setter: <property>uniqueItems</property>.
- *
- * @param uniqueItems The new value for the <property>uniqueItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setUniqueItems(Boolean uniqueItems) {
- this.uniqueItems = uniqueItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>maxProperties</property>.
- *
- * @return The value of the <property>maxProperties</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMaxProperties() {
- return maxProperties;
- }
-
- /**
- * Bean property setter: <property>maxProperties</property>.
- *
- * @param maxProperties The new value for the <property>maxProperties</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMaxProperties(Integer maxProperties) {
- this.maxProperties = maxProperties;
- return this;
- }
-
- /**
- * Bean property getter: <property>minProperties</property>.
- *
- * @return The value of the <property>minProperties</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMinProperties() {
- return minProperties;
- }
-
- /**
- * Bean property setter: <property>minProperties</property>.
- *
- * @param minProperties The new value for the <property>minProperties</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setMinProperties(Integer minProperties) {
- this.minProperties = minProperties;
- return this;
- }
-
- /**
- * Bean property getter: <property>required</property>.
- *
- * @return The value of the <property>required</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getRequired() {
- return required;
- }
-
- /**
- * Bean property setter: <property>required</property>.
- *
- * @param required The new value for the <property>required</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setRequired(Boolean required) {
- this.required = required;
- return this;
- }
-
- /**
- * Bean property getter: <property>enum</property>.
- *
- * @return The value of the <property>enum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public List<Object> getEnum() {
- return _enum;
- }
-
- /**
- * Bean property setter: <property>enum</property>.
- *
- * @param _enum The new value for the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setEnum(List<Object> _enum) {
- this._enum = _enum;
- return this;
- }
-
- /**
- * Bean property adder: <property>enum</property>.
- *
- * @param _enum The new values to add to the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- @SuppressWarnings("hiding")
- public Schema addEnum(Object..._enum) {
- return addEnum(Arrays.asList(_enum));
- }
-
- /**
- * Bean property adder: <property>enum</property>.
- *
- * @param _enum The new values to add to the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- @SuppressWarnings("hiding")
- public Schema addEnum(Collection<Object> _enum) {
- if (this._enum == null)
- this._enum = new LinkedList<Object>();
- this._enum.addAll(_enum);
- return this;
- }
-
- /**
- * Bean property getter: <property>type</property>.
- *
- * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Bean property setter: <property>type</property>.
- *
- * @param type The new value for the <property>type</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setType(String type) {
- this.type = type;
- return this;
- }
-
- /**
- * Bean property getter: <property>items</property>.
- *
- * @return The value of the <property>items</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Items getItems() {
- return items;
- }
-
- /**
- * Bean property setter: <property>items</property>.
- *
- * @param items The new value for the <property>items</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setItems(Items items) {
- this.items = items;
- return this;
- }
-
- /**
- * Bean property getter: <property>allOf</property>.
- *
- * @return The value of the <property>allOf</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public List<Object> getAllOf() {
- return allOf;
- }
-
- /**
- * Bean property setter: <property>allOf</property>.
- *
- * @param allOf The new value for the <property>allOf</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setAllOf(List<Object> allOf) {
- this.allOf = allOf;
- return this;
- }
-
- /**
- * Bean property adder: <property>allOf</property>.
- *
- * @param allOf The new values to add to the <property>allOf</property> property on this bean.
- * @return This object (for method chaining).
- */
- @SuppressWarnings("hiding")
- public Schema addAllOf(Object...allOf) {
- return addAllOf(Arrays.asList(allOf));
- }
-
- /**
- * Bean property adder: <property>allOf</property>.
- *
- * @param allOf The new values to add to the <property>allOf</property> property on this bean.
- * @return This object (for method chaining).
- */
- @SuppressWarnings("hiding")
- public Schema addAllOf(Collection<Object> allOf) {
- if (this.allOf == null)
- this.allOf = new LinkedList<Object>();
- this.allOf.addAll(allOf);
- return this;
- }
-
- /**
- * Bean property getter: <property>properties</property>.
- *
- * @return The value of the <property>properties</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Map<String,Map<String,Object>> getProperties() {
- return properties;
- }
-
- /**
- * Bean property setter: <property>properties</property>.
- *
- * @param properties The new value for the <property>properties</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setProperties(Map<String,Map<String,Object>> properties) {
- this.properties = properties;
- return this;
- }
-
- /**
- * Bean property setter: <property>properties</property>.
- *
- * @param name The property name.
- * @param propertyProperties The properties of the property.
- * @return This object (for method chaining).
- */
- public Schema addProperty(String name, Map<String,Object> propertyProperties) {
- if (this.properties == null)
- this.properties = new TreeMap<String,Map<String,Object>>();
- this.properties.put(name, propertyProperties);
- return this;
- }
-
- /**
- * Bean property getter: <property>additionalProperties</property>.
- *
- * @return The value of the <property>additionalProperties</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Map<String,Object> getAdditionalProperties() {
- return additionalProperties;
- }
-
- /**
- * Bean property setter: <property>additionalProperties</property>.
- *
- * @param additionalProperties The new value for the <property>additionalProperties</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setAdditionalProperties(Map<String,Object> additionalProperties) {
- this.additionalProperties = additionalProperties;
- return this;
- }
-
- /**
- * Bean property getter: <property>discriminator</property>.
- *
- * @return The value of the <property>discriminator</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getDiscriminator() {
- return discriminator;
- }
-
- /**
- * Bean property setter: <property>discriminator</property>.
- *
- * @param discriminator The new value for the <property>discriminator</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setDiscriminator(String discriminator) {
- this.discriminator = discriminator;
- return this;
- }
-
- /**
- * Bean property getter: <property>readOnly</property>.
- *
- * @return The value of the <property>readOnly</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getReadOnly() {
- return readOnly;
- }
-
- /**
- * Bean property setter: <property>readOnly</property>.
- *
- * @param readOnly The new value for the <property>readOnly</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setReadOnly(Boolean readOnly) {
- this.readOnly = readOnly;
- return this;
- }
-
- /**
- * Bean property getter: <property>xml</property>.
- *
- * @return The value of the <property>xml</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Xml getXml() {
- return xml;
- }
-
- /**
- * Bean property setter: <property>xml</property>.
- *
- * @param xml The new value for the <property>xml</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setXml(Xml xml) {
- this.xml = xml;
- return this;
- }
-
- /**
- * Bean property getter: <property>externalDocs</property>.
- *
- * @return The value of the <property>externalDocs</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public ExternalDocumentation getExternalDocs() {
- return externalDocs;
- }
-
- /**
- * Bean property setter: <property>externalDocs</property>.
- *
- * @param externalDocs The new value for the <property>externalDocs</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setExternalDocs(ExternalDocumentation externalDocs) {
- this.externalDocs = externalDocs;
- return this;
- }
-
- /**
- * Bean property getter: <property>example</property>.
- *
- * @return The value of the <property>example</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Object getExample() {
- return example;
- }
-
- /**
- * Bean property setter: <property>example</property>.
- *
- * @param example The new value for the <property>example</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Schema setExample(Object example) {
- this.example = example;
- return this;
- }
-}
[7/8] incubator-juneau git commit: Doc updates.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/HeaderInfo.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/HeaderInfo.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/HeaderInfo.java
new file mode 100644
index 0000000..605453f
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/HeaderInfo.java
@@ -0,0 +1,582 @@
+// ***************************************************************************************************************************
+// * 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.dto.swagger;
+
+import java.util.*;
+
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.json.*;
+
+/**
+ * Describes a single HTTP header.
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
+ * {
+ * <js>"description"</js>: <js>"The number of allowed requests in the current period"</js>,
+ * <js>"type"</js>: <js>"integer"</js>
+ * }
+ * </p>
+ *
+ * @author james.bognar
+ */
+@Bean(properties="description,type,format,items,collectionFormat,default,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,enum,multipleOf")
+public class HeaderInfo {
+
+ private static final String[] VALID_TYPES = {"string", "number", "integer", "boolean", "array"};
+ private static final String[] VALID_COLLECTION_FORMATS = {"csv","ssv","tsv","pipes","multi"};
+
+ private String description;
+ private String type;
+ private String format;
+ private Items items;
+ private String collectionFormat;
+ private Object _default;
+ private Number maximum;
+ private Boolean exclusiveMaximum;
+ private Number minimum;
+ private Boolean exclusiveMinimum;
+ private Integer maxLength;
+ private Integer minLength;
+ private String pattern;
+ private Integer maxItems;
+ private Integer minItems;
+ private Boolean uniqueItems;
+ private List<Object> _enum;
+ private Number multipleOf;
+ private boolean strict;
+
+ /**
+ * Convenience method for creating a new Header object.
+ *
+ * @param type Required. The type of the object.
+ * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
+ * @return A new Header object.
+ */
+ public static HeaderInfo create(String type) {
+ return new HeaderInfo().setType(type);
+ }
+
+ /**
+ * Same as {@link #create(String)} except methods will throw runtime exceptions if you attempt
+ * to pass in invalid values per the Swagger spec.
+ *
+ * @param type Required. The type of the object.
+ * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
+ * @return A new Header object.
+ */
+ public static HeaderInfo createStrict(String type) {
+ return new HeaderInfo().setStrict().setType(type);
+ }
+
+ private HeaderInfo setStrict() {
+ this.strict = true;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>description</property>.
+ * <p>
+ * A short description of the header.
+ *
+ * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Bean property setter: <property>description</property>.
+ * <p>
+ * A short description of the header.
+ *
+ * @param description The new value for the <property>description</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>type</property>.
+ * <p>
+ * Required. The type of the object.
+ * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
+ *
+ * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Bean property setter: <property>type</property>.
+ * <p>
+ * Required. The type of the object.
+ * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
+ *
+ * @param type The new value for the <property>type</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setType(String type) {
+ if (strict && ! ArrayUtils.contains(type, VALID_TYPES))
+ throw new RuntimeException("Invalid value passed in to setType(String). Value='"+type+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_TYPES));
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>format</property>.
+ * <p>
+ * The extending format for the previously mentioned <code>type</code>. See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
+ *
+ * @return The value of the <property>format</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getFormat() {
+ return format;
+ }
+
+ /**
+ * Bean property setter: <property>format</property>.
+ * <p>
+ * The extending format for the previously mentioned <code>type</code>. See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
+ *
+ * @param format The new value for the <property>format</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setFormat(String format) {
+ this.format = format;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>items</property>.
+ * <p>
+ * Required if <code>type</code> is <js>"array"</js>.
+ * Describes the type of items in the array.
+ *
+ * @return The value of the <property>items</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Items getItems() {
+ return items;
+ }
+
+ /**
+ * Bean property setter: <property>items</property>.
+ * <p>
+ * Required if <code>type</code> is <js>"array"</js>.
+ * Describes the type of items in the array.
+ *
+ * @param items The new value for the <property>items</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setItems(Items items) {
+ this.items = items;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>collectionFormat</property>.
+ * <p>
+ * Determines the format of the array if type array is used.
+ * <p>
+ * Possible values are:
+ * <ul>
+ * <li><code>csv</code> - comma separated values <code>foo,bar</code>.
+ * <li><code>ssv</code> - space separated values <code>foo bar</code>.
+ * <li><code>tsv</code> - tab separated values <code>foo\tbar</code>.
+ * <li><code>pipes</code> - pipe separated values <code>foo|bar</code>.
+ * </ul>
+ * <p>
+ * Default value is <code>csv</code>.
+ *
+ * @return The value of the <property>collectionFormat</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getCollectionFormat() {
+ return collectionFormat;
+ }
+
+ /**
+ * Bean property setter: <property>collectionFormat</property>.
+ * <p>
+ * Determines the format of the array if type array is used.
+ * <p>
+ * Possible values are:
+ * <ul>
+ * <li><code>csv</code> - comma separated values <code>foo,bar</code>.
+ * <li><code>ssv</code> - space separated values <code>foo bar</code>.
+ * <li><code>tsv</code> - tab separated values <code>foo\tbar</code>.
+ * <li><code>pipes</code> - pipe separated values <code>foo|bar</code>.
+ * </ul>
+ * <p>
+ * Default value is <code>csv</code>.
+ *
+ * @param collectionFormat The new value for the <property>collectionFormat</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setCollectionFormat(String collectionFormat) {
+ if (strict && ! ArrayUtils.contains(collectionFormat, VALID_COLLECTION_FORMATS))
+ throw new RuntimeException("Invalid value passed in to setCollectionFormat(String). Value='"+collectionFormat+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_COLLECTION_FORMATS));
+ this.collectionFormat = collectionFormat;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>default</property>.
+ * <p>
+ * Declares the value of the header that the server will use if none is provided.
+ * (Note: <js>"default"</js> has no meaning for required items.)
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
+ * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for the header.
+ *
+ * @return The value of the <property>_default</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Object getDefault() {
+ return _default;
+ }
+
+ /**
+ * Bean property setter: <property>default</property>.
+ * <p>
+ * Declares the value of the header that the server will use if none is provided.
+ * (Note: <js>"default"</js> has no meaning for required items.)
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
+ * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for the header.
+ *
+ * @param _default The new value for the <property>_default</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setDefault(Object _default) {
+ this._default = _default;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maximum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
+ *
+ * @return The value of the <property>maximum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMaximum() {
+ return maximum;
+ }
+
+ /**
+ * Bean property setter: <property>maximum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
+ *
+ * @param maximum The new value for the <property>maximum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setMaximum(Number maximum) {
+ this.maximum = maximum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>exclusiveMaximum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
+ *
+ * @return The value of the <property>exclusiveMaximum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getExclusiveMaximum() {
+ return exclusiveMaximum;
+ }
+
+ /**
+ * Bean property setter: <property>exclusiveMaximum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
+ *
+ * @param exclusiveMaximum The new value for the <property>exclusiveMaximum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setExclusiveMaximum(Boolean exclusiveMaximum) {
+ this.exclusiveMaximum = exclusiveMaximum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minimum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
+ *
+ * @return The value of the <property>minimum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMinimum() {
+ return minimum;
+ }
+
+ /**
+ * Bean property setter: <property>minimum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
+ *
+ * @param minimum The new value for the <property>minimum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setMinimum(Number minimum) {
+ this.minimum = minimum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>exclusiveMinimum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
+ *
+ * @return The value of the <property>exclusiveMinimum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getExclusiveMinimum() {
+ return exclusiveMinimum;
+ }
+
+ /**
+ * Bean property setter: <property>exclusiveMinimum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
+ *
+ * @param exclusiveMinimum The new value for the <property>exclusiveMinimum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setExclusiveMinimum(Boolean exclusiveMinimum) {
+ this.exclusiveMinimum = exclusiveMinimum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maxLength</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor26'>http://json-schema.org/latest/json-schema-validation.html#anchor26</a>.
+ *
+ * @return The value of the <property>maxLength</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ /**
+ * Bean property setter: <property>maxLength</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor26'>http://json-schema.org/latest/json-schema-validation.html#anchor26</a>.
+ *
+ * @param maxLength The new value for the <property>maxLength</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setMaxLength(Integer maxLength) {
+ this.maxLength = maxLength;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minLength</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor29'>http://json-schema.org/latest/json-schema-validation.html#anchor29</a>.
+ *
+ * @return The value of the <property>minLength</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMinLength() {
+ return minLength;
+ }
+
+ /**
+ * Bean property setter: <property>minLength</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor29'>http://json-schema.org/latest/json-schema-validation.html#anchor29</a>.
+ *
+ * @param minLength The new value for the <property>minLength</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setMinLength(Integer minLength) {
+ this.minLength = minLength;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>pattern</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor33'>http://json-schema.org/latest/json-schema-validation.html#anchor33</a>.
+ *
+ * @return The value of the <property>pattern</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getPattern() {
+ return pattern;
+ }
+
+ /**
+ * Bean property setter: <property>pattern</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor33'>http://json-schema.org/latest/json-schema-validation.html#anchor33</a>.
+ *
+ * @param pattern The new value for the <property>pattern</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setPattern(String pattern) {
+ this.pattern = pattern;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maxItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor42'>http://json-schema.org/latest/json-schema-validation.html#anchor42</a>.
+ *
+ * @return The value of the <property>maxItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMaxItems() {
+ return maxItems;
+ }
+
+ /**
+ * Bean property setter: <property>maxItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor42'>http://json-schema.org/latest/json-schema-validation.html#anchor42</a>.
+ *
+ * @param maxItems The new value for the <property>maxItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setMaxItems(Integer maxItems) {
+ this.maxItems = maxItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor45'>http://json-schema.org/latest/json-schema-validation.html#anchor45</a>.
+ *
+ * @return The value of the <property>minItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMinItems() {
+ return minItems;
+ }
+
+ /**
+ * Bean property setter: <property>minItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor45'>http://json-schema.org/latest/json-schema-validation.html#anchor45</a>.
+ *
+ * @param minItems The new value for the <property>minItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setMinItems(Integer minItems) {
+ this.minItems = minItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>uniqueItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor49'>http://json-schema.org/latest/json-schema-validation.html#anchor49</a>.
+ *
+ * @return The value of the <property>uniqueItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getUniqueItems() {
+ return uniqueItems;
+ }
+
+ /**
+ * Bean property setter: <property>uniqueItems</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor49'>http://json-schema.org/latest/json-schema-validation.html#anchor49</a>.
+ *
+ * @param uniqueItems The new value for the <property>uniqueItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setUniqueItems(Boolean uniqueItems) {
+ this.uniqueItems = uniqueItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>enum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
+ *
+ * @return The value of the <property>enum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public List<Object> getEnum() {
+ return _enum;
+ }
+
+ /**
+ * Bean property setter: <property>enum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
+ *
+ * @param _enum The new value for the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setEnum(List<Object> _enum) {
+ this._enum = _enum;
+ return this;
+ }
+
+ /**
+ * Bean property adder: <property>enum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
+ *
+ * @param _enum The new values to add to the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ @SuppressWarnings("hiding")
+ public HeaderInfo addEnum(Object..._enum) {
+ return addEnum(Arrays.asList(_enum));
+ }
+
+ /**
+ * Bean property adder: <property>enum</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
+ *
+ * @param _enum The new values to add to the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ @SuppressWarnings("hiding")
+ public HeaderInfo addEnum(Collection<Object> _enum) {
+ if (this._enum == null)
+ this._enum = new LinkedList<Object>();
+ this._enum.addAll(_enum);
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>multipleOf</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor14'>http://json-schema.org/latest/json-schema-validation.html#anchor14</a>.
+ *
+ * @return The value of the <property>multipleOf</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMultipleOf() {
+ return multipleOf;
+ }
+
+ /**
+ * Bean property setter: <property>multipleOf</property>.
+ * <p>
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor14'>http://json-schema.org/latest/json-schema-validation.html#anchor14</a>.
+ *
+ * @param multipleOf The new value for the <property>multipleOf</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public HeaderInfo setMultipleOf(Number multipleOf) {
+ this.multipleOf = multipleOf;
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Info.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Info.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Info.java
index 4a9a58e..454fbc8 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Info.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Info.java
@@ -16,8 +16,8 @@ import org.apache.juneau.annotation.*;
/**
* The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* {
* <js>"title"</js>: <js>"Swagger Sample App"</js>,
@@ -50,7 +50,7 @@ public class Info {
/**
* Convenience method for creating a new Info object.
- *
+ *
* @param title Required. The title of the application.
* @param version Required. Provides the version of the application API (not to be confused with the specification version).
* @return A new Info object.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Items.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Items.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Items.java
index 9b68a6d..3e54adf 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Items.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Items.java
@@ -20,8 +20,8 @@ import org.apache.juneau.json.*;
/**
* A limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located in "body".
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* {
* <js>"type"</js>: <js>"string"</js>,
@@ -58,7 +58,7 @@ public class Items {
/**
* Convenience method for creating a new Items object.
- *
+ *
* @param type Required. The internal type of the array.
* The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, or <js>"array"</js>.
* Files and models are not allowed.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/License.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/License.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/License.java
index 9691d71..3bdb7e1 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/License.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/License.java
@@ -16,8 +16,8 @@ import org.apache.juneau.annotation.*;
/**
* License information for the exposed API.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* {
* <js>"name"</js>: <js>"Apache 2.0"</js>,
@@ -35,7 +35,7 @@ public class License {
/**
* Convenience method for creating a new License object.
- *
+ *
* @param name Required. The license name used for the API.
* @return A new License object.
*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Operation.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Operation.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Operation.java
index 944e1bf..4416cde 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Operation.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Operation.java
@@ -18,8 +18,8 @@ import org.apache.juneau.annotation.*;
/**
* Describes a single API operation on a path.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* {
* <js>"tags"</js>: [
@@ -89,8 +89,8 @@ public class Operation {
private String operationId;
private List<String> consumes;
private List<String> produces;
- private List<Parameter> parameters;
- private Map<String,Response> responses;
+ private List<ParameterInfo> parameters;
+ private Map<String,ResponseInfo> responses;
private List<String> schemes;
private Boolean deprecated;
private List<Map<String,List<String>>> security;
@@ -389,7 +389,7 @@ public class Operation {
*
* @return The value of the <property>parameters</property> property on this bean, or <jk>null</jk> if it is not set.
*/
- public List<Parameter> getParameters() {
+ public List<ParameterInfo> getParameters() {
return parameters;
}
@@ -406,7 +406,7 @@ public class Operation {
* @param parameters The new value for the <property>parameters</property> property on this bean.
* @return This object (for method chaining).
*/
- public Operation setParameters(List<Parameter> parameters) {
+ public Operation setParameters(List<ParameterInfo> parameters) {
this.parameters = parameters;
return this;
}
@@ -424,9 +424,9 @@ public class Operation {
* @param parameter The new value to add to the <property>parameters</property> property on this bean.
* @return This object (for method chaining).
*/
- public Operation addParameter(Parameter parameter) {
+ public Operation addParameter(ParameterInfo parameter) {
if (parameters == null)
- parameters = new LinkedList<Parameter>();
+ parameters = new LinkedList<ParameterInfo>();
parameters.add(parameter);
return this;
}
@@ -438,7 +438,7 @@ public class Operation {
*
* @return The value of the <property>responses</property> property on this bean, or <jk>null</jk> if it is not set.
*/
- public Map<String,Response> getResponses() {
+ public Map<String,ResponseInfo> getResponses() {
return responses;
}
@@ -450,7 +450,7 @@ public class Operation {
* @param responses The new value for the <property>responses</property> property on this bean.
* @return This object (for method chaining).
*/
- public Operation setResponses(Map<String,Response> responses) {
+ public Operation setResponses(Map<String,ResponseInfo> responses) {
this.responses = responses;
return this;
}
@@ -464,9 +464,9 @@ public class Operation {
* @param response The response description.
* @return This object (for method chaining).
*/
- public Operation addResponse(String statusCode, Response response) {
+ public Operation addResponse(String statusCode, ResponseInfo response) {
if (responses == null)
- responses = new TreeMap<String,Response>();
+ responses = new TreeMap<String,ResponseInfo>();
responses.put(statusCode, response);
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Parameter.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Parameter.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Parameter.java
deleted file mode 100644
index 1297192..0000000
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Parameter.java
+++ /dev/null
@@ -1,776 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.dto.swagger;
-
-import java.util.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.internal.*;
-import org.apache.juneau.json.*;
-
-/**
- * Describes a single operation parameter.
- * <p>
- * A unique parameter is defined by a combination of a name and location.
- * <p>
- * There are five possible parameter types.
- * <ul>
- * <li><js>"path"</js> - Used together with Path Templating, where the parameter value is actually part of the operation's URL.
- * This does not include the host or base path of the API.
- * For example, in <code>/items/{itemId}</code>, the path parameter is <code>itemId</code>.
- * <li><js>"query"</js> - Parameters that are appended to the URL.
- * For example, in <code>/items?id=###</code>, the query parameter is <code>id</code>.
- * <li><js>"header"</js> - Custom headers that are expected as part of the request.
- * <li><js>"body"</js> - The payload that's appended to the HTTP request.
- * Since there can only be one payload, there can only be one body parameter.
- * The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only.
- * Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
- * <li><js>"formData"</js> - Used to describe the payload of an HTTP request when either <code>application/x-www-form-urlencoded</code>, <code>multipart/form-data</code> or both are used as the content type of the request (in Swagger's definition, the consumes property of an operation).
- * This is the only parameter type that can be used to send files, thus supporting the file type.
- * Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation.
- * Form parameters have a different format based on the content-type used (for further details, consult <code>http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4</code>):
- * <ul>
- * <li><js>"application/x-www-form-urlencoded"</js> - Similar to the format of Query parameters but as a payload.
- * For example, <code>foo=1&bar=swagger</code> - both <code>foo</code> and <code>bar</code> are form parameters.
- * This is normally used for simple parameters that are being transferred.
- * <li><js>"multipart/form-data"</js> - each parameter takes a section in the payload with an internal header.
- * For example, for the header <code>Content-Disposition: form-data; name="submit-name"<code> the name of the parameter is <code>submit-name</code>.
- * This type of form parameters is more commonly used for file transfers.
- * </ul>
- * </li>
- * </ul>
- *
- * @author james.bognar
- */
-@Bean(properties="in,name,type,description,required,schema,format,allowEmptyValue,items,collectionFormat,default,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,enum,multipleOf")
-public class Parameter {
-
- private static final String[] VALID_IN = {"query", "header", "path", "formData", "body"};
- private static final String[] VALID_TYPES = {"string", "number", "integer", "boolean", "array", "file"};
- private static final String[] VALID_COLLECTION_FORMATS = {"csv", "ssv", "tsv", "pipes", "multi"};
-
- private String name;
- private String in;
- private String description;
- private Boolean required;
- private Schema schema;
- private String type;
- private String format;
- private Boolean allowEmptyValue;
- private Items items;
- private String collectionFormat;
- private Object _default;
- private Number maximum;
- private Boolean exclusiveMaximum;
- private Number minimum;
- private Boolean exclusiveMinimum;
- private Integer maxLength;
- private Integer minLength;
- private String pattern;
- private Integer maxItems;
- private Integer minItems;
- private Boolean uniqueItems;
- private List<Object> _enum;
- private Number multipleOf;
- private boolean strict;
-
- /**
- * Convenience method for creating a new Parameter object.
- *
- * @param in Required. The location of the parameter.
- * Possible values are <js>"query"</js>, <js>"header"</js>, <js>"path"</js>, <js>"formData"</js> or <js>"body"</js>.
- * @param name Required. The name of the parameter.
- * Parameter names are case sensitive.
- * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
- * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
- * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
- * @return A new Parameter object.
- */
- public static Parameter create(String in, String name) {
- return new Parameter().setIn(in).setName(name);
- }
-
- /**
- * Same as {@link #create(String, String)} except methods will throw runtime exceptions if you attempt
- * to pass in invalid values per the Swagger spec.
- *
- * @param in Required. The location of the parameter.
- * Possible values are <js>"query"</js>, <js>"header"</js>, <js>"path"</js>, <js>"formData"</js> or <js>"body"</js>.
- * @param name Required. The name of the parameter.
- * Parameter names are case sensitive.
- * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
- * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
- * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
- * @return A new Parameter object.
- */
- public static Parameter createStrict(String in, String name) {
- return new Parameter().setStrict().setIn(in).setName(name);
- }
-
- private Parameter setStrict() {
- this.strict = true;
- return this;
- }
-
- /**
- * Bean property getter: <property>name</property>.
- * <p>
- * Required. The name of the parameter.
- * Parameter names are case sensitive.
- * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
- * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
- * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
- *
- * @return The value of the <property>name</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Bean property setter: <property>name</property>.
- * <p>
- * Required. The name of the parameter.
- * Parameter names are case sensitive.
- * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
- * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
- * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
- *
- * @param name The new value for the <property>name</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setName(String name) {
- if (! "body".equals(in))
- this.name = name;
- return this;
- }
-
- /**
- * Bean property getter: <property>in</property>.
- * <p>
- * Required. The location of the parameter.
- * Possible values are <js>"query"</js>, <js>"header"</js>, <js>"path"</js>, <js>"formData"</js> or <js>"body"</js>.
- *
- * @return The value of the <property>in</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getIn() {
- return in;
- }
-
- /**
- * Bean property setter: <property>in</property>.
- * <p>
- * Required. The location of the parameter.
- * Possible values are <js>"query"</js>, <js>"header"</js>, <js>"path"</js>, <js>"formData"</js> or <js>"body"</js>.
- *
- * @param in The new value for the <property>in</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setIn(String in) {
- if (strict && ! ArrayUtils.contains(in, VALID_IN))
- throw new RuntimeException("Invalid value passed in to setIn(String). Value='"+in+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_IN));
- this.in = in;
- if ("path".equals(in))
- required = true;
- return this;
- }
-
- /**
- * Bean property getter: <property>description</property>.
- * <p>
- * A brief description of the parameter.
- * This could contain examples of use.
- * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
- *
- * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Bean property setter: <property>description</property>.
- * <p>
- * A brief description of the parameter.
- * This could contain examples of use.
- * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
- *
- * @param description The new value for the <property>description</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setDescription(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * Bean property getter: <property>required</property>.
- * <p>
- * Determines whether this parameter is mandatory.
- * If the parameter is <code>in</code> <js>"path"</js>, this property is required and its value MUST be <jk>true</jk>.
- * Otherwise, the property MAY be included and its default value is <jk>false</jk>.
- *
- * @return The value of the <property>required</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getRequired() {
- return required;
- }
-
- /**
- * Bean property setter: <property>required</property>.
- * <p>
- * Determines whether this parameter is mandatory.
- * If the parameter is <code>in</code> <js>"path"</js>, this property is required and its value MUST be <jk>true</jk>.
- * Otherwise, the property MAY be included and its default value is <jk>false</jk>.
- *
- * @param required The new value for the <property>required</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setRequired(Boolean required) {
- this.required = required;
- return this;
- }
-
- /**
- * Bean property getter: <property>schema</property>.
- * <p>
- * Required. The schema defining the type used for the body parameter.
- *
- * @return The value of the <property>schema</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Schema getSchema() {
- return schema;
- }
-
- /**
- * Bean property setter: <property>schema</property>.
- * <p>
- * Required. The schema defining the type used for the body parameter.
- *
- * @param schema The new value for the <property>schema</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setSchema(Schema schema) {
- this.schema = schema;
- return this;
- }
-
- /**
- * Bean property getter: <property>type</property>.
- * <p>
- * Required. The type of the parameter.
- * Since the parameter is not located at the request body, it is limited to simple types (that is, not an object).
- * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, <js>"array"</js> or <js>"file"</js>.
- * If type is <js>"file"</js>, the <code>consumes</code> MUST be either <js>"multipart/form-data"</js>, <js>"application/x-www-form-urlencoded"</js> or both and the parameter MUST be <code>in</code> <js>"formData"</js>.
- *
- * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Bean property setter: <property>type</property>.
- * <p>
- * Required. The type of the parameter.
- * Since the parameter is not located at the request body, it is limited to simple types (that is, not an object).
- * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, <js>"array"</js> or <js>"file"</js>.
- * If type is <js>"file"</js>, the <code>consumes</code> MUST be either <js>"multipart/form-data"</js>, <js>"application/x-www-form-urlencoded"</js> or both and the parameter MUST be <code>in</code> <js>"formData"</js>.
- *
- * @param type The new value for the <property>type</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setType(String type) {
- if (strict && ! ArrayUtils.contains(type, VALID_TYPES))
- throw new RuntimeException("Invalid value passed in to setType(String). Value='"+type+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_TYPES));
- this.type = type;
- return this;
- }
-
- /**
- * Bean property getter: <property>format</property>.
- * <p>
- * The extending format for the previously mentioned type.
- * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
- *
- * @return The value of the <property>format</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getFormat() {
- return format;
- }
-
- /**
- * Bean property setter: <property>format</property>.
- * <p>
- * The extending format for the previously mentioned type.
- * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
- *
- * @param format The new value for the <property>format</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setFormat(String format) {
- this.format = format;
- return this;
- }
-
- /**
- * Bean property getter: <property>allowEmptyValue</property>.
- * <p>
- * Sets the ability to pass empty-valued parameters.
- * This is valid only for either <code>query</code> or <code>formData</code> parameters and allows you to send a parameter with a name only or an empty value.
- * Default value is <jk>false</jk>.
- *
- * @return The value of the <property>allowEmptyValue</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getAllowEmptyValue() {
- return allowEmptyValue;
- }
-
- /**
- * Bean property setter: <property>allowEmptyValue</property>.
- * <p>
- * Sets the ability to pass empty-valued parameters.
- * This is valid only for either <code>query</code> or <code>formData</code> parameters and allows you to send a parameter with a name only or an empty value.
- * Default value is <jk>false</jk>.
- *
- * @param allowEmptyValue The new value for the <property>allowEmptyValue</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setAllowEmptyValue(Boolean allowEmptyValue) {
- this.allowEmptyValue = allowEmptyValue;
- return this;
- }
-
- /**
- * Bean property getter: <property>items</property>.
- * <p>
- * Required if <code>type</code> is <js>"array"</js>.
- * Describes the type of items in the array.
- *
- * @return The value of the <property>items</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Items getItems() {
- return items;
- }
-
- /**
- * Bean property setter: <property>items</property>.
- * <p>
- * Required if <code>type</code> is <js>"array"</js>.
- * Describes the type of items in the array.
- *
- * @param items The new value for the <property>items</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setItems(Items items) {
- this.items = items;
- return this;
- }
-
- /**
- * Bean property getter: <property>collectionFormat</property>.
- * <p>
- * Determines the format of the array if type array is used.
- * <p>
- * Possible values are:
- * <ul>
- * <li><code>csv</code> - comma separated values <code>foo,bar</code>.
- * <li><code>ssv</code> - space separated values <code>foo bar</code>.
- * <li><code>tsv</code> - tab separated values <code>foo\tbar</code>.
- * <li><code>pipes</code> - pipe separated values <code>foo|bar</code>.
- * <li><code>multi</code> - corresponds to multiple parameter instances instead of multiple values for a single instance <code>foo=bar&foo=baz</code>.
- * This is valid only for parameters <code>in</code> <js>"query"</js> or <js>"formData"</js>.
- * </ul>
- * <p>
- * Default value is <code>csv</code>.
- *
- * @return The value of the <property>collectionFormat</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getCollectionFormat() {
- return collectionFormat;
- }
-
- /**
- * Bean property setter: <property>collectionFormat</property>.
- * <p>
- * Determines the format of the array if type array is used.
- * <p>
- * Possible values are:
- * <ul>
- * <li><code>csv</code> - comma separated values <code>foo,bar</code>.
- * <li><code>ssv</code> - space separated values <code>foo bar</code>.
- * <li><code>tsv</code> - tab separated values <code>foo\tbar</code>.
- * <li><code>pipes</code> - pipe separated values <code>foo|bar</code>.
- * <li><code>multi</code> - corresponds to multiple parameter instances instead of multiple values for a single instance <code>foo=bar&foo=baz</code>.
- * This is valid only for parameters <code>in</code> <js>"query"</js> or <js>"formData"</js>.
- * </ul>
- * <p>
- * Default value is <code>csv</code>.
- *
- * @param collectionFormat The new value for the <property>collectionFormat</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setCollectionFormat(String collectionFormat) {
- if (strict && ! ArrayUtils.contains(collectionFormat, VALID_COLLECTION_FORMATS))
- throw new RuntimeException("Invalid value passed in to setCollectionFormat(String). Value='"+collectionFormat+"', valid values=" + JsonSerializer.DEFAULT_LAX.toString(VALID_COLLECTION_FORMATS));
- this.collectionFormat = collectionFormat;
- return this;
- }
-
- /**
- * Bean property getter: <property>default</property>.
- * <p>
- * Declares the value of the parameter that the server will use if none is provided, for example a <js>"count"</js> to control the number of results per page might default to 100 if not supplied by the client in the request.
- * (Note: <js>"default"</js> has no meaning for required parameters.)
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
- * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for this parameter.
- *
- * @return The value of the <property>default</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Object getDefault() {
- return _default;
- }
-
- /**
- * Bean property setter: <property>default</property>.
- * <p>
- * Declares the value of the parameter that the server will use if none is provided, for example a <js>"count"</js> to control the number of results per page might default to 100 if not supplied by the client in the request.
- * (Note: <js>"default"</js> has no meaning for required parameters.)
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
- * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for this parameter.
- *
- * @param _default The new value for the <property>default</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setDefault(Object _default) {
- this._default = _default;
- return this;
- }
-
- /**
- * Bean property getter: <property>maximum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
- *
- * @return The value of the <property>maximum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMaximum() {
- return maximum;
- }
-
- /**
- * Bean property setter: <property>maximum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
- *
- * @param maximum The new value for the <property>maximum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setMaximum(Number maximum) {
- this.maximum = maximum;
- return this;
- }
-
- /**
- * Bean property getter: <property>exclusiveMaximum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
- *
- * @return The value of the <property>exclusiveMaximum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getExclusiveMaximum() {
- return exclusiveMaximum;
- }
-
- /**
- * Bean property setter: <property>exclusiveMaximum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor17'>http://json-schema.org/latest/json-schema-validation.html#anchor17</a>.
- *
- * @param exclusiveMaximum The new value for the <property>exclusiveMaximum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setExclusiveMaximum(Boolean exclusiveMaximum) {
- this.exclusiveMaximum = exclusiveMaximum;
- return this;
- }
-
- /**
- * Bean property getter: <property>minimum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
- *
- * @return The value of the <property>minimum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMinimum() {
- return minimum;
- }
-
- /**
- * Bean property setter: <property>minimum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
- *
- * @param minimum The new value for the <property>minimum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setMinimum(Number minimum) {
- this.minimum = minimum;
- return this;
- }
-
- /**
- * Bean property getter: <property>exclusiveMinimum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
- *
- * @return The value of the <property>exclusiveMinimum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getExclusiveMinimum() {
- return exclusiveMinimum;
- }
-
- /**
- * Bean property setter: <property>exclusiveMinimum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor21'>http://json-schema.org/latest/json-schema-validation.html#anchor21</a>.
- *
- * @param exclusiveMinimum The new value for the <property>exclusiveMinimum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setExclusiveMinimum(Boolean exclusiveMinimum) {
- this.exclusiveMinimum = exclusiveMinimum;
- return this;
- }
-
- /**
- * Bean property getter: <property>maxLength</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor26'>http://json-schema.org/latest/json-schema-validation.html#anchor26</a>.
- *
- * @return The value of the <property>maxLength</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMaxLength() {
- return maxLength;
- }
-
- /**
- * Bean property setter: <property>maxLength</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor26'>http://json-schema.org/latest/json-schema-validation.html#anchor26</a>.
- *
- * @param maxLength The new value for the <property>maxLength</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setMaxLength(Integer maxLength) {
- this.maxLength = maxLength;
- return this;
- }
-
- /**
- * Bean property getter: <property>minLength</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor29'>http://json-schema.org/latest/json-schema-validation.html#anchor29</a>.
- *
- * @return The value of the <property>minLength</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMinLength() {
- return minLength;
- }
-
- /**
- * Bean property setter: <property>minLength</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor29'>http://json-schema.org/latest/json-schema-validation.html#anchor29</a>.
- *
- * @param minLength The new value for the <property>minLength</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setMinLength(Integer minLength) {
- this.minLength = minLength;
- return this;
- }
-
- /**
- * Bean property getter: <property>pattern</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor33'>http://json-schema.org/latest/json-schema-validation.html#anchor33</a>.
- *
- * @return The value of the <property>pattern</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public String getPattern() {
- return pattern;
- }
-
- /**
- * Bean property setter: <property>pattern</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor33'>http://json-schema.org/latest/json-schema-validation.html#anchor33</a>.
- *
- * @param pattern The new value for the <property>pattern</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setPattern(String pattern) {
- this.pattern = pattern;
- return this;
- }
-
- /**
- * Bean property getter: <property>maxItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor42'>http://json-schema.org/latest/json-schema-validation.html#anchor42</a>.
- *
- * @return The value of the <property>maxItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMaxItems() {
- return maxItems;
- }
-
- /**
- * Bean property setter: <property>maxItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor42'>http://json-schema.org/latest/json-schema-validation.html#anchor42</a>.
- *
- * @param maxItems The new value for the <property>maxItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setMaxItems(Integer maxItems) {
- this.maxItems = maxItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>minItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor45'>http://json-schema.org/latest/json-schema-validation.html#anchor45</a>.
- *
- * @return The value of the <property>minItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Integer getMinItems() {
- return minItems;
- }
-
- /**
- * Bean property setter: <property>minItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor45'>http://json-schema.org/latest/json-schema-validation.html#anchor45</a>.
- *
- * @param minItems The new value for the <property>minItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setMinItems(Integer minItems) {
- this.minItems = minItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>uniqueItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor49'>http://json-schema.org/latest/json-schema-validation.html#anchor49</a>.
- *
- * @return The value of the <property>uniqueItems</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Boolean getUniqueItems() {
- return uniqueItems;
- }
-
- /**
- * Bean property setter: <property>uniqueItems</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor49'>http://json-schema.org/latest/json-schema-validation.html#anchor49</a>.
- *
- * @param uniqueItems The new value for the <property>uniqueItems</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setUniqueItems(Boolean uniqueItems) {
- this.uniqueItems = uniqueItems;
- return this;
- }
-
- /**
- * Bean property getter: <property>enum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
- *
- * @return The value of the <property>enum</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public List<Object> getEnum() {
- return _enum;
- }
-
- /**
- * Bean property setter: <property>enum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
- *
- * @param _enum The new value for the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setEnum(List<Object> _enum) {
- this._enum = _enum;
- return this;
- }
-
- /**
- * Bean property adder: <property>enum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
- *
- * @param _enum The new values to add to the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- @SuppressWarnings("hiding")
- public Parameter addEnum(Object..._enum) {
- return addEnum(Arrays.asList(_enum));
- }
-
- /**
- * Bean property adder: <property>enum</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor76'>http://json-schema.org/latest/json-schema-validation.html#anchor76</a>.
- *
- * @param _enum The new values to add to the <property>enum</property> property on this bean.
- * @return This object (for method chaining).
- */
- @SuppressWarnings("hiding")
- public Parameter addEnum(Collection<Object> _enum) {
- if (this._enum == null)
- this._enum = new LinkedList<Object>();
- this._enum.addAll(_enum);
- return this;
- }
-
- /**
- * Bean property getter: <property>multipleOf</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor14'>http://json-schema.org/latest/json-schema-validation.html#anchor14</a>.
- *
- * @return The value of the <property>multipleOf</property> property on this bean, or <jk>null</jk> if it is not set.
- */
- public Number getMultipleOf() {
- return multipleOf;
- }
-
- /**
- * Bean property setter: <property>multipleOf</property>.
- * <p>
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor14'>http://json-schema.org/latest/json-schema-validation.html#anchor14</a>.
- *
- * @param multipleOf The new value for the <property>multipleOf</property> property on this bean.
- * @return This object (for method chaining).
- */
- public Parameter setMultipleOf(Number multipleOf) {
- this.multipleOf = multipleOf;
- return this;
- }
-}
[5/8] incubator-juneau git commit: Doc updates.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java
new file mode 100644
index 0000000..49b4224
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java
@@ -0,0 +1,718 @@
+// ***************************************************************************************************************************
+// * 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.dto.swagger;
+
+import java.util.*;
+
+import org.apache.juneau.annotation.*;
+
+/**
+ * The Schema Object allows the definition of input and output data types.
+ * <p>
+ * These types can be objects, but also primitives and arrays.
+ * This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it.
+ * On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
+ * <p>
+ * Further information about the properties can be found in JSON Schema Core and JSON Schema Validation.
+ * Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.
+ *
+ * @author james.bognar
+ */
+@Bean(properties="format,title,description,default,multipleOf,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,maxProperties,minProperties,required,enum,type,items,allOf,properties,additionalProperties,discriminator,readOnly,xml,externalDocs,example")
+public class SchemaInfo {
+
+ private String format;
+ private String title;
+ private String description;
+ private Object _default;
+ private Number multipleOf;
+ private Number maximum;
+ private Boolean exclusiveMaximum;
+ private Number minimum;
+ private Boolean exclusiveMinimum;
+ private Integer maxLength;
+ private Integer minLength;
+ private String pattern;
+ private Integer maxItems;
+ private Integer minItems;
+ private Boolean uniqueItems;
+ private Integer maxProperties;
+ private Integer minProperties;
+ private Boolean required;
+ private List<Object> _enum;
+ private String type;
+ private Items items;
+ private List<Object> allOf;
+ private Map<String,Map<String,Object>> properties;
+ private Map<String,Object> additionalProperties;
+ private String discriminator;
+ private Boolean readOnly;
+ private Xml xml;
+ private ExternalDocumentation externalDocs;
+ private Object example;
+
+ /**
+ * Bean property getter: <property>format</property>.
+ * <p>
+ * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
+ *
+ * @return The value of the <property>format</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getFormat() {
+ return format;
+ }
+
+ /**
+ * Bean property setter: <property>format</property>.
+ * <p>
+ * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
+ *
+ * @param format The new value for the <property>format</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setFormat(String format) {
+ this.format = format;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>title</property>.
+ *
+ * @return The value of the <property>title</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Bean property setter: <property>title</property>.
+ *
+ * @param title The new value for the <property>title</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setTitle(String title) {
+ this.title = title;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>description</property>.
+ * <p>
+ * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
+ *
+ * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Bean property setter: <property>description</property>.
+ * <p>
+ * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
+ *
+ * @param description The new value for the <property>description</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>default</property>.
+ * <p>
+ * Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
+ *
+ * @return The value of the <property>default</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Object getDefault() {
+ return _default;
+ }
+
+ /**
+ * Bean property setter: <property>default</property>.
+ * <p>
+ * Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
+ *
+ * @param _default The new value for the <property>default</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setDefault(Object _default) {
+ this._default = _default;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>multipleOf</property>.
+ *
+ * @return The value of the <property>multipleOf</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMultipleOf() {
+ return multipleOf;
+ }
+
+ /**
+ * Bean property setter: <property>multipleOf</property>.
+ *
+ * @param multipleOf The new value for the <property>multipleOf</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMultipleOf(Number multipleOf) {
+ this.multipleOf = multipleOf;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maximum</property>.
+ *
+ * @return The value of the <property>maximum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMaximum() {
+ return maximum;
+ }
+
+ /**
+ * Bean property setter: <property>maximum</property>.
+ *
+ * @param maximum The new value for the <property>maximum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMaximum(Number maximum) {
+ this.maximum = maximum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>exclusiveMaximum</property>.
+ *
+ * @return The value of the <property>exclusiveMaximum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getExclusiveMaximum() {
+ return exclusiveMaximum;
+ }
+
+ /**
+ * Bean property setter: <property>exclusiveMaximum</property>.
+ *
+ * @param exclusiveMaximum The new value for the <property>exclusiveMaximum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setExclusiveMaximum(Boolean exclusiveMaximum) {
+ this.exclusiveMaximum = exclusiveMaximum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minimum</property>.
+ *
+ * @return The value of the <property>minimum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Number getMinimum() {
+ return minimum;
+ }
+
+ /**
+ * Bean property setter: <property>minimum</property>.
+ *
+ * @param minimum The new value for the <property>minimum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMinimum(Number minimum) {
+ this.minimum = minimum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>exclusiveMinimum</property>.
+ *
+ * @return The value of the <property>exclusiveMinimum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getExclusiveMinimum() {
+ return exclusiveMinimum;
+ }
+
+ /**
+ * Bean property setter: <property>exclusiveMinimum</property>.
+ *
+ * @param exclusiveMinimum The new value for the <property>exclusiveMinimum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setExclusiveMinimum(Boolean exclusiveMinimum) {
+ this.exclusiveMinimum = exclusiveMinimum;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maxLength</property>.
+ *
+ * @return The value of the <property>maxLength</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ /**
+ * Bean property setter: <property>maxLength</property>.
+ *
+ * @param maxLength The new value for the <property>maxLength</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMaxLength(Integer maxLength) {
+ this.maxLength = maxLength;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minLength</property>.
+ *
+ * @return The value of the <property>minLength</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMinLength() {
+ return minLength;
+ }
+
+ /**
+ * Bean property setter: <property>minLength</property>.
+ *
+ * @param minLength The new value for the <property>minLength</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMinLength(Integer minLength) {
+ this.minLength = minLength;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>pattern</property>.
+ *
+ * @return The value of the <property>pattern</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getPattern() {
+ return pattern;
+ }
+
+ /**
+ * Bean property setter: <property>pattern</property>.
+ *
+ * @param pattern The new value for the <property>pattern</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setPattern(String pattern) {
+ this.pattern = pattern;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maxItems</property>.
+ *
+ * @return The value of the <property>maxItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMaxItems() {
+ return maxItems;
+ }
+
+ /**
+ * Bean property setter: <property>maxItems</property>.
+ *
+ * @param maxItems The new value for the <property>maxItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMaxItems(Integer maxItems) {
+ this.maxItems = maxItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minItems</property>.
+ *
+ * @return The value of the <property>minItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMinItems() {
+ return minItems;
+ }
+
+ /**
+ * Bean property setter: <property>minItems</property>.
+ *
+ * @param minItems The new value for the <property>minItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMinItems(Integer minItems) {
+ this.minItems = minItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>uniqueItems</property>.
+ *
+ * @return The value of the <property>uniqueItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getUniqueItems() {
+ return uniqueItems;
+ }
+ /**
+ * Bean property setter: <property>uniqueItems</property>.
+ *
+ * @param uniqueItems The new value for the <property>uniqueItems</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setUniqueItems(Boolean uniqueItems) {
+ this.uniqueItems = uniqueItems;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>maxProperties</property>.
+ *
+ * @return The value of the <property>maxProperties</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMaxProperties() {
+ return maxProperties;
+ }
+
+ /**
+ * Bean property setter: <property>maxProperties</property>.
+ *
+ * @param maxProperties The new value for the <property>maxProperties</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMaxProperties(Integer maxProperties) {
+ this.maxProperties = maxProperties;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>minProperties</property>.
+ *
+ * @return The value of the <property>minProperties</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Integer getMinProperties() {
+ return minProperties;
+ }
+
+ /**
+ * Bean property setter: <property>minProperties</property>.
+ *
+ * @param minProperties The new value for the <property>minProperties</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setMinProperties(Integer minProperties) {
+ this.minProperties = minProperties;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>required</property>.
+ *
+ * @return The value of the <property>required</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getRequired() {
+ return required;
+ }
+
+ /**
+ * Bean property setter: <property>required</property>.
+ *
+ * @param required The new value for the <property>required</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setRequired(Boolean required) {
+ this.required = required;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>enum</property>.
+ *
+ * @return The value of the <property>enum</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public List<Object> getEnum() {
+ return _enum;
+ }
+
+ /**
+ * Bean property setter: <property>enum</property>.
+ *
+ * @param _enum The new value for the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setEnum(List<Object> _enum) {
+ this._enum = _enum;
+ return this;
+ }
+
+ /**
+ * Bean property adder: <property>enum</property>.
+ *
+ * @param _enum The new values to add to the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ @SuppressWarnings("hiding")
+ public SchemaInfo addEnum(Object..._enum) {
+ return addEnum(Arrays.asList(_enum));
+ }
+
+ /**
+ * Bean property adder: <property>enum</property>.
+ *
+ * @param _enum The new values to add to the <property>enum</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ @SuppressWarnings("hiding")
+ public SchemaInfo addEnum(Collection<Object> _enum) {
+ if (this._enum == null)
+ this._enum = new LinkedList<Object>();
+ this._enum.addAll(_enum);
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>type</property>.
+ *
+ * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Bean property setter: <property>type</property>.
+ *
+ * @param type The new value for the <property>type</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setType(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>items</property>.
+ *
+ * @return The value of the <property>items</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Items getItems() {
+ return items;
+ }
+
+ /**
+ * Bean property setter: <property>items</property>.
+ *
+ * @param items The new value for the <property>items</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setItems(Items items) {
+ this.items = items;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>allOf</property>.
+ *
+ * @return The value of the <property>allOf</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public List<Object> getAllOf() {
+ return allOf;
+ }
+
+ /**
+ * Bean property setter: <property>allOf</property>.
+ *
+ * @param allOf The new value for the <property>allOf</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setAllOf(List<Object> allOf) {
+ this.allOf = allOf;
+ return this;
+ }
+
+ /**
+ * Bean property adder: <property>allOf</property>.
+ *
+ * @param allOf The new values to add to the <property>allOf</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ @SuppressWarnings("hiding")
+ public SchemaInfo addAllOf(Object...allOf) {
+ return addAllOf(Arrays.asList(allOf));
+ }
+
+ /**
+ * Bean property adder: <property>allOf</property>.
+ *
+ * @param allOf The new values to add to the <property>allOf</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ @SuppressWarnings("hiding")
+ public SchemaInfo addAllOf(Collection<Object> allOf) {
+ if (this.allOf == null)
+ this.allOf = new LinkedList<Object>();
+ this.allOf.addAll(allOf);
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>properties</property>.
+ *
+ * @return The value of the <property>properties</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Map<String,Map<String,Object>> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Bean property setter: <property>properties</property>.
+ *
+ * @param properties The new value for the <property>properties</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setProperties(Map<String,Map<String,Object>> properties) {
+ this.properties = properties;
+ return this;
+ }
+
+ /**
+ * Bean property setter: <property>properties</property>.
+ *
+ * @param name The property name.
+ * @param propertyProperties The properties of the property.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo addProperty(String name, Map<String,Object> propertyProperties) {
+ if (this.properties == null)
+ this.properties = new TreeMap<String,Map<String,Object>>();
+ this.properties.put(name, propertyProperties);
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>additionalProperties</property>.
+ *
+ * @return The value of the <property>additionalProperties</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Map<String,Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ /**
+ * Bean property setter: <property>additionalProperties</property>.
+ *
+ * @param additionalProperties The new value for the <property>additionalProperties</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setAdditionalProperties(Map<String,Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>discriminator</property>.
+ *
+ * @return The value of the <property>discriminator</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public String getDiscriminator() {
+ return discriminator;
+ }
+
+ /**
+ * Bean property setter: <property>discriminator</property>.
+ *
+ * @param discriminator The new value for the <property>discriminator</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setDiscriminator(String discriminator) {
+ this.discriminator = discriminator;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>readOnly</property>.
+ *
+ * @return The value of the <property>readOnly</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Boolean getReadOnly() {
+ return readOnly;
+ }
+
+ /**
+ * Bean property setter: <property>readOnly</property>.
+ *
+ * @param readOnly The new value for the <property>readOnly</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setReadOnly(Boolean readOnly) {
+ this.readOnly = readOnly;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>xml</property>.
+ *
+ * @return The value of the <property>xml</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Xml getXml() {
+ return xml;
+ }
+
+ /**
+ * Bean property setter: <property>xml</property>.
+ *
+ * @param xml The new value for the <property>xml</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setXml(Xml xml) {
+ this.xml = xml;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>externalDocs</property>.
+ *
+ * @return The value of the <property>externalDocs</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public ExternalDocumentation getExternalDocs() {
+ return externalDocs;
+ }
+
+ /**
+ * Bean property setter: <property>externalDocs</property>.
+ *
+ * @param externalDocs The new value for the <property>externalDocs</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setExternalDocs(ExternalDocumentation externalDocs) {
+ this.externalDocs = externalDocs;
+ return this;
+ }
+
+ /**
+ * Bean property getter: <property>example</property>.
+ *
+ * @return The value of the <property>example</property> property on this bean, or <jk>null</jk> if it is not set.
+ */
+ public Object getExample() {
+ return example;
+ }
+
+ /**
+ * Bean property setter: <property>example</property>.
+ *
+ * @param example The new value for the <property>example</property> property on this bean.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo setExample(Object example) {
+ this.example = example;
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java
index 96f9fe5..9180b15 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java
@@ -22,8 +22,8 @@ import org.apache.juneau.json.*;
* Allows the definition of a security scheme that can be used by the operations.
* <p>
* Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code).
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Basic authentication sample</jc>
* {
@@ -68,7 +68,7 @@ public class SecurityScheme {
/**
* Convenience method for creating a new SecurityScheme object.
- *
+ *
* @param type Required. The type of the security scheme.
* Valid values are <js>"basic"</js>, <js>"apiKey"</js> or <js>"oauth2"</js>.
* @return A new SecurityScheme object.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
index 723c873..dc8bbd3 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
@@ -34,9 +34,9 @@ public class Swagger {
private List<String> consumes;
private List<String> produces;
private Map<String,Map<String,Operation>> paths;
- private Map<String,Schema> definitions;
- private Map<String,Parameter> parameters;
- private Map<String,Response> responses;
+ private Map<String,SchemaInfo> definitions;
+ private Map<String,ParameterInfo> parameters;
+ private Map<String,ResponseInfo> responses;
private Map<String,SecurityScheme> securityDefinitions;
private List<Map<String,List<String>>> security;
private List<Tag> tags;
@@ -391,7 +391,7 @@ public class Swagger {
paths = new TreeMap<String,Map<String,Operation>>();
Map<String,Operation> p = paths.get(path);
if (p == null) {
- p = new TreeMap<String,Operation>();
+ p = new TreeMap<String,Operation>(new MethodSorter());
paths.put(path, p);
}
p.put(methodName, operation);
@@ -405,7 +405,7 @@ public class Swagger {
*
* @return The value of the <property>definitions</property> property on this bean, or <jk>null</jk> if it is not set.
*/
- public Map<String,Schema> getDefinitions() {
+ public Map<String,SchemaInfo> getDefinitions() {
return definitions;
}
@@ -417,7 +417,7 @@ public class Swagger {
* @param definitions The new value for the <property>definitions</property> property on this bean.
* @return This object (for method chaining).
*/
- public Swagger setDefinitions(Map<String,Schema> definitions) {
+ public Swagger setDefinitions(Map<String,SchemaInfo> definitions) {
this.definitions = definitions;
return this;
}
@@ -431,9 +431,9 @@ public class Swagger {
* @param schema The schema that the name defines.
* @return This object (for method chaining).
*/
- public Swagger addDefinition(String name, Schema schema) {
+ public Swagger addDefinition(String name, SchemaInfo schema) {
if (definitions == null)
- definitions = new TreeMap<String,Schema>();
+ definitions = new TreeMap<String,SchemaInfo>();
definitions.put(name, schema);
return this;
}
@@ -446,7 +446,7 @@ public class Swagger {
*
* @return The value of the <property>parameters</property> property on this bean, or <jk>null</jk> if it is not set.
*/
- public Map<String,Parameter> getParameters() {
+ public Map<String,ParameterInfo> getParameters() {
return parameters;
}
@@ -459,7 +459,7 @@ public class Swagger {
* @param parameters The new value for the <property>parameters</property> property on this bean.
* @return This object (for method chaining).
*/
- public Swagger setParameters(Map<String,Parameter> parameters) {
+ public Swagger setParameters(Map<String,ParameterInfo> parameters) {
this.parameters = parameters;
return this;
}
@@ -474,9 +474,9 @@ public class Swagger {
* @param parameter The parameter definition.
* @return This object (for method chaining).
*/
- public Swagger addParameter(String name, Parameter parameter) {
+ public Swagger addParameter(String name, ParameterInfo parameter) {
if (parameters == null)
- parameters = new TreeMap<String,Parameter>();
+ parameters = new TreeMap<String,ParameterInfo>();
parameters.put(name, parameter);
return this;
}
@@ -489,7 +489,7 @@ public class Swagger {
*
* @return The value of the <property>responses</property> property on this bean, or <jk>null</jk> if it is not set.
*/
- public Map<String,Response> getResponses() {
+ public Map<String,ResponseInfo> getResponses() {
return responses;
}
@@ -502,7 +502,7 @@ public class Swagger {
* @param responses The new value for the <property>responses</property> property on this bean.
* @return This object (for method chaining).
*/
- public Swagger setResponses(Map<String,Response> responses) {
+ public Swagger setResponses(Map<String,ResponseInfo> responses) {
this.responses = responses;
return this;
}
@@ -517,9 +517,9 @@ public class Swagger {
* @param response The response definition.
* @return This object (for method chaining).
*/
- public Swagger addResponse(String name, Response response) {
+ public Swagger addResponse(String name, ResponseInfo response) {
if (responses == null)
- responses = new TreeMap<String,Response>();
+ responses = new TreeMap<String,ResponseInfo>();
responses.put(name, response);
return this;
}
@@ -685,4 +685,28 @@ public class Swagger {
this.externalDocs = externalDocs;
return this;
}
+
+ private static class MethodSorter implements Comparator<String> {
+ @SuppressWarnings("serial")
+ private final Map<String,Integer> methods = new HashMap<String,Integer>(){{
+ put("get",7);
+ put("put",6);
+ put("post",5);
+ put("delete",4);
+ put("options",3);
+ put("head",2);
+ put("patch",1);
+ }};
+
+ @Override
+ public int compare(String o1, String o2) {
+ Integer i1 = methods.get(o1);
+ Integer i2 = methods.get(o2);
+ if (i1 == null)
+ i1 = 0;
+ if (i2 == null)
+ i2 = 0;
+ return i2.compareTo(i1);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Tag.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Tag.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Tag.java
index 7c32179..01b7c7e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Tag.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Tag.java
@@ -18,8 +18,8 @@ import org.apache.juneau.annotation.*;
* Allows adding meta data to a single tag that is used by the <a href='http://swagger.io/specification/#operationObject'>Operation Object</a>.
* <p>
* It is not mandatory to have a Tag Object per tag used there.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* {
* <js>"name"</js>: <js>"pet"</js>,
@@ -37,7 +37,7 @@ public class Tag {
/**
* Convenience method for creating a new Tag object.
- *
+ *
* @param name Required. The name of the tag.
* @return A new Tag object.
*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/encoders/EncoderGroup.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/encoders/EncoderGroup.java b/juneau-core/src/main/java/org/apache/juneau/encoders/EncoderGroup.java
index 1c529a7..bfeba2d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/encoders/EncoderGroup.java
+++ b/juneau-core/src/main/java/org/apache/juneau/encoders/EncoderGroup.java
@@ -42,7 +42,7 @@ import org.apache.juneau.*;
* will result in the order <code>E3, E4, E1, E2</code>.
*
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Create an encoder group with support for gzip compression.</jc>
* EncoderGroup g = <jk>new</jk> EncoderGroup().append(GzipEncoder.<jk>class</jk>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java
index 9f12272..62f822f 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java
@@ -22,7 +22,7 @@ import org.apache.juneau.*;
* These are typically specified via <ja>@RestResource.properties()</ja> and <ja>@RestMethod.properties()</ja> annotations,
* although they can also be set programmatically via the <code>RestResponse.setProperty()</code> method.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestResource</ja>(
* messages=<js>"nls/AddressBookResource"</js>,
@@ -107,9 +107,8 @@ public final class HtmlDocSerializerContext extends HtmlSerializerContext {
* <li><b>Default:</b> <jk>null</jk>
* </ul>
* <p>
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ *
+ * <h6 class='topic'>Example:</h6>
* <p>
* The <code>AddressBookResource</code> sample class uses this property...
* </p>
@@ -131,9 +130,7 @@ public final class HtmlDocSerializerContext extends HtmlSerializerContext {
* <p>
* ...to produce this title on the HTML page...
* </p>
- * <img class='bordered' src='doc-files/HTML_TITLE.png'>
- * </dd>
- * </dl>
+ * <img class='bordered' src='doc-files/HTML_TITLE.png'>
*/
public static final String HTMLDOC_title = "HtmlSerializer.title";
@@ -146,9 +143,8 @@ public final class HtmlDocSerializerContext extends HtmlSerializerContext {
* <li><b>Default:</b> <jk>null</jk>
* </ul>
* <p>
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ *
+ * <h6 class='topic'>Example:</h6>
* <p>
* The <code>AddressBookResource</code> sample class uses this property...
* </p>
@@ -170,9 +166,7 @@ public final class HtmlDocSerializerContext extends HtmlSerializerContext {
* <p>
* ...to produce this description on the HTML page...
* </p>
- * <img class='bordered' src='doc-files/HTML_DESCRIPTION.png'>
- * </dd>
- * </dl>
+ * <img class='bordered' src='doc-files/HTML_DESCRIPTION.png'>
*/
public static final String HTMLDOC_description = "HtmlSerializer.description";
@@ -197,9 +191,7 @@ public final class HtmlDocSerializerContext extends HtmlSerializerContext {
* Absolute (<js>"/myOtherContext/foo"</js>) and fully-qualified (<js>"http://localhost2/foo"</js>) URLs
* can also be used.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p>
* The <code>AddressBookResource</code> sample class uses this property...
* </p>
@@ -215,9 +207,7 @@ public final class HtmlDocSerializerContext extends HtmlSerializerContext {
* <p>
* ...to produce this list of links on the HTML page...
* </p>
- * <img class='bordered' src='doc-files/HTML_LINKS.png'>
- * </dd>
- * </dl>
+ * <img class='bordered' src='doc-files/HTML_LINKS.png'>
*/
public static final String HTMLDOC_links = "HtmlDocSerializer.links.map";
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/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 97f53fd..5c8c0d2 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
@@ -68,8 +68,7 @@ import org.apache.juneau.xml.annotation.*;
* <li>{@link SqReadable} - Default serializer, single quotes, whitespace added.
* </ul>
*
- *
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Use one of the default serializers to serialize a POJO</jc>
* String html = HtmlSerializer.<jsf>DEFAULT</jsf>.serialize(someObject);
@@ -435,7 +434,7 @@ public class HtmlSerializer extends XmlSerializer {
m2 = (BeanMap)o;
else
m2 = bc.forBean(o);
-
+
for (String k : th) {
BeanMapEntry p = m2.getProperty(k);
BeanPropertyMeta pMeta = p.getMeta();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/html/SimpleHtmlWriter.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/SimpleHtmlWriter.java b/juneau-core/src/main/java/org/apache/juneau/html/SimpleHtmlWriter.java
index a87a17c..f93bb39 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/SimpleHtmlWriter.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/SimpleHtmlWriter.java
@@ -16,8 +16,8 @@ import java.io.*;
/**
* Utility class for creating custom HTML.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* String table = <jk>new</jk> SimpleHtmlWriter().sTag(<js>"table"</js>).sTag(<js>"tr"</js>).sTag(<js>"td"</js>).append(<js>"hello"</js>).eTag(<js>"td"</js>).eTag(<js>"tr"</js>).eTag(<js>"table"</js>).toString();
* </p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java
index e590596..334dc5a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigFile.java
@@ -357,15 +357,11 @@ public abstract class ConfigFile implements Map<String,Section> {
* <p>
* <js>"M"</js> and <js>"K"</js> can be used to identify millions and thousands.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <ul class='spaced-list'>
- * <li><code><js>"100K"</js> => 1024000</code>
- * <li><code><js>"100M"</js> => 104857600</code>
- * </ul>
- * </dd>
- * </dl>
+ * <h6 class='topic'>Example:</h6>
+ * <ul class='spaced-list'>
+ * <li><code><js>"100K"</js> => 1024000</code>
+ * <li><code><js>"100M"</js> => 104857600</code>
+ * </ul>
*
* @param key The key. See {@link #getString(String)} for a description of the key.
* @param def The default value if config file or value does not exist.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/ini/ConfigMgr.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigMgr.java b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigMgr.java
index 1a188d1..4652b5e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ini/ConfigMgr.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ini/ConfigMgr.java
@@ -27,8 +27,8 @@ import org.apache.juneau.utils.*;
/**
* Manager for retrieving shared instances of {@link ConfigFile ConfigFiles}.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* ConfigFile cf = ConfigMgr.<jsf>DEFAULT</jsf>.get(<js>"MyConfig.cfg"</js>);
* String setting = cf.get(<js>"MySection/mysetting"</js>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/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 f5d3ac2..e7c5408 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
@@ -630,8 +630,8 @@
*/</jd>
<ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>,
description=<js>"Sets contents of config file."</js>,
- input={
- <ja>@Var</ja>(in=<js>"body"</js>, description=<js>"New contents in INI file format."</js>)
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New contents in INI file format."</js>)
}
)
<jk>public</jk> ConfigFile setConfigContents(<ja>@Body</ja> Reader contents) <jk>throws</jk> Exception {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java
index e730bab..65afe49 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/ClassUtils.java
@@ -64,8 +64,8 @@ public final class ClassUtils {
/**
* Converts the specified class name to a readable form when class name is a special construct like <js>"[[Z"</js>.
- * <p>
- * Examples:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jsm>getReadableClassName</jsm>(<js>"java.lang.Object"</js>); <jc>// Returns "java.lang.Object"</jc>
* <jsm>getReadableClassName</jsm>(<js>"boolean"</js>); <jc>// Returns "boolean"</jc>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
index 6663270..bb9355d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
@@ -896,8 +896,8 @@ public final class StringUtils {
/**
* Returns <jk>true</jk> if the specified path string is prefixed with the specified prefix.
- * <p>
- * Examples:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* pathStartsWith(<js>"foo"</js>, <js>"foo"</js>); <jc>// true</jc>
* pathStartsWith(<js>"foo/bar"</js>, <js>"foo"</js>); <jc>// true</jc>
@@ -997,4 +997,14 @@ public final class StringUtils {
return def;
return s.substring(start);
}
+
+ /**
+ * Calls {@link #toString()} on the specified object if it's not null.
+ *
+ * @param o The object to convert to a string.
+ * @return The object converted to a string, or <jk>null</jk> if the object was null.
+ */
+ public static String toString(Object o) {
+ return (o == null ? null : o.toString());
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/jena/RdfCommonContext.java b/juneau-core/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
index eef8653..5d2fa5c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
@@ -731,9 +731,7 @@ public interface RdfCommonContext {
* This setting is typically only useful if the beans being parsed into do not have a bean property
* annotated with {@link Rdf#beanUri @Rdf(beanUri=true)}.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* WriterSerializer s = <jk>new</jk> RdfSerializer.XmlAbbrev().setProperty(<jsf>RDF_looseCollection</jsf>, <jk>true</jk>);
* ReaderParser p = <jk>new</jk> RdfParser.Xml().setProperty(<jsf>RDF_looseCollection</jsf>, <jk>true</jk>);
@@ -754,8 +752,6 @@ public interface RdfCommonContext {
* <jc>// Parse back into a bean array</jc>
* b = p.parse(rdfXml, MyBean[].<jk>class</jk>);
* </p>
- * </dd>
- * </dl>
*/
public static final String RDF_looseCollections = "Rdf.looseCollections";
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/jena/annotation/RdfSchema.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/jena/annotation/RdfSchema.java b/juneau-core/src/main/java/org/apache/juneau/jena/annotation/RdfSchema.java
index 0300a40..bd772b7 100644
--- a/juneau-core/src/main/java/org/apache/juneau/jena/annotation/RdfSchema.java
+++ b/juneau-core/src/main/java/org/apache/juneau/jena/annotation/RdfSchema.java
@@ -54,9 +54,7 @@ public @interface RdfSchema {
* <p>
* Inherited by child packages.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p>
* Contents of <code>package-info.java</code>...
* </p>
@@ -91,8 +89,6 @@ public @interface RdfSchema {
* <jk>public</jk> String <jf>street</jf>, <jf>city</jf>, <jf>state</jf>;
* }
* </p>
- * </dd>
- * </dl>
*/
public RdfNs[] rdfNs() default {};
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/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 4c8327c..21cc904 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
@@ -73,8 +73,7 @@ import org.apache.juneau.transform.*;
* <li>{@link SimpleReadable} - Default serializer, single quotes, simple mode, with whitespace.
* </ul>
*
- *
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Use one of the default serializers to serialize a POJO</jc>
* String json = JsonSerializer.<jsf>DEFAULT</jsf>.serialize(someObject);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/json/annotation/Json.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/annotation/Json.java b/juneau-core/src/main/java/org/apache/juneau/json/annotation/Json.java
index 943f36f..f7d31da 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/annotation/Json.java
+++ b/juneau-core/src/main/java/org/apache/juneau/json/annotation/Json.java
@@ -42,35 +42,31 @@ public @interface Json {
* <p>
* This annotation can be applied to beans as well as other objects serialized to other types (e.g. strings).
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <ja>@Json</ja>(wrapperAttr=<js>"myWrapper"</js>)
* <jk>public class</jk> MyBean {
* <jk>public int</jk> f1 = 123;
* }
- * </p>
- * <p>
- * Without the <ja>@Xml</ja> annotations, serializing this bean as JSON would have produced the following...
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * Without the <ja>@Xml</ja> annotations, serializing this bean as JSON would have produced the following...
+ * </p>
+ * <p class='bcode'>
* {
* f1: 123
* }
- * </p>
- * <p>
- * With the annotations, serializing this bean as XML produces the following...
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * With the annotations, serializing this bean as XML produces the following...
+ * </p>
+ * <p class='bcode'>
* {
* myWrapper: {
* f1: 123
* }
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
String wrapperAttr() default "";
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/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 f403f7d..13ae665 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
@@ -158,7 +158,7 @@
<li>Anything else is converted to JSON strings.
</ul>
- <h6 class='figure'>Examples</h6>
+ <h6 class='topic'>Examples:</h6>
<table class='styled'>
<tr>
<th>POJO type</th>
@@ -366,7 +366,7 @@
The {@link org.apache.juneau.PropertyNamerDashedLC} is an example of an alternate property namer.
It converts bean property names to lowercase-dashed format.
</p>
- <h6 class='figure'>Example</h6>
+ <h6 class='topic'>Example:</h6>
<p class='bcode'>
<ja>@Bean</ja>(propertyNamer=PropertyNamerDashedLC.<jk>class</jk>)
<jk>public class</jk> Person {
@@ -1287,7 +1287,7 @@
is run against the <code>AddressBookResource</code> class running within the sample app.<br>
It shows how the client can be used to interact with the REST API while completely hiding the negotiated content type and working with nothing more than beans.
</p>
- <h6 class='figure'>Example</h6>
+ <h6 class='topic'>Example:</h6>
<p class='bcode'>
String root = <js>"http://localhost:9080/sample/addressBook"</js>;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/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 0a3e1f3..643964f 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
@@ -247,10 +247,8 @@ public abstract class Parser extends CoreApi {
/**
* Parses input into the specified object type.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
* MyBean b = p.parse(json, MyBean.<jk>class</jk>);
* </p>
@@ -260,9 +258,7 @@ public abstract class Parser extends CoreApi {
* ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
* ClassMeta<MyBean> cm = p.getBeanContext().getClassMeta(MyBean.<jk>class</jk>);
* MyBean b = p.parse(json, cm, <jk>null</jk>);
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @param <T> The class type of the object to create.
* @param input The input. See {@link #parse(Object, ClassMeta)} for supported input types.
@@ -278,32 +274,28 @@ public abstract class Parser extends CoreApi {
/**
* Parses input into a map with specified key and value types.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
* Map<String,MyBean> m = p.parseMap(json, LinkedHashMap.<jk>class</jk>, String.<jk>class</jk>, MyBean.<jk>class</jk>);
- * </p>
- * <p>
- * A simpler approach is often to just extend the map class you want and just use the normal {@link #parse(Object, Class)} method:
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * A simpler approach is often to just extend the map class you want and just use the normal {@link #parse(Object, Class)} method:
+ * </p>
+ * <p class='bcode'>
* <jk>public static class</jk> MyMap <jk>extends</jk> LinkedHashMap<String,MyBean> {}
*
* ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
* Map<String,MyBean> m = p.parse(json, MyMap.<jk>class</jk>);
- * </p>
- * <p>
- * This method equivalent to the following code:
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * This method equivalent to the following code:
+ * </p>
+ * <p class='bcode'>
* ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
* ClassMeta<Map<String,MyBean>> cm = p.getBeanContext().getMapClassMeta(LinkedList.<jk>class</jk>, String.<jk>class</jk>, MyBean.<jk>class</jk>);
* Map<String,MyBean> m = p.parse(json, cm, <jk>null</jk>);
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @param <T> The class type of the object to create.
* @param input The input. See {@link #parse(Object, ClassMeta)} for supported input types.
@@ -321,17 +313,15 @@ public abstract class Parser extends CoreApi {
/**
* Parses input into a collection with a specified element type.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
* List<MyBean> l = p.parseCollection(json, LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>);
- * </p>
- * <p>
- * A simpler approach is often to just extend the collection class you want and just use the normal {@link #parse(Object, Class)} method:
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * A simpler approach is often to just extend the collection class you want and just use the normal {@link #parse(Object, Class)} method:
+ * </p>
+ * <p class='bcode'>
* <jk>public static class</jk> MyBeanCollection <jk>extends</jk> LinkedList<MyBean> {}
*
* ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
@@ -344,9 +334,7 @@ public abstract class Parser extends CoreApi {
* ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
* ClassMeta<List<MyBean>> cm = p.getBeanContext().getCollectionClassMeta(LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>);
* List<MyBean> l = p.parse(json, cm, <jk>null</jk>);
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @param <T> The class type of the object to create.
* @param input The input. See {@link #parse(Object, ClassMeta)} for supported input types.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java b/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java
index 71797ce..bb415d9 100644
--- a/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java
+++ b/juneau-core/src/main/java/org/apache/juneau/parser/ParserGroup.java
@@ -46,7 +46,7 @@ import org.apache.juneau.*;
* will result in the order <code>P3, P4, P1, P2</code>.
*
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a new parser group</jc>
* ParserGroup g = <jk>new</jk> ParserGroup();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java
index c4a67d5..744f896 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java
@@ -335,29 +335,26 @@ public class SerializerContext extends Context {
* (i.e. URIs not containing a schema and not starting with <js>'/'</js>).
* (e.g. <js>"foo/bar"</js>)
*
- * <dl>
- * <dt>Examples:</dt>
- * <dd>
- * <table class='styled'>
- * <tr><th>SERIALIZER_relativeUriBase</th><th>URI</th><th>Serialized URI</th></tr>
- * <tr>
- * <td><code>http://foo:9080/bar/baz</code></td>
- * <td><code>mywebapp</code></td>
- * <td><code>http://foo:9080/bar/baz/mywebapp</code></td>
- * </tr>
- * <tr>
- * <td><code>http://foo:9080/bar/baz</code></td>
- * <td><code>/mywebapp</code></td>
- * <td><code>/mywebapp</code></td>
- * </tr>
- * <tr>
- * <td><code>http://foo:9080/bar/baz</code></td>
- * <td><code>http://mywebapp</code></td>
- * <td><code>http://mywebapp</code></td>
- * </tr>
- * </table>
- * </dd>
- * </dl>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <table class='styled'>
+ * <tr><th>SERIALIZER_relativeUriBase</th><th>URI</th><th>Serialized URI</th></tr>
+ * <tr>
+ * <td><code>http://foo:9080/bar/baz</code></td>
+ * <td><code>mywebapp</code></td>
+ * <td><code>http://foo:9080/bar/baz/mywebapp</code></td>
+ * </tr>
+ * <tr>
+ * <td><code>http://foo:9080/bar/baz</code></td>
+ * <td><code>/mywebapp</code></td>
+ * <td><code>/mywebapp</code></td>
+ * </tr>
+ * <tr>
+ * <td><code>http://foo:9080/bar/baz</code></td>
+ * <td><code>http://mywebapp</code></td>
+ * <td><code>http://mywebapp</code></td>
+ * </tr>
+ * </table>
*/
public static final String SERIALIZER_relativeUriBase = "Serializer.relativeUriBase";
@@ -374,29 +371,26 @@ public class SerializerContext extends Context {
* (i.e. URIs starting with <js>'/'</js>).
* (e.g. <js>"/foo/bar"</js>)
*
- * <dl>
- * <dt>Examples:</dt>
- * <dd>
- * <table class='styled'>
- * <tr><th>SERIALIZER_absolutePathUriBase</th><th>URI</th><th>Serialized URI</th></tr>
- * <tr>
- * <td><code>http://foo:9080/bar/baz</code></td>
- * <td><code>mywebapp</code></td>
- * <td><code>mywebapp</code></td>
- * </tr>
- * <tr>
- * <td><code>http://foo:9080/bar/baz</code></td>
- * <td><code>/mywebapp</code></td>
- * <td><code>http://foo:9080/bar/baz/mywebapp</code></td>
- * </tr>
- * <tr>
- * <td><code>http://foo:9080/bar/baz</code></td>
- * <td><code>http://mywebapp</code></td>
- * <td><code>http://mywebapp</code></td>
- * </tr>
- * </table>
- * </dd>
- * </dl>
+ *
+ * <h6 class='topic'>Examples:</h6>
+ * <table class='styled'>
+ * <tr><th>SERIALIZER_absolutePathUriBase</th><th>URI</th><th>Serialized URI</th></tr>
+ * <tr>
+ * <td><code>http://foo:9080/bar/baz</code></td>
+ * <td><code>mywebapp</code></td>
+ * <td><code>mywebapp</code></td>
+ * </tr>
+ * <tr>
+ * <td><code>http://foo:9080/bar/baz</code></td>
+ * <td><code>/mywebapp</code></td>
+ * <td><code>http://foo:9080/bar/baz/mywebapp</code></td>
+ * </tr>
+ * <tr>
+ * <td><code>http://foo:9080/bar/baz</code></td>
+ * <td><code>http://mywebapp</code></td>
+ * <td><code>http://mywebapp</code></td>
+ * </tr>
+ * </table>
*/
public static final String SERIALIZER_absolutePathUriBase = "Serializer.absolutePathUriBase";
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java
index d18e7c9..6822b2b 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java
@@ -46,7 +46,7 @@ import org.apache.juneau.*;
* will result in the order <code>S3, S4, S1, S2</code>.
*
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct a new serializer group</jc>
* SerializerGroup g = <jk>new</jk> SerializerGroup();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
index 3bb316e..2f0721d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
@@ -23,7 +23,7 @@ import org.apache.juneau.internal.*;
* Modeled after the Java ProcessBuilder class so that you can chain commands to reduce
* the need for string concatenation for performance reasons.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* writer.append(<js>"foo"</js>).nl().i(5).append(<js>"bar"</js>);
* </p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/serializer/StringObject.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/StringObject.java b/juneau-core/src/main/java/org/apache/juneau/serializer/StringObject.java
index 547da13..eb6677d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/serializer/StringObject.java
+++ b/juneau-core/src/main/java/org/apache/juneau/serializer/StringObject.java
@@ -23,7 +23,7 @@ import org.apache.juneau.*;
* <p>
* Instances of this method are created by the {@link WriterSerializer#toStringObject(Object)} method.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// The POJO will not be serialized unless DEBUG is enabled.</jc>
* logger.log(<jsf>DEBUG</jsf>, <js>"Object contents are: {0}"</js>, JsonSerializer.<jsf>DEFAULT</jsf>.toObjectString(myPojo));
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/svl/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/package.html b/juneau-core/src/main/java/org/apache/juneau/svl/package.html
index 809f251..3bd321e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/svl/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/svl/package.html
@@ -150,8 +150,6 @@
<li class='c'>{@link org.apache.juneau.svl.vars.ConfigFileVar} - Resolves variables from a {@link org.apache.juneau.ini.ConfigFile} object.
<li class='c'>{@link org.apache.juneau.svl.vars.EnvVariablesVar} - Resolves environment variables.
<li class='c'>{@link org.apache.juneau.svl.vars.ManifestFileVar} - Resolves variables from a {@link org.apache.juneau.utils.ManifestFile} object.
- <li class='c'>{@link org.apache.juneau.server.vars.RequestAttrVar} - Resolves HTTP request attribute values.
- <li class='c'>{@link org.apache.juneau.server.vars.RequestParamVar} - Resolves HTTP request URL parameter values.
<li class='c'>{@link org.apache.juneau.server.vars.ServletInitParamVar} - Resolves servlet initialization parameters.
</ul>
</li>
@@ -167,7 +165,6 @@
<li class='a'>{@link org.apache.juneau.svl.StreamedVar} - Superclass of all vars that stream their value to writers.
<ul>
<li class='c'>{@link org.apache.juneau.server.vars.SerializedRequestAttrVar} - Resolves HTTP request attribute values passed through a {@link org.apache.juneau.serializer.Serializer}.
- <li class='c'>{@link org.apache.juneau.server.vars.SerializedRequestParamVar} - Resolves HTTP request URL parameter values passed through a {@link org.apache.juneau.serializer.Serializer}.
</ul>
</li>
</ul>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java b/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
index 522ab6a..b48990b 100644
--- a/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
@@ -23,7 +23,7 @@ import org.apache.juneau.*;
* Bean filter builders must have a public no-arg constructor.
* Builder settings should be set in the constructor using the provided setters on this class.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Create our serializer with a bean filter.</jc>
* WriterSerializer s = <jk>new</jk> JsonSerializer().addBeanFilters(AddressFilter.<jk>class</jk>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java b/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java
index 9c1b5ea..0f65e26 100644
--- a/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java
+++ b/juneau-core/src/main/java/org/apache/juneau/transforms/CalendarSwap.java
@@ -50,14 +50,10 @@ public class CalendarSwap extends PojoSwap<Calendar,String> {
/**
* Transforms {@link Calendar Calendars} to {@link String Strings} using the {@code Date.toString()} method.
*
- * <dl>
- * <dt>Example output:</dt>
- * <dd>
- * <ul>
- * <li><js>"Wed Jul 04 15:30:45 EST 2001"</js>
- * </ul>
- * </dd>
- * </dl>
+ * <h6 class='topic'>Example output:</h6>
+ * <ul>
+ * <li><js>"Wed Jul 04 15:30:45 EST 2001"</js>
+ * </ul>
*/
public static class ToString extends CalendarSwap {
/** Constructor */
@@ -69,27 +65,22 @@ public class CalendarSwap extends PojoSwap<Calendar,String> {
/**
* Transforms {@link Calendar Calendars} to ISO8601 date-time strings.
*
- * <dl>
- * <dt>Example output:</dt>
- * <dd>
- * <ul>
- * <li><js>"2001-07-04T15:30:45-05:00"</js>
- * <li><js>"2001-07-04T15:30:45Z"</js>
- * </ul>
- * </dd>
- * <dt>Example input:</dt>
- * <dd>
- * <ul>
- * <li><js>"2001-07-04T15:30:45-05:00"</js>
- * <li><js>"2001-07-04T15:30:45Z"</js>
- * <li><js>"2001-07-04T15:30:45.1Z"</js>
- * <li><js>"2001-07-04T15:30Z"</js>
- * <li><js>"2001-07-04"</js>
- * <li><js>"2001-07"</js>
- * <li><js>"2001"</js>
- * </ul>
- * </dd>
- * </dl>
+ * <h6 class='topic'>Example output:</h6>
+ * <ul>
+ * <li><js>"2001-07-04T15:30:45-05:00"</js>
+ * <li><js>"2001-07-04T15:30:45Z"</js>
+ * </ul>
+ *
+ * <h6 class='topic'>Example input:</h6>
+ * <ul>
+ * <li><js>"2001-07-04T15:30:45-05:00"</js>
+ * <li><js>"2001-07-04T15:30:45Z"</js>
+ * <li><js>"2001-07-04T15:30:45.1Z"</js>
+ * <li><js>"2001-07-04T15:30Z"</js>
+ * <li><js>"2001-07-04"</js>
+ * <li><js>"2001-07"</js>
+ * <li><js>"2001"</js>
+ * </ul>
*/
public static class ISO8601DT extends CalendarSwap {
@@ -115,8 +106,9 @@ public class CalendarSwap extends PojoSwap<Calendar,String> {
/**
* Same as {@link ISO8601DT}, except always serializes in GMT.
- * <p>
- * Example output: <js>"2001-07-04T15:30:45Z"</js>
+ *
+ * <h6 class='topic'>Example output:</h6>
+ * <js>"2001-07-04T15:30:45Z"</js>
*/
public static class ISO8601DTZ extends CalendarSwap {
@@ -157,8 +149,9 @@ public class CalendarSwap extends PojoSwap<Calendar,String> {
/**
* Same as {@link RFC2822DT}, except always serializes in GMT.
- * <p>
- * Example output: <js>"Wed, 31 Jan 2001 12:34:56 +0000"</js>
+ *
+ * <h6 class='topic'>Example output:</h6>
+ * <js>"Wed, 31 Jan 2001 12:34:56 +0000"</js>
*/
public static class RFC2822DTZ extends CalendarSwap {
/** Constructor */
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java b/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java
index 1a3d5fc..37e085e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java
+++ b/juneau-core/src/main/java/org/apache/juneau/transforms/DateSwap.java
@@ -50,15 +50,11 @@ public class DateSwap extends PojoSwap<Date,String> {
/**
* Transforms {@link Date Dates} to {@link String Strings} using the {@code Date.toString()} method.
- * <p>
- * <dl>
- * <dt>Example output:</dt>
- * <dd>
+ *
+ * <h6 class='topic'>Example output:</h6>
* <ul>
* <li><js>"Wed Jul 04 15:30:45 EST 2001"</js>
* </ul>
- * </dd>
- * </dl>
*/
public static class ToString extends DateSwap {
/** Constructor */
@@ -70,16 +66,13 @@ public class DateSwap extends PojoSwap<Date,String> {
/**
* Transforms {@link Date Dates} to ISO8601 date-time strings.
*
- * <dl>
- * <dt>Example output:</dt>
- * <dd>
+ * <h6 class='topic'>Example output:</h6>
* <ul>
* <li><js>"2001-07-04T15:30:45-05:00"</js>
* <li><js>"2001-07-04T15:30:45Z"</js>
* </ul>
- * </dd>
- * <dt>Example input:</dt>
- * <dd>
+ *
+ * <h6 class='topic'>Example input:</h6>
* <ul>
* <li><js>"2001-07-04T15:30:45-05:00"</js>
* <li><js>"2001-07-04T15:30:45Z"</js>
@@ -89,8 +82,6 @@ public class DateSwap extends PojoSwap<Date,String> {
* <li><js>"2001-07"</js>
* <li><js>"2001"</js>
* </ul>
- * </dd>
- * </dl>
*/
public static class ISO8601DT extends DateSwap {
private SimpleDateFormat tzFormat = new SimpleDateFormat("Z");
@@ -134,8 +125,9 @@ public class DateSwap extends PojoSwap<Date,String> {
/**
* Same as {@link ISO8601DT} except serializes to millisecond precision.
- * <p>
- * Example output: <js>"2001-07-04T15:30:45.123-05:00"</js>
+ *
+ * <h6 class='topic'>Example output:</h6>
+ * <js>"2001-07-04T15:30:45.123-05:00"</js>
*/
public static class ISO8601DTP extends ISO8601DT {
@@ -147,8 +139,9 @@ public class DateSwap extends PojoSwap<Date,String> {
/**
* Same as {@link ISO8601DT} except serializes to millisecond precision and doesn't include timezone.
- * <p>
- * Example output: <js>"2001-07-04T15:30:45.123"</js>
+ *
+ * <h6 class='topic'>Example output:</h6>
+ * <js>"2001-07-04T15:30:45.123"</js>
*/
public static class ISO8601DTPNZ extends DateSwap {
@@ -160,8 +153,9 @@ public class DateSwap extends PojoSwap<Date,String> {
/**
* Same as {@link ISO8601DT}, except always serializes in GMT.
- * <p>
- * Example output: <js>"2001-07-04T15:30:45Z"</js>
+ *
+ * <h6 class='topic'>Example output:</h6>
+ * <js>"2001-07-04T15:30:45Z"</js>
*/
public static class ISO8601DTZ extends DateSwap {
@@ -195,8 +189,9 @@ public class DateSwap extends PojoSwap<Date,String> {
/**
* Same as {@link ISO8601DTZ} except serializes to millisecond precision.
- * <p>
- * Example output: <js>"2001-07-04T15:30:45.123Z"</js>
+ *
+ * <h6 class='topic'>Example output:</h6>
+ * <js>"2001-07-04T15:30:45.123Z"</js>
*/
public static class ISO8601DTZP extends ISO8601DT {
@@ -218,8 +213,9 @@ public class DateSwap extends PojoSwap<Date,String> {
/**
* Same as {@link RFC2822DT}, except always serializes in GMT.
- * <p>
- * Example output: <js>"2001-07-04T15:30:45Z"</js>
+ *
+ * <h6 class='topic'>Example output:</h6>
+ * <js>"2001-07-04T15:30:45Z"</js>
*/
public static class RFC2822DTZ extends DateSwap {
/** Constructor */
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/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 c35489a..47f080f 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
@@ -126,7 +126,7 @@ import org.apache.juneau.transform.*;
* </p>
*
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Serialize a Map</jc>
* Map m = <jk>new</jk> ObjectMap(<js>"{a:'b',c:1,d:false,e:['f',1,false],g:{h:'i'}}"</js>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java
index 43f7da4..7bc61f8 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java
@@ -42,8 +42,8 @@ public class UrlEncodingParserContext extends UonParserContext {
* <p>
* If <jk>false</jk>, serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>.
* If <jk>true</jk>, serializing the same array results in <code>?key=1&key=2&key=3</code>.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jk>public class</jk> A {
* <jk>public</jk> String[] f1 = {<js>"a"</js>,<js>"b"</js>};
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/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 5f50fff..85fbe48 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
@@ -125,7 +125,7 @@ import org.apache.juneau.transform.*;
* </p>
*
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Serialize a Map</jc>
* Map m = <jk>new</jk> ObjectMap(<js>"{a:'b',c:1,d:false,e:['f',1,false],g:{h:'i'}}"</js>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
index 6f5f7c8..c7c694f 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
@@ -42,8 +42,8 @@ public class UrlEncodingSerializerContext extends UonSerializerContext {
* <p>
* If <jk>false</jk>, serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>.
* If <jk>true</jk>, serializing the same array results in <code>?key=1&key=2&key=3</code>.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jk>public class</jk> A {
* <jk>public</jk> String[] f1 = {<js>"a"</js>,<js>"b"</js>};
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/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 4ccf438..4261c89 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
@@ -410,7 +410,7 @@
The {@link org.apache.juneau.PropertyNamerDashedLC} is an example of an alternate property namer.
It converts bean property names to lowercase-dashed format.
</p>
- <h6 class='figure'>Example</h6>
+ <h6 class='figure'>Example:</h6>
<p class='bcode'>
<ja>@Bean</ja>(propertyNamer=PropertyNamerDashedLC.<jk>class</jk>)
<jk>public class</jk> Person {
@@ -660,7 +660,7 @@
The <code>UonParser</code> class converts UON-encoded parameter values to POJOs.
The <code>UrlEncodingParser</code> class converts entire URL-Encoded strings to POJOs using <code>UonSerializer</code> to serialize indivisual values.
If you're trying to parse an entire URL-Encoded string, use <code>UrlEncodingParser</code>.
- If you're trying to parse an individual value (such as that returned by <code>RestServlet.getParameter(name)</code>), use <code>UonParser</code>.
+ If you're trying to parse an individual value (such as that returned by <code>RestServlet.getQueryParameter(name)</code>), use <code>UonParser</code>.
</p>
<p>
The following static reusable instances of <code>UrlEncodingParser</code> are provided for convenience:
@@ -675,7 +675,7 @@
</p>
<ul class='spaced-list'>
<li>Use the <code>DEFAULT</code> parser for parameter values that have already had <code>%xx</code> sequences decoded,
- such as when using <code>HttpServletRequest.getParameter(name)</code>.
+ such as when using <code>HttpServletRequest.getQueryParameter(name)</code>.
<li>Use the <code>DEFAULT_ENCODED</code> parser if the input has not already had <code>%xx</code> sequences decoded.
</ul>
<p>
@@ -1236,7 +1236,7 @@
is run against the <code>AddressBookResource</code> class running within the sample app.<br>
It shows how the client can be used to interact with the REST API while completely hiding the negotiated content type and working with nothing more than beans.
</p>
- <h6 class='figure'>Example</h6>
+ <h6 class='figure'>Example:</h6>
<p class='bcode'>
String root = <js>"http://localhost:9080/sample/addressBook"</js>;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/utils/Args.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/Args.java b/juneau-core/src/main/java/org/apache/juneau/utils/Args.java
index 0763b15..1c1ab07 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/Args.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/Args.java
@@ -195,16 +195,12 @@ public final class Args extends ObjectMap {
* <p>
* If the optional arg has multiple values, returns only the first converted value.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Command: java com.sample.MyClass -verbose true -debug 5</jc>
* <jk>boolean</jk> b = args.getArg(<jk>boolean</jk>.<jk>class</jk>, <js>"verbose"</js>);
* <jk>int</jk> i = args.getArg(<jk>int</jk>.<jk>class</jk>, <js>"debug"</js>);
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @param c The class type to convert the value to.
* @param <T> The class type to convert the value to.
@@ -221,16 +217,12 @@ public final class Args extends ObjectMap {
/**
* Returns the optional argument values as a list of strings.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Command: java com.sample.MyClass -extraArgs foo bar baz</jc>
* List<String> l1 = args.getArgs(<js>"extraArgs"</js>); <jc>// ['foo','bar','baz']</jc>
* List<String> l2 = args.getArgs(<js>"nonExistentArgs"</js>); <jc>// An empty list</jc>
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @param name The optional argument name.
* @return The optional argument values, or an empty list if the optional argument was not specified.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/PojoIntrospector.java b/juneau-core/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
index 049c3d8..29c9730 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
@@ -22,8 +22,8 @@ import org.apache.juneau.parser.*;
/**
* Used to invoke methods on {@code Objects} using arguments in serialized form.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* String s = <js>"foobar"</js>;
* String s2 = (String)<jk>new</jk> PojoIntrospector(s).invoke(<js>"substring(int,int)"</js>, <js>"[3,6]"</js>); <jc>// "bar"</jc>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/utils/PojoQuery.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/PojoQuery.java b/juneau-core/src/main/java/org/apache/juneau/utils/PojoQuery.java
index c0551a2..b8a48d7 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/PojoQuery.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/PojoQuery.java
@@ -66,7 +66,7 @@ import org.apache.juneau.internal.*;
* Search patterns can be either {@code Strings} or {@code Maps}.<br>
* Multiple search patterns are ANDed (i.e. all patterns must match for the row to be returned).
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <ul class='spaced-list'>
* <li><tt>{fi:'123'}</tt> - Return only rows where the <tt>fi</tt> column is 123.
* <li><tt>{fs:'foobar'}</tt> - Return only rows where the <tt>fs</tt> column is 'foobar'.
@@ -85,7 +85,7 @@ import org.apache.juneau.internal.*;
* searched are not strings, then the patterns are matched against whatever is
* return by the {@code Object#toString()} method.
*
- * <h6 class='topic'>Example string query patterns</h6>
+ * <h6 class='topic'>Example string query patterns:</h6>
* <ul>
* <li><tt>foo</tt> - The string 'foo'
* <li><tt>foo bar</tt> - The string 'foo' or the string 'bar'
@@ -106,7 +106,7 @@ import org.apache.juneau.internal.*;
* <p>
* Any object of type {@link Number} (or numeric primitives) can be searched using numeric patterns.
*
- * <h6 class='topic'>Example numeric query patterns</h6>
+ * <h6 class='topic'>Example numeric query patterns:</h6>
* <ul>
* <li><tt>123</tt> - The single number 123
* <li><tt>1 2 3</tt> - 1, 2, or 3
@@ -139,7 +139,7 @@ import org.apache.juneau.internal.*;
* <li><tt>yyyy</tt>
* </ul>
*
- * <h6 class='topic'>Example date query patterns</h6>
+ * <h6 class='topic'>Example date query patterns:</h6>
* <ul>
* <li><tt>2001</tt> - A specific year.
* <li><tt>2001.01.01.10.50</tt> - A specific time.
@@ -160,7 +160,7 @@ import org.apache.juneau.internal.*;
* specified order.<br>
* The view parameter is a list of either <tt>Strings</tt> or <tt>Maps</tt>.
*
- * <h6 class='topic'>Example view parameters</h6>
+ * <h6 class='topic'>Example view parameters:</h6>
* <ul>
* <li><tt>['f1']</tt> - Return only column 'f1'.
* <li><tt>['f2','f1']</tt> - Return only columns 'f2' and 'f1'.
@@ -175,7 +175,7 @@ import org.apache.juneau.internal.*;
* <tt>Strings</tt> represent column names to sort ascending. If you want
* to sort descending, you need to specify a <tt>Map</tt> of the form <tt>{colname:'d'}</tt>
*
- * <h6 class='topic'>Example sort parameters</h6>
+ * <h6 class='topic'>Example sort parameters:</h6>
* <ul>
* <li><tt>['f1']</tt> - Sort rows by column 'f1' ascending.
* <li><tt>[{f1:'a'}]</tt> - Sort rows by column 'f1' ascending.
@@ -1147,7 +1147,7 @@ public final class PojoQuery {
}
- /**
+ /*
* Same as split(String, char), but does not split on characters inside
* single quotes.
* Does not split on escaped delimiters, and escaped quotes are also ignored.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/utils/PojoRest.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/PojoRest.java b/juneau-core/src/main/java/org/apache/juneau/utils/PojoRest.java
index 72ab6d9..c6f3e1f 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/PojoRest.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/PojoRest.java
@@ -42,7 +42,7 @@ import org.apache.juneau.parser.*;
* <p>
* Leading slashes in URLs are ignored. So <js>"/xxx/yyy/zzz"</js> and <js>"xxx/yyy/zzz"</js> are considered identical.
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Construct an unstructured POJO model</jc>
* ObjectMap m = <jk>new</jk> ObjectMap(<js>""</js>
@@ -106,7 +106,7 @@ import org.apache.juneau.parser.*;
* can be used in lieu of index numbers on GET requests to return a map/bean with a specified attribute value.<br>
* The syntax is {@code @attr=val}, where attr is the attribute name on the child map, and val is the matching value.
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Get map/bean with name attribute value of 'foo' from a list of items</jc>
* Map m = pojoRest.getMap(<js>"/items/@name=foo"</js>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/utils/ProcBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/ProcBuilder.java b/juneau-core/src/main/java/org/apache/juneau/utils/ProcBuilder.java
index 73f39b4..1d841c2 100644
--- a/juneau-core/src/main/java/org/apache/juneau/utils/ProcBuilder.java
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/ProcBuilder.java
@@ -72,7 +72,8 @@ public class ProcBuilder {
/**
* Command arguments if the specified matcher matches.
* Can be used for specifying os-specific commands.
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* ProcessBuilder pb = ProcessBuilder
* .create()
[2/8] incubator-juneau git commit: Doc updates.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/RestServlet.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/RestServlet.java b/juneau-server/src/main/java/org/apache/juneau/server/RestServlet.java
index 4289a4b..c0b5662 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/RestServlet.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/RestServlet.java
@@ -38,7 +38,6 @@ import javax.servlet.http.*;
import org.apache.juneau.*;
import org.apache.juneau.dto.swagger.*;
-import org.apache.juneau.dto.swagger.Parameter;
import org.apache.juneau.encoders.*;
import org.apache.juneau.encoders.Encoder;
import org.apache.juneau.ini.*;
@@ -48,10 +47,8 @@ import org.apache.juneau.parser.*;
import org.apache.juneau.parser.ParseException;
import org.apache.juneau.serializer.*;
import org.apache.juneau.server.annotation.*;
-import org.apache.juneau.server.annotation.Header;
+import org.apache.juneau.server.annotation.Parameter;
import org.apache.juneau.server.annotation.Properties;
-import org.apache.juneau.server.annotation.Response;
-import org.apache.juneau.server.annotation.Var;
import org.apache.juneau.server.response.*;
import org.apache.juneau.server.vars.*;
import org.apache.juneau.svl.*;
@@ -261,11 +258,8 @@ public abstract class RestServlet extends HttpServlet {
varResolver.addVars(
LocalizationVar.class,
- RequestAttrVar.class,
- RequestParamVar.class,
RequestVar.class,
SerializedRequestAttrVar.class,
- SerializedRequestParamVar.class,
ServletInitParamVar.class,
UrlEncodeVar.class
);
@@ -1251,14 +1245,10 @@ public abstract class RestServlet extends HttpServlet {
* it's safe to use this method from within debug log statements.
* </p>
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* logObjects(<jsf>DEBUG</jsf>, <js>"Pojo contents:\n{0}"</js>, myPojo);
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @param level The log level.
* @param msg The message to log.
@@ -2140,16 +2130,16 @@ public abstract class RestServlet extends HttpServlet {
switch(paramType) {
case REQ: return req;
case RES: return res;
- case PATH: return req.getAttribute(name, type);
+ case PATH: return req.getPathParameter(name, type);
case BODY: return req.getBody(type);
case HEADER: return req.getHeader(name, type);
case METHOD: return req.getMethod();
case FORMDATA: {
if (multiPart)
- return req.getParameters(name, type);
+ return req.getFormDataParameters(name, type);
if (plainParams)
- return bc.convertToType(req.getParameter(name), bc.getClassMeta(type));
- return req.getParameter(name, type);
+ return bc.convertToType(req.getFormDataParameter(name), bc.getClassMeta(type));
+ return req.getFormDataParameter(name, type);
}
case QUERY: {
if (multiPart)
@@ -2158,7 +2148,7 @@ public abstract class RestServlet extends HttpServlet {
return bc.convertToType(req.getQueryParameter(name), bc.getClassMeta(type));
return req.getQueryParameter(name, type);
}
- case HASFORMDATA: return bc.convertToType(req.hasParameter(name), bc.getClassMeta(type));
+ case HASFORMDATA: return bc.convertToType(req.hasFormDataParameter(name), bc.getClassMeta(type));
case HASQUERY: return bc.convertToType(req.hasQueryParameter(name), bc.getClassMeta(type));
case PATHREMAINDER: return req.getPathRemainder();
case PROPS: return res.getProperties();
@@ -2190,7 +2180,7 @@ public abstract class RestServlet extends HttpServlet {
private boolean mPlainParams, deprecated;
private String description, tags, summary, externalDocs;
private Integer priority;
- private Var[] parameters;
+ private org.apache.juneau.server.annotation.Parameter[] parameters;
private Response[] responses;
private MethodMeta(java.lang.reflect.Method method) throws RestServletException {
@@ -2456,19 +2446,19 @@ public abstract class RestServlet extends HttpServlet {
return deprecated;
}
- private List<Parameter> getParameters(RestRequest req) throws ParseException {
+ private List<ParameterInfo> getParameters(RestRequest req) throws ParseException {
Operation o = getSwaggerOperationFromFile(req);
if (o != null && o.getParameters() != null)
return o.getParameters();
VarResolverSession vr = req.getVarResolverSession();
JsonParser jp = JsonParser.DEFAULT;
- Map<String,Parameter> m = new TreeMap<String,Parameter>();
+ Map<String,ParameterInfo> m = new TreeMap<String,ParameterInfo>();
// First parse @RestMethod.parameters() annotation.
- for (Var v : parameters) {
+ for (org.apache.juneau.server.annotation.Parameter v : parameters) {
String in = vr.resolve(v.in());
- Parameter p = Parameter.createStrict(in, vr.resolve(v.name()));
+ ParameterInfo p = ParameterInfo.createStrict(in, vr.resolve(v.name()));
if (! v.description().isEmpty())
p.setDescription(vr.resolve(v.description()));
@@ -2477,7 +2467,7 @@ public abstract class RestServlet extends HttpServlet {
if ("body".equals(in)) {
if (! v.schema().isEmpty())
- p.setSchema(jp.parse(vr.resolve(v.schema()), Schema.class));
+ p.setSchema(jp.parse(vr.resolve(v.schema()), SchemaInfo.class));
} else {
if (v.allowEmptyValue())
p.setAllowEmptyValue(v.allowEmptyValue());
@@ -2511,9 +2501,9 @@ public abstract class RestServlet extends HttpServlet {
field = parts[2];
}
String k2 = in + '.' + name;
- Parameter p = m.get(k2);
+ ParameterInfo p = m.get(k2);
if (p == null) {
- p = Parameter.createStrict(in, name);
+ p = ParameterInfo.createStrict(in, name);
m.put(k2, p);
}
@@ -2524,7 +2514,7 @@ public abstract class RestServlet extends HttpServlet {
if ("body".equals(in)) {
if (field.equals("schema"))
- p.setSchema(jp.parse(value, Schema.class));
+ p.setSchema(jp.parse(value, SchemaInfo.class));
} else {
if (field.equals("allowEmptyValue"))
p.setAllowEmptyValue(Boolean.valueOf(value));
@@ -2550,9 +2540,9 @@ public abstract class RestServlet extends HttpServlet {
String in = mp.paramType.getSwaggerParameterType();
if (in != null) {
String k2 = in + '.' + ("body".equals(in) ? null : mp.name);
- Parameter p = m.get(k2);
+ ParameterInfo p = m.get(k2);
if (p == null) {
- p = Parameter.createStrict(in, mp.name);
+ p = ParameterInfo.createStrict(in, mp.name);
m.put(k2, p);
}
}
@@ -2560,29 +2550,29 @@ public abstract class RestServlet extends HttpServlet {
if (m.isEmpty())
return null;
- return new ArrayList<Parameter>(m.values());
+ return new ArrayList<ParameterInfo>(m.values());
}
@SuppressWarnings("unchecked")
- private Map<String,org.apache.juneau.dto.swagger.Response> getResponses(RestRequest req) throws ParseException {
+ private Map<String,ResponseInfo> getResponses(RestRequest req) throws ParseException {
Operation o = getSwaggerOperationFromFile(req);
if (o != null && o.getResponses() != null)
return o.getResponses();
VarResolverSession vr = req.getVarResolverSession();
JsonParser jp = JsonParser.DEFAULT;
- Map<String,org.apache.juneau.dto.swagger.Response> m = new TreeMap<String,org.apache.juneau.dto.swagger.Response>();
- Map<String,org.apache.juneau.dto.swagger.Header> m2 = new TreeMap<String,org.apache.juneau.dto.swagger.Header>();
+ Map<String,ResponseInfo> m = new TreeMap<String,ResponseInfo>();
+ Map<String,HeaderInfo> m2 = new TreeMap<String,HeaderInfo>();
// First parse @RestMethod.parameters() annotation.
for (Response r : responses) {
String httpCode = String.valueOf(r.value());
String description = r.description().isEmpty() ? RestUtils.getHttpResponseText(r.value()) : vr.resolve(r.description());
- org.apache.juneau.dto.swagger.Response r2 = org.apache.juneau.dto.swagger.Response.create(description);
+ ResponseInfo r2 = ResponseInfo.create(description);
if (r.headers().length > 0) {
- for (Var v : r.headers()) {
- org.apache.juneau.dto.swagger.Header h = org.apache.juneau.dto.swagger.Header.createStrict(vr.resolve(v.type()));
+ for (Parameter v : r.headers()) {
+ HeaderInfo h = HeaderInfo.createStrict(vr.resolve(v.type()));
if (! v.collectionFormat().isEmpty())
h.setCollectionFormat(vr.resolve(v.collectionFormat()));
if (! v._default().isEmpty())
@@ -2607,9 +2597,9 @@ public abstract class RestServlet extends HttpServlet {
String value = vr.resolve(msgs.getString(key));
String[] parts = key.substring(prefix.length() + 1).split("\\.");
String httpCode = parts[0];
- org.apache.juneau.dto.swagger.Response r2 = m.get(httpCode);
+ ResponseInfo r2 = m.get(httpCode);
if (r2 == null) {
- r2 = org.apache.juneau.dto.swagger.Response.create(null);
+ r2 = ResponseInfo.create(null);
m.put(httpCode, r2);
}
@@ -2620,9 +2610,9 @@ public abstract class RestServlet extends HttpServlet {
String field = parts[3];
String k2 = httpCode + '.' + headerName;
- org.apache.juneau.dto.swagger.Header h = m2.get(k2);
+ HeaderInfo h = m2.get(k2);
if (h == null) {
- h = org.apache.juneau.dto.swagger.Header.createStrict(null);
+ h = HeaderInfo.createStrict("string");
m2.put(k2, h);
r2.addHeader(name, h);
}
@@ -2642,7 +2632,7 @@ public abstract class RestServlet extends HttpServlet {
} else if ("description".equals(name)) {
r2.setDescription(value);
} else if ("schema".equals(name)) {
- r2.setSchema(jp.parse(value, Schema.class));
+ r2.setSchema(jp.parse(value, SchemaInfo.class));
} else if ("examples".equals(name)) {
r2.setExamples(jp.parseMap(value, TreeMap.class, String.class, Object.class));
} else {
@@ -2674,7 +2664,7 @@ public abstract class RestServlet extends HttpServlet {
if (patternVals.length > pathPattern.vars.length)
remainder = patternVals[pathPattern.vars.length];
for (int i = 0; i < pathPattern.vars.length; i++)
- req.setAttribute(pathPattern.vars[i], patternVals[i]);
+ req.setPathParameter(pathPattern.vars[i], patternVals[i]);
req.init(method, remainder, createRequestProperties(mProperties, req), mDefaultRequestHeaders, mDefaultEncoding, mSerializers, mParsers, mUrlEncodingParser);
res.init(req.getProperties(), mDefaultEncoding, mSerializers, mUrlEncodingSerializer, mEncoders);
@@ -2861,7 +2851,7 @@ public abstract class RestServlet extends HttpServlet {
* <p>
* Variable resolvers are used to replace variables in property values.
* </p>
- * <h6 class='figure'>Example</h6>
+ * <h6 class='figure'>Example:</h6>
* <p class='bcode'>
* <ja>@RestResource</ja>(
* messages=<js>"nls/Messages"</js>,
@@ -2885,7 +2875,7 @@ public abstract class RestServlet extends HttpServlet {
* properties={
* <ja>@Property</ja>(
* name=<jsf>HTMLDOC_links</jsf>,
- * value=<js>"{up:'$R{requestParentURI}', options:'?method=OPTIONS', editLevel:'$R{servletURI}/editLevel?logger=$A{name}'}"</js>
+ * value=<js>"{up:'$R{requestParentURI}', options:'?method=OPTIONS', editLevel:'$R{servletURI}/editLevel?logger=$R{attribute.name}'}"</js>
* )
* }
* )
@@ -2942,7 +2932,7 @@ public abstract class RestServlet extends HttpServlet {
* <p>
* Subclasses can augment this list by adding their own variables.
* </p>
- * <h6 class='figure'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@Override</ja>
* <jk>protected</jk> StringVarResolver createVarResolver() {
@@ -2977,8 +2967,7 @@ public abstract class RestServlet extends HttpServlet {
* Creates a properties map for the specified request.
* <p>
* This map will automatically resolve any <js>"$X{...}"</js> variables using the {@link VarResolver}
- * returned by {@link #getVarResolver()}.
- * </p>
+ * returned by {@link #getVarResolver()}.
*
* @param methodProperties The method-level properties.
* @param req The HTTP servlet request.
@@ -2992,6 +2981,18 @@ public abstract class RestServlet extends HttpServlet {
Object o = super.get(key);
if (o == null) {
String k = key.toString();
+ if (k.indexOf('.') != -1) {
+ String prefix = k.substring(0, k.indexOf('.'));
+ String remainder = k.substring(k.indexOf('.')+1);
+ if ("path".equals(prefix))
+ return req.getPathParameter(remainder);
+ if ("query".equals(prefix))
+ return req.getQueryParameter(remainder);
+ if ("formData".equals(prefix))
+ return req.getFormDataParameter(remainder);
+ if ("header".equals(prefix))
+ return req.getHeader(remainder);
+ }
if (k.equals(SERIALIZER_absolutePathUriBase)) {
int serverPort = req.getServerPort();
String serverName = req.getServerName();
@@ -3017,7 +3018,7 @@ public abstract class RestServlet extends HttpServlet {
return req.getMethodSummary();
if (k.equals(REST_methodDescription))
return req.getMethodDescription();
- o = req.getAttribute(k);
+ o = req.getPathParameter(k);
if (o == null)
o = req.getHeader(k);
}
@@ -3033,18 +3034,15 @@ public abstract class RestServlet extends HttpServlet {
/**
* Returns the class-level properties associated with this servlet.
* <p>
- * Created by the {@link #createGuards(ObjectMap)} method.
+ * Created by the {@link #createGuards(ObjectMap)} method.
* <p>
- * <b>Important note:</b> The returned {@code Map} is mutable. Therefore, subclasses are free to override
- * or set additional initialization parameters in their {@code init()} method.
+ * <b>Important note:</b> The returned {@code Map} is mutable. Therefore, subclasses are free to override
+ * or set additional initialization parameters in their {@code init()} method.
* <p>
- * This method can be called from {@link HttpServlet#init(ServletConfig)} or {@link HttpServlet#init()}.
- * </p>
+ * This method can be called from {@link HttpServlet#init(ServletConfig)} or {@link HttpServlet#init()}.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Old way of getting a boolean init parameter</jc>
* String s = getInitParam(<js>"allowMethodParam"</js>);
* if (s == <jk>null</jk>)
@@ -3053,9 +3051,7 @@ public abstract class RestServlet extends HttpServlet {
*
* <jc>// New simplified way of getting a boolean init parameter</jc>
* <jk>boolean</jk> b = getProperties().getBoolean(<js>"allowMethodParam"</js>, <jk>false</jk>);
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @return The resource properties as an {@link ObjectMap}.
*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Body.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Body.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Body.java
index 936afed..80a1c02 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Body.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Body.java
@@ -22,7 +22,7 @@ import java.lang.annotation.*;
* Annotation that can be applied to a parameter of a {@link RestMethod} annotated method
* to identify it as the HTTP request body converted to a POJO.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"POST"</js>)
* <jk>public void</jk> doPostPerson(RestRequest req, RestResponse res, <ja>@Body</ja> Person person) {
@@ -45,7 +45,7 @@ import java.lang.annotation.*;
* </p>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"POST"</js>)
- * <jk>public void</jk> doPostPerson(<ja>@Header</ja> String mediaType, <ja>@Body</ja> InputStream input) {
+ * <jk>public void</jk> doPostPerson(<ja>@Header</ja>(<js>"Content-Type"</js>) String mediaType, <ja>@Body</ja> InputStream input) {
* ...
* }
* </p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/FormData.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/FormData.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/FormData.java
index 279f366..aeadf70 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/FormData.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/FormData.java
@@ -23,7 +23,7 @@ import org.apache.juneau.server.*;
* Annotation that can be applied to a parameter of a {@link RestMethod} annotated method
* to identify it as a form post entry converted to a POJO.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"POST"</js>)
* <jk>public void</jk> doPost(RestRequest req, RestResponse res,
@@ -46,11 +46,11 @@ import org.apache.juneau.server.*;
*
* <h6 class='topic'>Important note concerning FORM posts</h6>
* <p>
- * This annotation should not be combined with the {@link Body @Body} annotation or {@link RestRequest#getBody(Class)} method
+ * This annotation should not be combined with the {@link Body @Body} annotation or {@link RestRequest#getBody(Class)} method
* for <code>application/x-www-form-urlencoded POST</code> posts, since it will trigger the underlying servlet
* API to parse the body content as key-value pairs resulting in empty content.
* <p>
- * The {@link Query @Query} annotation can be used to retrieve a URL parameter
+ * The {@link Query @Query} annotation can be used to retrieve a URL parameter
* in the URL string without triggering the servlet to drain the body content.
*
* @author James Bognar (james.bognar@salesforce.com)
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasFormData.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasFormData.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasFormData.java
index b2d47e9..73c3771 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasFormData.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasFormData.java
@@ -23,8 +23,9 @@ import org.apache.juneau.server.*;
* Annotation that can be applied to a parameter of a {@link RestMethod} annotated method
* to identify whether or not the request has the specified multipart form POST parameter.
* <p>
- * Note that this can be used to detect the existence of a parameter when it's not set to a particular value.
- * <h6 class='topic'>Example</h6>
+ * Note that this can be used to detect the existence of a parameter when it's not set to a particular value.
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"POST"</js>)
* <jk>public void</jk> doPost(<ja>@HasFormData</ja>(<js>"p1"</js>) <jk>boolean</jk> p1) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasQuery.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasQuery.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasQuery.java
index ad17d35..62f6743 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasQuery.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/HasQuery.java
@@ -28,7 +28,7 @@ import org.apache.juneau.server.*;
* Therefore, this annotation can be used in conjunction with the {@link Body @Body} annotation
* or {@link RestRequest#getBody(Class)} method for <code>application/x-www-form-urlencoded POST</code> calls.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>)
* <jk>public void</jk> doPost(<ja>@HasQuery</ja>(<js>"p1"</js>) <jk>boolean</jk> p1, <ja>@Body</ja> Bean myBean) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Header.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Header.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Header.java
index 58fb2fb..af6c222 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Header.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Header.java
@@ -21,7 +21,7 @@ import java.lang.annotation.*;
* Annotation that can be applied to a parameter of a {@link RestMethod} annotated method
* to identify it as a HTTP request header converted to a POJO.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>)
* <jk>public void</jk> doGet(RestRequest req, RestResponse res, <ja>@Header</ja>(<js>"ETag"</js>) UUID etag) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Messages.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Messages.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Messages.java
index 2f1750e..5a408ba 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Messages.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Messages.java
@@ -26,7 +26,7 @@ import org.apache.juneau.utils.*;
* <p>
* Parameter type must be either {@link ResourceBundle} or {@link MessageBundle}.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>)
* <jk>public</jk> String doGet(<ja>@Messages</ja> ResourceBundle messages) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Method.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Method.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Method.java
index 3eb14ec..e30c0f9 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Method.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Method.java
@@ -23,7 +23,7 @@ import java.lang.annotation.*;
* <p>
* Typically used for HTTP method handlers of type <js>"*"</js> (i.e. handle all requests).
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"*"</js>)
* <jk>public void</jk> doAnything(RestRequest req, RestResponse res, <ja>@Method</ja> String method) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Parameter.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Parameter.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Parameter.java
new file mode 100755
index 0000000..f64237c
--- /dev/null
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Parameter.java
@@ -0,0 +1,182 @@
+// ***************************************************************************************************************************
+// * 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.server.annotation;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+/**
+ * Annotation used in conjunction with {@link RestMethod#parameters()} to identify content and header descriptions
+ * on specific method requests.
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
+ * <ja>@RestMethod</ja>(
+ * name=<js>"*"</js>,
+ * parameters={
+ * <ja>@Parameter</ja>(in=<js>"header"</js>, name=<js>"Range"</js>, description=<js>"$L{ContentRange.description}"</js>)
+ * }
+ * )
+ * <jk>public void</jk> doAnything(RestRequest req, RestResponse res, <ja>@Method</ja> String method) {
+ * ...
+ * }
+ * </p>
+ *
+ * @author James Bognar (james.bognar@salesforce.com)
+ */
+@Documented
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Inherited
+public @interface Parameter {
+
+ /**
+ * The location of the parameter.
+ * <p>
+ * Possible values are:
+ * <ul>
+ * <li><js>"query"</js>
+ * <li><js>"header"</js>
+ * <li><js>"path"</js>
+ * <li><js>"formData"</js>
+ * <li><js>"body"</js>
+ * </ul>
+ */
+ String in() default "";
+
+ /**
+ * The name of the parameter (e.g. <js>"Content-Range"</js>).
+ * <p>
+ * Parameter names are case sensitive.
+ * If <code>in</code> is <js>"path"</js>, the name field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
+ * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
+ * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
+ */
+ String name() default "";
+
+ /**
+ * Parameter description (e.g. <js>"Indicates the range returned when Range header is present in the request"</js>).
+ * <p>
+ * A brief description of the parameter.
+ * This could contain examples of use.
+ * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
+ * <p>
+ * The default value pulls the description from the <code>description</code> entry in the servlet resource bundle.
+ * (e.g. <js>"myMethod.res.[code].[category].[name] = foo"</js> or <js>"MyServlet.myMethod.res.[code].[category].[name] = foo"</js>).
+ */
+ String description() default "";
+
+ /**
+ * Determines whether this parameter is mandatory.
+ * <p>
+ * If the parameter is <code>in</code> <js>"path"</js>, this property is required and its value MUST be <jk>true</jk>.
+ * Otherwise, the property MAY be included and its default value is <jk>false</jk>.
+ */
+ boolean required() default false;
+
+ /**
+ * The schema defining the type used for the body parameter.
+ * <p>
+ * Only applicable for <code>in</code> of type <js>"body"</js>.
+ * <p>
+ * The schema is a JSON object specified <a href='http://swagger.io/specification/#schemaObject'>here</a>.
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
+ * <ja>@RestMethod</ja>(
+ * parameters={
+ * <ja>@Parameter</ja>(
+ * in=<js>"header"</js>,
+ * name=<js>"Foo"</js>,
+ * schema=<js>"{format:'string',title:'Foo header',description:'Header that contains the Foo value.'}"</js>)
+ * }
+ * )
+ * <jk>public void</jk> doAnything() {
+ * </p>
+ */
+ String schema() default "";
+
+ /**
+ * The type of the parameter.
+ * <p>
+ * The value MUST be one of <js>"string"</js>, <js>"number"</js>, <js>"integer"</js>, <js>"boolean"</js>, <js>"array"</js> or <js>"file"</js>.
+ * If type is <js>"file"</js>, the consumes MUST be either <js>"multipart/form-data"</js>, <js>"application/x-www-form-urlencoded"</js> or both and the parameter MUST be in <js>"formData"</js>.
+ */
+ String type() default "string";
+
+ /**
+ * The extending format for the previously mentioned <code>type</code>.
+ * <p>
+ * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
+ */
+ String format() default "";
+
+ /**
+ * Sets the ability to pass empty-valued parameters.
+ * <p>
+ * This is valid only for either <code>query</code> or <code>formData</code> parameters and allows you to send a parameter with a name only or an empty value.
+ * Default value is <jk>false</jk>.
+ */
+ boolean allowEmptyValue() default false;
+
+ /**
+ * Required if <code>type</code> is <js>"array"</js>.
+ * <p>
+ * Describes the type of items in the array.
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
+ * <ja>@RestMethod</ja>(
+ * parameters={
+ * <ja>@Parameter</ja>(
+ * in=<js>"header"</js>,
+ * name=<js>"Foo"</js>,
+ * type=<js>"array"</js>,
+ * items=<js>"{type:'string',collectionFormat:'csv'}"</js>)
+ * }
+ * )
+ * <jk>public void</jk> doAnything() {
+ * </p>
+ * <p>
+ * See <a href='http://swagger.io/specification/#itemsObject'>Items Object</a> for further details.
+ */
+ String items() default "";
+
+ /**
+ * Determines the format of the array if type array is used.
+ * <p>
+ * Possible values are:
+ * <ul>
+ * <li><js>"csv"</js> - comma separated values <js>"foo,bar"</js>.
+ * <li><js>"ssv"</js> - space separated values <js>"foo bar"</js>.
+ * <li><js>"tsv"</js> - tab separated values <js>"foo\tbar"</js>.
+ * <li><js>"pipes"</js> - pipe separated values <js>"foo|bar"</js>.
+ * <li><js>"multi"</js> - corresponds to multiple parameter instances instead of multiple values for a single instance <js>"foo=bar&foo=baz"</js>.
+ * This is valid only for parameters <code>in</code> <js>"query"</js> or <js>"formData"</js>.
+ * </ul>
+ * Default value is <js>"csv"</js>.
+ */
+ String collectionFormat() default "";
+
+ /**
+ * Declares the value of the parameter that the server will use if none is provided.
+ * <p>
+ * For example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request.
+ * (Note: "default" has no meaning for required parameters.)
+ * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
+ * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for this parameter.
+ */
+ String _default() default "";
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Path.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Path.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Path.java
index f5f90ad..1c662eb 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Path.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Path.java
@@ -21,7 +21,7 @@ import java.lang.annotation.*;
* Annotation that can be applied to a parameter of a {@link RestMethod} annotated method
* to identify it as a variable in a URL path pattern converted to a POJO.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/myurl/{foo}/{bar}/{baz}/*"</js>)
* <jk>public void</jk> doGet(RestRequest req, RestResponse res,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/PathRemainder.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/PathRemainder.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/PathRemainder.java
index 8dd617c..1aaca2c 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/PathRemainder.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/PathRemainder.java
@@ -21,7 +21,7 @@ import java.lang.annotation.*;
* Annotation that can be applied to a parameter of a {@link RestMethod} annotated method
* to identify it as the URL parameter remainder after a path pattern match.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/foo/*"</js>)
* <jk>public void</jk> doGet(RestRequest req, RestResponse res, <ja>@PathRemainder</ja> String remainder) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Properties.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Properties.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Properties.java
index ac4584c..3583bf7 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Properties.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Properties.java
@@ -23,7 +23,7 @@ import org.apache.juneau.*;
* Annotation that can be applied to a parameter of a {@link RestMethod} annotated method
* to identify the request-duration properties object for the current request.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>)
* <jk>public Person</jk> doGetPerson(<ja>@Properties</ja> ObjectMap properties) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Query.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Query.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Query.java
index 8958006..f47f921 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Query.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Query.java
@@ -28,7 +28,7 @@ import org.apache.juneau.server.*;
* Therefore, this annotation can be used in conjunction with the {@link Body @Body} annotation
* or {@link RestRequest#getBody(Class)} method for <code>application/x-www-form-urlencoded POST</code> calls.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>)
* <jk>public void</jk> doGet(RestRequest req, RestResponse res,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Response.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Response.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Response.java
index 848259a..5bf9d07 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Response.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Response.java
@@ -20,7 +20,7 @@ import java.lang.annotation.*;
/**
* Annotation used in conjunction with {@link RestMethod#responses()} to identify possible responses by the method.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(
* name=<js>"*"</js>,
@@ -67,6 +67,15 @@ public @interface Response {
* If this field does not exist, it means no content is returned as part of the response.
* As an extension to the <a href='http://swagger.io/specification/#schemaObject'>Schema Object</a>, its root type value may also be <js>"file"</js>.
* This SHOULD be accompanied by a relevant produces mime-type.
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
+ * <ja>@RestMethod</ja>(
+ * name=<js>"*"</js>,
+ * responses={
+ * <ja>@Response</ja>(value=200,schema=<js>"{type:'string',description:'A serialized Person bean.'}"</js>),
+ * }
+ * </p>
*/
String schema() default "";
@@ -76,5 +85,5 @@ public @interface Response {
* Response variables can also be defined in the servlet resource bundle.
* (e.g. <js>"myMethod.res.[code].[category].[name] = foo"</js> or <js>"MyServlet.myMethod.res.[code].[category].[name] = foo"</js>).
*/
- Var[] headers() default {};
+ Parameter[] headers() default {};
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestMethod.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestMethod.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestMethod.java
index a73f84a..3683fa9 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestMethod.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestMethod.java
@@ -257,9 +257,7 @@ public @interface RestMethod {
* <p>
* Header values specified at the method level override header values specified at the servlet level.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Assume "text/json" Accept value when Accept not specified</jc>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/*"</js>, defaultRequestHeaders={<js>"Accept: text/json"</js>})
@@ -267,8 +265,6 @@ public @interface RestMethod {
* ...
* }
* </p>
- * </dd>
- * </dl>
*/
String[] defaultRequestHeaders() default {};
@@ -282,7 +278,7 @@ public @interface RestMethod {
* <li>The summary of the method in the Swagger page.
* </ul>
* <p>
- * The default value pulls the description from the <code>(className.?)[javaMethodName]</code> entry in the servlet resource bundle.
+ * The default value pulls the description from the <code>(className.?)[javaMethodName].summary</code> entry in the 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}").
@@ -301,7 +297,7 @@ public @interface RestMethod {
* <li>The description of the method in the Swagger page.
* </ul>
* <p>
- * The default value pulls the description from the <code>(className.?)[javaMethodName]</code> entry in the servlet resource bundle.
+ * The default value pulls the description from the <code>(className.?)[javaMethodName].description</code> entry in the servlet resource bundle.
* (e.g. <js>"MyClass.myMethod.description = foo"</js> or <js>"myMethod.description = foo"</js>).
* <p>
* This field value can contain variables (e.g. "$L{my.localized.variable}").
@@ -323,7 +319,10 @@ public @interface RestMethod {
* }
* </p>
* <p>
- * Example:
+ * The default value pulls the description from the <code>(className.?)[javaMethodName].externalDocs</code> entry in the servlet resource bundle.
+ * (e.g. <js>"MyClass.myMethod.externalDocs = {url:'http://juneau.apache.org'}"</js> or <js>"myMethod.externalDocs = {url:'http://juneau.apache.org'}"</js>).
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(externalDocs=<js>"{url:'http://juneau.apache.org'}"</js>)
* </p>
@@ -342,7 +341,10 @@ public @interface RestMethod {
* A comma-delimited list of tags for API documentation control.
* Tags can be used for logical grouping of operations by resources or any other qualifier.
* <p>
- * Example:
+ * The default value pulls the description from the <code>(className.?)[javaMethodName].tags</code> entry in the servlet resource bundle.
+ * (e.g. <js>"MyClass.myMethod.tags = foo,bar"</js> or <js>"myMethod.tags = foo,bar"</js>).
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(tags=<js>"foo,bar"</js>)
* </p>
@@ -358,7 +360,10 @@ public @interface RestMethod {
* <p>
* Used to populate the Swagger deprecated field.
* <p>
- * Example:
+ * The default value pulls the description from the <code>(className.?)[javaMethodName].deprecated</code> entry in the servlet resource bundle.
+ * (e.g. <js>"MyClass.myMethod.deprecated = true"</js> or <js>"myMethod.deprecated = foo,bar"</js>).
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(deprecated=<jk>true</jk>)
* </p>
@@ -374,28 +379,28 @@ public @interface RestMethod {
* <p>
* This annotation is provided for documentation purposes and is used to populate the method <js>"parameters"</js> column
* on the Swagger page.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(
* name=<js>"POST"</js>, path=<js>"/{a}"</js>,
* description=<js>"This is my method."</js>,
* parameters={
- * <ja>@Var</ja>(in=<js>"path"</js>, name=<js>"a"</js>, description=<js>"The 'a' attribute"</js>),
- * <ja>@Var</ja>(in=<js>"query"</js>, name=<js>"b"</js>, description=<js>"The 'b' parameter"</js>, required=<jk>true</jk>),
- * <ja>@Var</ja>(in=<js>"body"</js>, description=<js>"The HTTP content"</js>),
- * <ja>@Var</ja>(in=<js>"header"</js>, name=<js>"D"</js>, description=<js>"The 'D' header"</js>),
+ * <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"a"</js>, description=<js>"The 'a' attribute"</js>),
+ * <ja>@Parameter</ja>(in=<js>"query"</js>, name=<js>"b"</js>, description=<js>"The 'b' parameter"</js>, required=<jk>true</jk>),
+ * <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"The HTTP content"</js>),
+ * <ja>@Parameter</ja>(in=<js>"header"</js>, name=<js>"D"</js>, description=<js>"The 'D' header"</js>),
* }
* )
* </p>
* This is functionally equivalent to specifying the following keys in the resource bundle for the class, except in this case
* the strings are internationalized.
* <p class='bcode'>
- * <jk>MyClass.myMethod</jk> = <js>This is my method.</js>
- * <jk>MyClass.myMethod.parameters.path.a.description</jk> = <js>The 'a' attribute</js>
- * <jk>MyClass.myMethod.parameters.query.b.description</jk> = <js>The 'b' parameter</js>
- * <jk>MyClass.myMethod.parameters.body.description</jk> = <js>The HTTP content</js>
- * <jk>MyClass.myMethod.parameters.header.d.description</jk> = <js>The 'D' header</js>
+ * <jk>MyClass.myMethod.description</jk> = <js>This is my method.</js>
+ * <jk>MyClass.myMethod.req.path.a.description</jk> = <js>The 'a' attribute</js>
+ * <jk>MyClass.myMethod.req.query.b.description</jk> = <js>The 'b' parameter</js>
+ * <jk>MyClass.myMethod.req.body.description</jk> = <js>The HTTP content</js>
+ * <jk>MyClass.myMethod.req.header.d.description</jk> = <js>The 'D' header</js>
* <p>
* As a general rule, use annotations when you don't care about internationalization (i.e. you only want to support English),
* and use resource bundles if you need to support localization.
@@ -404,15 +409,15 @@ public @interface RestMethod {
* <p>
* Corresponds to the swagger field <code>/paths/{path}/{method}/parameters</code>.
*/
- Var[] parameters() default {};
+ Parameter[] parameters() default {};
/**
* Optional output description.
* <p>
* This annotation is provided for documentation purposes and is used to populate the method <js>"responses"</js> column
* on the Swagger page.
- * <p>
- * Example:
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(
* name=<js>"GET"</js>, path=<js>"/"</js>,
@@ -421,8 +426,8 @@ public @interface RestMethod {
* <ja>@Response</ja>(
* value=302,
* description=<js>"Thing wasn't found here"</js>,
- * output={
- * <ja>@Var</ja>(category=<js>"header"</js>, name=<js>"Location"</js>, description=<js>"The place to find the thing"</js>)
+ * headers={
+ * <ja>@Parameter</ja>(name=<js>"Location"</js>, description=<js>"The place to find the thing"</js>)
* }
* )
* }
@@ -431,9 +436,9 @@ public @interface RestMethod {
* This is functionally equivalent to specifying the following keys in the resource bundle for the class, except in this case
* the strings are internationalized.
* <p class='bcode'>
- * <jk>MyClass.myMethod.res.200</jk> = <js>OK</js>
- * <jk>MyClass.myMethod.res.302</jk> = <js>Thing wasn't found here</js>
- * <jk>MyClass.myMethod.res.302.header.Location</jk> = <js>The place to find the thing</js>
+ * <jk>MyClass.myMethod.res.200.description</jk> = <js>OK</js>
+ * <jk>MyClass.myMethod.res.302.description</jk> = <js>Thing wasn't found here</js>
+ * <jk>MyClass.myMethod.res.302.header.Location.description</jk> = <js>The place to find the thing</js>
* <p>
* As a general rule, use annotations when you don't care about internationalization (i.e. you only want to support English),
* and use resource bundles if you need to support localization.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestResource.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestResource.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestResource.java
index a2fa54a..e878de2 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestResource.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/annotation/RestResource.java
@@ -179,18 +179,15 @@ public @interface RestResource {
* <p>
* This annotation can only be used on {@link Encoder} classes that have no-arg constructors.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Servlet with automated support for GZIP compression</jc>
* <ja>@RestResource</ja>(encoders={GzipEncoder.<jk>class</jk>})
* <jk>public</jk> MyRestServlet <jk>extends</jk> RestServlet {
* ...
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
Class<? extends Encoder>[] encoders() default {};
@@ -206,18 +203,14 @@ public @interface RestResource {
* <p>
* Only one header value can be specified per entry (i.e. it's not a delimited list of header entries).
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Assume "text/json" Accept value when Accept not specified</jc>
* <ja>@RestResource</ja>(defaultRequestHeaders={<js>"Accept: text/json"</js>})
* <jk>public</jk> MyRestServlet <jk>extends</jk> RestServlet {
* ...
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
String[] defaultRequestHeaders() default {};
@@ -232,18 +225,14 @@ public @interface RestResource {
* <p>
* Only one header value can be specified per entry (i.e. it's not a delimited list of header entries).
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Add a version header attribute to all responses</jc>
* <ja>@RestResource</ja>(defaultResponseHeaders={<js>"X-Version: 1.0"</js>})
* <jk>public</jk> MyRestServlet <jk>extends</jk> RestServlet {
* ...
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
String[] defaultResponseHeaders() default {};
@@ -305,7 +294,7 @@ public @interface RestResource {
* This value can be retrieved programmatically through the {@link RestServlet#getTitle(RestRequest)} method.
* <p>
* The default value pulls the label from the <code>label</code> entry in the servlet resource bundle.
- * (e.g. <js>"label = foo"</js> or <js>"MyServlet.label = foo"</js>).
+ * (e.g. <js>"title = foo"</js> or <js>"MyServlet.title = foo"</js>).
* <p>
* This field can contain variables (e.g. "$L{my.localized.variable}").
* <p>
@@ -334,6 +323,9 @@ public @interface RestResource {
* It is used to populate the Swagger terms-of-service field.
* This value can be retrieved programmatically through the {@link RestServlet#getTermsOfService(RestRequest)} method.
* <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}").
* <p>
* Corresponds to the swagger field <code>/info/termsOfService</code>.
@@ -355,7 +347,10 @@ public @interface RestResource {
* }
* </p>
* <p>
- * Example:
+ * The default value pulls the description from the <code>contact</code> entry in the servlet resource bundle.
+ * (e.g. <js>"contact = {name:'John Smith',email:'john.smith@foo.bar'}"</js> or <js>"MyServlet.contact = {name:'John Smith',email:'john.smith@foo.bar'}"</js>).
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestResource</ja>(contact=<js>"{name:'John Smith',email:'john.smith@foo.bar'}"</js>)
* </p>
@@ -380,7 +375,10 @@ public @interface RestResource {
* }
* </p>
* <p>
- * Example:
+ * The default value pulls the description from the <code>license</code> entry in the servlet resource bundle.
+ * (e.g. <js>"license = {name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}"</js> or <js>"MyServlet.license = {name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}"</js>).
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestResource</ja>(license=<js>"{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}"</js>)
* </p>
@@ -397,6 +395,9 @@ public @interface RestResource {
* It is used to populate the Swagger version field and to display on HTML pages.
* This value can be retrieved programmatically through the {@link RestServlet#getVersion(RestRequest)} method.
* <p>
+ * The default value pulls the description from the <code>version</code> entry in the servlet resource bundle.
+ * (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}").
* <p>
* Corresponds to the swagger field <code>/info/version</code>.
@@ -423,7 +424,10 @@ public @interface RestResource {
* ]
* </p>
* <p>
- * Example:
+ * The default value pulls the description from the <code>tags</code> entry in the servlet resource bundle.
+ * (e.g. <js>"tags = [{name:'Foo',description:'Foobar'}]"</js> or <js>"MyServlet.tags = [{name:'Foo',description:'Foobar'}]"</js>).
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestResource</ja>(tags=<js>"[{name:'Foo',description:'Foobar'}]"</js>)
* </p>
@@ -448,7 +452,10 @@ public @interface RestResource {
* }
* </p>
* <p>
- * Example:
+ * The default value pulls the description from the <code>externalDocs</code> entry in the servlet resource bundle.
+ * (e.g. <js>"externalDocs = {url:'http://juneau.apache.org'}"</js> or <js>"MyServlet.externalDocs = {url:'http://juneau.apache.org'}"</js>).
+ *
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestResource</ja>(externalDocs=<js>"{url:'http://juneau.apache.org'}"</js>)
* </p>
@@ -491,10 +498,8 @@ public @interface RestResource {
* <p>
* If the file cannot be located, the request to <js>"[servletpath]/style.css"</js> will return {@link HttpServletResponse#SC_NOT_FOUND}.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>package</jk> com.ibm.mypackage;
*
* <ja>@RestResource</ja>(
@@ -502,17 +507,15 @@ public @interface RestResource {
* )
* <jk>public class</jk> MyResource <jk>extends</jk> RestServletDefault {
* }
- * </p>
- * <p>
- * In this example, the servlet will attempt to find the <code>mycss.css</code> file in the following ordered locations:
- * </p>
- * <ol>
- * <li><code>com.ibm.mypackage.mystyles</code> package.
- * <li><code>org.apache.juneau.server.mystyles</code> package (since <code>RestServletDefault</code> is in <code>org.apache.juneau.server</code>).
- * <li><code>[working-dir]/mystyles</code> directory.
- * </ol>
- * </dd>
- * </dl>
+ * </p>
+ * <p>
+ * In this example, the servlet will attempt to find the <code>mycss.css</code> file in the following ordered locations:
+ * </p>
+ * <ol>
+ * <li><code>com.ibm.mypackage.mystyles</code> package.
+ * <li><code>org.apache.juneau.server.mystyles</code> package (since <code>RestServletDefault</code> is in <code>org.apache.juneau.server</code>).
+ * <li><code>[working-dir]/mystyles</code> directory.
+ * </ol>
*/
String stylesheet() default "";
@@ -525,10 +528,8 @@ public @interface RestResource {
* <p>
* If the file cannot be located, the request to <js>"[servletpath]/favicon.ico"</js> will return {@link HttpServletResponse#SC_NOT_FOUND}.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>package</jk> com.ibm.mypackage;
*
* <ja>@RestResource</ja>(
@@ -536,17 +537,15 @@ public @interface RestResource {
* )
* <jk>public class</jk> MyResource <jk>extends</jk> RestServletDefault {
* }
- * </p>
- * <p>
- * In this example, the servlet will attempt to find the <code>myicon.ico</code> file in the following ordered locations:
- * </p>
- * <ol>
- * <li><code>com.ibm.mypackage.mydocs</code> package.
- * <li><code>org.apache.juneau.server.mydocs</code> package (since <code>RestServletDefault</code> is in <code>org.apache.juneau.server</code>).
- * <li><code>[working-dir]/mydocs</code> directory.
- * </ol>
- * </dd>
- * </dl>
+ * </p>
+ * <p>
+ * In this example, the servlet will attempt to find the <code>myicon.ico</code> file in the following ordered locations:
+ * </p>
+ * <ol>
+ * <li><code>com.ibm.mypackage.mydocs</code> package.
+ * <li><code>org.apache.juneau.server.mydocs</code> package (since <code>RestServletDefault</code> is in <code>org.apache.juneau.server</code>).
+ * <li><code>[working-dir]/mydocs</code> directory.
+ * </ol>
*/
String favicon() default "";
@@ -561,10 +560,8 @@ public @interface RestResource {
* <p>
* The media type on the response is determined by the {@link RestServlet#getMimetypesFileTypeMap()} method.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>package</jk> com.ibm.mypackage;
*
* <ja>@RestResource</ja>(
@@ -573,18 +570,16 @@ public @interface RestResource {
* )
* <jk>public class</jk> MyResource <jk>extends</jk> RestServletDefault {
* }
- * </p>
- * <p>
- * In this example, given a GET request to <code>/myresource/htdocs/foobar.html</code>, the servlet will attempt to find the <code>foobar.html</code> file
- * in the following ordered locations:
- * </p>
- * <ol>
- * <li><code>com.ibm.mypackage.docs</code> package.
- * <li><code>org.apache.juneau.server.docs</code> package (since <code>RestServletDefault</code> is in <code>org.apache.juneau.server</code>).
- * <li><code>[working-dir]/docs</code> directory.
- * </ol>
- * </dd>
- * </dl>
+ * </p>
+ * <p>
+ * In this example, given a GET request to <code>/myresource/htdocs/foobar.html</code>, the servlet will attempt to find the <code>foobar.html</code> file
+ * in the following ordered locations:
+ * </p>
+ * <ol>
+ * <li><code>com.ibm.mypackage.docs</code> package.
+ * <li><code>org.apache.juneau.server.docs</code> package (since <code>RestServletDefault</code> is in <code>org.apache.juneau.server</code>).
+ * <li><code>[working-dir]/docs</code> directory.
+ * </ol>
*/
String staticFiles() default "";
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/annotation/Var.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Var.java b/juneau-server/src/main/java/org/apache/juneau/server/annotation/Var.java
deleted file mode 100755
index f3c3376..0000000
--- a/juneau-server/src/main/java/org/apache/juneau/server/annotation/Var.java
+++ /dev/null
@@ -1,150 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.server.annotation;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-import java.lang.annotation.*;
-
-/**
- * Annotation used in conjunction with {@link RestMethod#parameters()} to identify content and header descriptions
- * on specific method requests.
- *
- * <h6 class='topic'>Example</h6>
- * <p class='bcode'>
- * <ja>@RestMethod</ja>(
- * name=<js>"*"</js>,
- * parameters={
- * <ja>@Var</ja>(in=<js>"header"</js>, name=<js>"Range"</js>, description=<js>"$L{ContentRange.description}"</js>)
- * }
- * )
- * <jk>public void</jk> doAnything(RestRequest req, RestResponse res, <ja>@Method</ja> String method) {
- * ...
- * }
- * </p>
- *
- * @author James Bognar (james.bognar@salesforce.com)
- */
-@Documented
-@Target(PARAMETER)
-@Retention(RUNTIME)
-@Inherited
-public @interface Var {
-
- /**
- * The location of the parameter.
- * <p>
- * Possible values are:
- * <ul>
- * <li><js>"query"</js>
- * <li><js>"header"</js>
- * <li><js>"path"</js>
- * <li><js>"formData"</js>
- * <li><js>"body"</js>
- * </ul>
- */
- String in() default "";
-
- /**
- * The name of the parameter (e.g. <js>"Content-Range"</js>).
- * <p>
- * Var names are case sensitive.
- * If <code>in</code> is <js>"path"</js>, the name field MUST correspond to the associated path segment from the <code>path</code> field in the <a href='http://swagger.io/specification/#pathsObject'>Paths Object</a>.
- * See <a href='http://swagger.io/specification/#pathTemplating'>Path Templating</a> for further information.
- * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property.
- */
- String name() default "";
-
- /**
- * Var description (e.g. <js>"Indicates the range returned when Range header is present in the request"</js>).
- * <p>
- * A brief description of the parameter.
- * This could contain examples of use.
- * <a href='https://help.github.com/articles/github-flavored-markdown'>GFM syntax</a> can be used for rich text representation.
- * <p>
- * The default value pulls the description from the <code>description</code> entry in the servlet resource bundle.
- * (e.g. <js>"myMethod.res.[code].[category].[name] = foo"</js> or <js>"MyServlet.myMethod.res.[code].[category].[name] = foo"</js>).
- */
- String description() default "";
-
- /**
- * Determines whether this parameter is mandatory.
- * <p>
- * If the parameter is <code>in</code> <js>"path"</js>, this property is required and its value MUST be <jk>true</jk>.
- * Otherwise, the property MAY be included and its default value is <jk>false</jk>.
- */
- boolean required() default false;
-
- /**
- * The schema defining the type used for the body parameter.
- * <p>
- * Only applicable for <code>in</code> of type <js>"body"</js>.
- * <p>
- * The schema is a JSON object specified <a href='http://swagger.io/specification/#schemaObject'>here</a>.
- */
- String schema() default "";
-
- /**
- * The type of the parameter.
- */
- String type() default "string";
-
- /**
- * The extending format for the previously mentioned <code>type</code>.
- * <p>
- * See <a href='http://swagger.io/specification/#dataTypeFormat'>Data Type Formats</a> for further details.
- */
- String format() default "";
-
- /**
- * Sets the ability to pass empty-valued parameters.
- * <p>
- * This is valid only for either <code>query</code> or <code>formData</code> parameters and allows you to send a parameter with a name only or an empty value.
- * Default value is <jk>false</jk>.
- */
- boolean allowEmptyValue() default false;
-
- /**
- * Required if <code>type</code> is <js>"array"</js>.
- * <p>
- * Describes the type of items in the array.
- */
- String items() default "";
-
- /**
- * Determines the format of the array if type array is used.
- * <p>
- * Possible values are:
- * <ul>
- * <li><js>"csv"</js> - comma separated values <js>"foo,bar"</js>.
- * <li><js>"ssv"</js> - space separated values <js>"foo bar"</js>.
- * <li><js>"tsv"</js> - tab separated values <js>"foo\tbar"</js>.
- * <li><js>"pipes"</js> - pipe separated values <js>"foo|bar"</js>.
- * <li><js>"multi"</js> - corresponds to multiple parameter instances instead of multiple values for a single instance <js>"foo=bar&foo=baz"</js>.
- * This is valid only for parameters <code>in</code> <js>"query"</js> or <js>"formData"</js>.
- * </ul>
- * Default value is <js>"csv"</js>.
- */
- String collectionFormat() default "";
-
- /**
- * Declares the value of the parameter that the server will use if none is provided.
- * <p>
- * For example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request.
- * (Note: "default" has no meaning for required parameters.)
- * See <a href='http://json-schema.org/latest/json-schema-validation.html#anchor101'>http://json-schema.org/latest/json-schema-validation.html#anchor101</a>.
- * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for this parameter.
- */
- String _default() default "";
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/converters/Introspectable.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/converters/Introspectable.java b/juneau-server/src/main/java/org/apache/juneau/server/converters/Introspectable.java
index b5ed14e..fbde2ce 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/converters/Introspectable.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/converters/Introspectable.java
@@ -40,8 +40,8 @@ public final class Introspectable implements RestConverter {
@Override /* RestConverter */
@SuppressWarnings({"unchecked", "rawtypes"})
public Object convert(RestRequest req, Object o, ClassMeta cm) throws RestException {
- String method = req.getParameter("invokeMethod");
- String args = req.getParameter("invokeArgs");
+ String method = req.getQueryParameter("invokeMethod");
+ String args = req.getQueryParameter("invokeArgs");
if (method == null)
return o;
try {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptions.png
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptions.png b/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptions.png
index 237dc2b..8e64467 100755
Binary files a/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptions.png and b/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptions.png differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptionsJson.png
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptionsJson.png b/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptionsJson.png
index c528651..b87a317 100755
Binary files a/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptionsJson.png and b/juneau-server/src/main/java/org/apache/juneau/server/doc-files/HelloWorldResourceOptionsJson.png differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/jaxrs/package.html
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/jaxrs/package.html b/juneau-server/src/main/java/org/apache/juneau/server/jaxrs/package.html
index 314d0ca..b906649 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/jaxrs/package.html
+++ b/juneau-server/src/main/java/org/apache/juneau/server/jaxrs/package.html
@@ -120,7 +120,7 @@
For the most part, when using these components, you'll either use the existing <code>DefaultProvider</code> or
<code>JuneauProvider</code> providers, or define your own by subclassing <code>BaseProvider</code>.
- <h6 class='topic'>Example</h6>
+ <h6 class='topic'>Example:</h6>
<p>
The <code>juneau_sample.war</code> project contains a sample <code>HelloWorldResource</code> class that
shows how to use the JAX-RS provider. It uses Wink as the JAX-RS implementation.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java b/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java
index 019ca3a..658872f 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java
@@ -18,7 +18,7 @@ import org.apache.juneau.server.*;
/**
* Shortcut label for child resources. Typically used in router resources.
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Instead of this...</jc>
* <jk>new</jk> NameDescription(<jk>new</jk> Link(<js>"httpTool"</js>, uri + <js>"/httpTool"</js>), <js>"HTTP request test client"</js>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/package.html
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/package.html b/juneau-server/src/main/java/org/apache/juneau/server/package.html
index 6610dd0..5d99cf9 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/package.html
+++ b/juneau-server/src/main/java/org/apache/juneau/server/package.html
@@ -306,10 +306,10 @@
</p>
<img class='bordered' src="doc-files/HelloWorldResourceOptions.png">
<p>
- The OPTIONS page is generated automatically by introspection of the class itself combined with
- labels in the messages properties file.
+ The OPTIONS page is a serialized Swagger DTO bean populated by introspection of the class itself combined with
+ labels in the messages properties file and annotations.
It's composed of a POJO that gets serialized just like any other POJO.
- Therefore, the POJO can be searialized to any of the supported languages, like JSON.
+ Therefore, the POJO can be searialized to any of the supported languages, like Swagger JSON.
</p>
<img class='bordered' src="doc-files/HelloWorldResourceOptionsJson.png">
</div>
@@ -666,9 +666,9 @@
All annotations have programmatic equivalents on the {@link org.apache.juneau.server.RestRequest} class:
</p>
<ul class='javahierarchy'>
- <li class='m'>{@link org.apache.juneau.server.RestRequest#getAttribute(String,Class)}
- <li class='m'>{@link org.apache.juneau.server.RestRequest#getParameter(String,Class)}
- <li class='m'>{@link org.apache.juneau.server.RestRequest#hasParameter(String)}
+ <li class='m'>{@link org.apache.juneau.server.RestRequest#getPathParameter(String,Class)}
+ <li class='m'>{@link org.apache.juneau.server.RestRequest#getFormDataParameter(String,Class)}
+ <li class='m'>{@link org.apache.juneau.server.RestRequest#hasFormDataParameter(String)}
<li class='m'>{@link org.apache.juneau.server.RestRequest#getQueryParameter(String,Class)}
<li class='m'>{@link org.apache.juneau.server.RestRequest#hasQueryParameter(String)}
<li class='m'>{@link org.apache.juneau.server.RestRequest#getBody(Class)}
@@ -1020,17 +1020,30 @@
One of the most useful features of Juneau is that it can produce OPTIONS pages for self-documenting designs (i.e. REST interfaces that document themselves).
</p>
<h6 class='figure'>OPTIONS page for HelloWorld sample resource</h6>
- <img class='bordered' src='doc-files/OptionsPage.png'>
+ <img class='bordered' src='doc-files/HelloWorldResourceOptions.png'>
<p>
- To facilitate this, the <del>ResourceOptions</del> class is provided that
- inspects a <l>RestServlet</l> and its methods, and returns a serializable POJO data structure
- that describes the options for that resource and pulling localized strings from the resource
- bundle associated with the servlet.
+ This page is constructed through reflection on the servlet class and it's methods, combined with information provided in the following locations:
+ </p>
+ <ul>
+ <li>Annotations (i.e. {@link org.apache.juneau.server.annotation.RestResource @RestResource} and {@link org.apache.juneau.server.annotation.RestMethod @RestMethod}).
+ <li>Resource bundle properties.
+ <li>Swagger JSON files.
+ </ul>
+ <p>
+ Swagger JSON files are specified with the same name as the servlet (e.g. <code>MyResource.java</code> -> <code>MyResource.json</code>).
+ Localized versions of Swagger JSON files can be specified by appending the locale to the file name (e.g. <code>MyResource_ja_JP.json</code>).
+ The existence of Swagger JSON files will override any auto-generation of the OPTIONS pages.
+ This allows you to fully control the contents of the OPTIONS page with your own Swagger spec.
+ </p>
+ <p>
+ The framework takes the information above and populates a {@link org.apache.juneau.dto.swagger.Swagger} bean.
+ This bean is then serialized just like any other POJO to produce the page shown above.
</p>
<p>
{@link org.apache.juneau.server.RestServletDefault} provides a default OPTIONS page by implementing
a {@link org.apache.juneau.server.RestServletDefault#getOptions(RestRequest)} method that returns a POJO consisting
of beans describing the class.
+ It uses the {@link org.apache.juneau.server.RestRequest#getSwagger()} method that returns a localized swagger bean.
</p>
<p class='bcode'>
<jd>/**
@@ -1050,48 +1063,23 @@
<jk>return</jk> req.getSwagger();
}
</p>
+ <h6 class='topic'>Title and Description</h6>
<p>
- The <l>AddressBookResource</l> class in the samples shows an example of augmenting the existing
- <del>ResourceOptions</del> bean with some additional information.
- </p>
- <p class='bcode'>
- <jd>/** OPTIONS request handler */</jd>
- <ja>@Override</ja> <jc>/* RestServletJenaDefault */</jc>
- <ja>@RestMethod</ja>(name=<js>"OPTIONS"</js>, path=<js>"/*"</js>)
- <jk>public</jk> ResourceOptions getOptions(RestRequest req) {
- <jk>return new</jk> Options(req);
- }
-
- <jd>/**
- * Output POJO for OPTIONS requests.
- * Note that we're extending the existing ResourceOptions class.
- */</jd>
- <jk>public class</jk> Options <jk>extends</jk> ResourceOptions {
- <jk>public</jk> ParamDescription[] queryableParameters;
- <jk>public</jk> String[] otherNotes;
-
- <jk>public</jk> Options(RestRequest req) {
- <jk>super</jk>(AddressBookResource.<jk>this</jk>, req);
- Locale locale = req.getLocale();
- queryableParameters = getQueryableParamDescriptions(locale);
- otherNotes = getMessage(locale, <js>"otherNotes"</js>).split(<js>"\\.\\s*"</js>);
- }
- }
- </p>
- <p>
- Refer to <a class='doclink' href='#AddressBookResource'>Address Book Resource</a> for a complete example.
- </p>
- <h6 class='topic'>Label and Description</h6>
- <p>
- The label and description can be defined in two ways.
+ The title and description can be defined in the following ways.
</p>
+ <ul>
+ <li>Annotations: {@link org.apache.juneau.server.annotation.RestResource#title()}, {@link org.apache.juneau.server.annotation.RestResource#description()}
+ <li>By overriding methods on the servlet class: {@link org.apache.juneau.server.RestServlet#getTitle(RestRequest)}, {@link org.apache.juneau.server.RestServlet#getDescription(RestRequest)}
+ <li>By defining properties in the resource bundle.
+ <li>By specifying them in a Swagger JSON file.
+ </ul>
<p>
If you don't care about internationalization, then the easiest way is to use annotations on the servlet.
</p>
<p class='bcode'>
<ja>@RestResource</ja>(
path=<js>"/example"</js>,
- label=<js>"Example Resource"</js>,
+ title=<js>"Example Resource"</js>,
description=<js>"This shows how to use labels and descriptions."</js>
)
<jk>public class</jk> ExampleResource <jk>extends</jk> RestServletDefault {
@@ -1109,13 +1097,13 @@
<jk>public class</jk> ExampleResource <jk>extends</jk> RestServletDefault {
</p>
<p>
- The label and description are specified as special properties in the resource bundle:
+ The title and description are specified as special properties in the resource bundle:
</p>
<p class='bcode'>
<cc>#--------------------------------------------------------------------------------
# Contents of Messages.properties
#--------------------------------------------------------------------------------</cc>
- <ck>label</ck> = <cv>Example Resource</cv>
+ <ck>title</ck> = <cv>Example Resource</cv>
<ck>description</ck> = <cv>This shows how to use labels and descriptions.</cv>
</p>
<p>
@@ -1125,7 +1113,7 @@
<cc>#--------------------------------------------------------------------------------
# Contents of Messages.properties
#--------------------------------------------------------------------------------</cc>
- <ck>ExampleResource.label</ck> = <cv>Example Resource</cv>
+ <ck>ExampleResource.title</ck> = <cv>Example Resource</cv>
<ck>ExampleResource.description</ck> = <cv>This shows how to use labels and descriptions.</cv>
</p>
<p>
@@ -1154,14 +1142,14 @@
<jk>public abstract class</jk> RestServletDefault <jk>extends</jk> RestServlet {
</p>
<p>
- The label and description annotations support string variables.
+ The title and description annotations support string variables.
So in theory, you could also provide localized messages using <js>"$L"</js> variables pointing to your own resource bundle properties:
</p>
<p class='bcode'>
<ja>@RestResource</ja>(
path=<js>"/example"</js>,
messages=<js>"nls/Messages"</js>
- label=<js>"$L{my.resource.label}"</js>,
+ title=<js>"$L{my.resource.label}"</js>,
description=<js>"$L{my.resource.description}"</js>
)
<jk>public class</jk> ExampleResource <jk>extends</jk> RestServletDefault {
@@ -1192,16 +1180,11 @@
path=<js>"/people/{id}/*"</js>,
converters={Traversable.<jk>class</jk>,Queryable.<jk>class</jk>,Introspectable.<jk>class</jk>},
description=<js>"Get a person by id in the address book"</js>,
- input={
- <ja>@Var</ja>(in=<js>"path"</js>, name=<js>"id"</js>, description=<js>"Person UUID"</js>)
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"id"</js>, description=<js>"Person UUID"</js>)
},
responses={
- <ja>@Response</ja>(
- value=200,
- output={
- <ja>@Var</ja>(in=<js>"body"</js>, description=<js>"Person bean"</js>)
- }
- ),
+ <ja>@Response</ja>(value=200, description="Person bean"),
<ja>@Response</ja>(value=404, description=<js>"Person with specified id not found"</js>)
}
)
@@ -1227,10 +1210,10 @@
<cc>#--------------------------------------------------------------------------------
# Contents of AddressBookResource.properties
#--------------------------------------------------------------------------------</cc>
- <ck>getPerson</ck> = <cv>Get a person by id in the address book</cv>
- <ck>getPerson.req.attr.id</ck> = <cv>Person UUID</cv>
- <ck>getPerson.res.200</ck> = <cv>Person found</cv>
- <ck>getPerson.res.404</ck> = <cv>Person with specified id not found</cv>
+ <ck>getPerson.summary</ck> = <cv>Get a person by id in the address book</cv>
+ <ck>getPerson.req.path.id.description</ck> = <cv>Person UUID</cv>
+ <ck>getPerson.res.200.description</ck> = <cv>Person found</cv>
+ <ck>getPerson.res.404.description</ck> = <cv>Person with specified id not found</cv>
</p>
<p>
The following table shows the predefined resource bundle message property names:
@@ -1255,44 +1238,48 @@
<td>{@link org.apache.juneau.server.RestServlet#getDescription(RestRequest)}</td>
</tr>
<tr>
- <td><ck>[javaMethodName]</ck></td>
+ <td><ck>[javaMethodName].summary</ck></td>
+ <td>Java method summary</td>
+ <td>{@link org.apache.juneau.server.annotation.RestMethod#summary() @RestMethod.summary()}</td>
+ </tr>
+ <tr>
+ <td><ck>[javaMethodName].description</ck></td>
<td>Java method description</td>
<td>{@link org.apache.juneau.server.annotation.RestMethod#description() @RestMethod.description()}</td>
</tr>
<tr>
- <td><ck>[javaMethodName].req.content</ck></td>
+ <td><ck>[javaMethodName].req.body.description</ck></td>
<td>
- A description of the HTTP request content.
+ A description of the HTTP request body.
</td>
<td>{@link org.apache.juneau.server.annotation.RestMethod#parameters() @RestMethod.parameters()}</td>
</tr>
<tr>
- <td><ck>[javaMethodName].req.[category].[name]</ck></td>
+ <td><ck>[javaMethodName].req.[category].[name].description</ck></td>
<td>
A request input variable.
- <br>Categories: <l>ATTR, PARAM, HEADER</l>
+ <br>Categories: <l>path, query, formData, header</l>
</td>
<td>{@link org.apache.juneau.server.annotation.RestMethod#parameters() @RestMethod.parameters()}</td>
</tr>
<tr>
- <td><ck>[javaMethodName].res.[code]</ck></td>
+ <td><ck>[javaMethodName].res.[code].description</ck></td>
<td>
A possible HTTP response code and description.
</td>
<td>{@link org.apache.juneau.server.annotation.RestMethod#responses() @RestMethod.responses()}</td>
</tr>
<tr>
- <td><ck>[javaMethodName].res.[code].content</ck></td>
+ <td><ck>[javaMethodName].res.[code].body.description</ck></td>
<td>
A description of response content for the specified HTTP response.
</td>
<td>{@link org.apache.juneau.server.annotation.RestMethod#responses() @RestMethod.responses()}</td>
</tr>
<tr>
- <td><ck>[javaMethodName].res.[code].[category].[name]</ck></td>
+ <td><ck>[javaMethodName].res.[code].header.[name].description</ck></td>
<td>
- A response output variable.
- <br>Categories: <l>ATTR, PARAM, HEADER</l>
+ A response header.
</td>
<td>{@link org.apache.juneau.server.annotation.RestMethod#responses() @RestMethod.responses()}</td>
</tr>
@@ -1947,7 +1934,7 @@
</p>
<p class='bcode'>
<ja>@RestResource</ja>(
- label=<js>"$L{my.label}"</js>
+ title=<js>"$L{my.label}"</js>
properties={
<ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{options:'$R{servletURI}?method=OPTIONS'"</js>)
}
@@ -2091,28 +2078,20 @@
</td>
</tr>
<tr>
- <td><ck>$A{key}</ck><br><ck>$A{key,default}</ck></td>
- <td>Request attributes.
- <br>Resolves to the value returned by {@link org.apache.juneau.server.RestRequest#getAttribute(String)}.
- <br>Can include a default value (e.g. <l>"$A{myAttribute,myDefaultValue}"</l>)
- </td>
- </tr>
- <tr>
- <td><ck>$P{key}</ck><br><ck>$P{key,default}</ck></td>
- <td>Request parameters.
- <br>Resolves to the value returned by {@link org.apache.juneau.server.RestRequest#getParameter(String)}.
- <br>Can include a default value (e.g. <l>"$P{myAttribute,myDefaultValue}"</l>)
- </td>
- </tr>
- <tr>
<td><ck>$R{key}</ck></td>
<td>Request-specific variables.
<br>Possible values:
<ul>
+ <li><ck>$R{attribute.X}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getAttribute(String)} converted to a string.
<li><ck>$R{contextPath}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getContextPath()}.
+ <li><ck>$R{formData.X}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getFormDataParameter(String)}.
+ <li><ck>$R{header.X}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getHeader(String)}.
<li><ck>$R{method}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getMethod()}.
+ <li><ck>$R{methodSummary}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getMethodSummary()}.
<li><ck>$R{methodDescription}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getMethodDescription()}.
+ <li><ck>$R{path.X}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getPathParameter(String)}.
<li><ck>$R{pathInfo}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getPathInfo()}.
+ <li><ck>$R{query.X}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getQueryParameter(String)}.
<li><ck>$R{requestParentURI}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getRequestParentURI()}.
<li><ck>$R{requestURI}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getRequestURI()}.
<li><ck>$R{servletDescription}</ck> - Value returned by {@link org.apache.juneau.server.RestRequest#getServletDescription()}.
@@ -2563,7 +2542,7 @@
<cc>#-------------------------------------</cc>
<cs>[HelloWorldResource]</cs>
<ck>defaultPerson</ck> = you
- <ck>message</ck> = <cv>Hello $P{person,$C{HelloWorldResource/defaultPerson}}!</cv>
+ <ck>message</ck> = <cv>Hello $R{query.person,$C{HelloWorldResource/defaultPerson}}!</cv>
</p>
<p class='bcode'>
<jd>/**
@@ -2594,7 +2573,7 @@
<cc>#-------------------------------------</cc>
<cs>[HelloWorldResource]</cs>
<ck>defaultPerson</ck> = you
- <ck>message</ck> = <cv>$L{localizedMessage,$P{person,$C{HelloWorldResource/defaultPerson}}}</cv>
+ <ck>message</ck> = <cv>$L{localizedMessage,$R{query.person,$C{HelloWorldResource/defaultPerson}}}</cv>
</p>
<p class='bcode'>
<cc>#-------------------------------------------</cc>
@@ -3189,7 +3168,7 @@
<div class='topic'>
<p>
Certain methods in the REST server API allow you to specify class types that can be convertable
- from <l>Strings</l> (e.g. {@link org.apache.juneau.server.RestRequest#getAttribute(String,Class)}).
+ from <l>Strings</l> (e.g. {@link org.apache.juneau.server.RestRequest#getPathParameter(String,Class)}).
</p>
<p>
POJOs convertable from <l>Strings</l> have one of the following:
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/LocalizationVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/LocalizationVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/LocalizationVar.java
index 200d7db..5369e3a 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/LocalizationVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/LocalizationVar.java
@@ -43,7 +43,7 @@ public class LocalizationVar extends MultipartVar {
super("L");
}
- @Override /* Var */
+ @Override /* Parameter */
public String resolve(VarResolverSession session, String[] args) {
if (args.length > 0) {
String key = args[0];
[3/8] incubator-juneau git commit: Doc updates.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/RestGuard.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/RestGuard.java b/juneau-server/src/main/java/org/apache/juneau/server/RestGuard.java
index 6dfb01a..150e568 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/RestGuard.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/RestGuard.java
@@ -42,7 +42,7 @@ import org.apache.juneau.server.annotation.*;
* Guards must implement a no-args constructor.
*
*
- * <h6 class='topic'>Example usage</h6>
+ * <h6 class='topic'>Example usage:</h6>
* <p class='bcode'>
* <jk>public</jk> MyResource <jk>extends</jk> RestServlet {
*
@@ -53,7 +53,7 @@ import org.apache.juneau.server.annotation.*;
* </p>
*
*
- * <h6 class='topic'>Example implementation</h6>
+ * <h6 class='topic'>Example implementation:</h6>
* <p class='bcode'>
* <jc>// Define a guard that only lets Billy make a request</jc>
* <jk>public</jk> BillyGuard <jk>extends</jk> RestGuard {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/RestMatcher.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/RestMatcher.java b/juneau-server/src/main/java/org/apache/juneau/server/RestMatcher.java
index bd2805c..8e5407c 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/RestMatcher.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/RestMatcher.java
@@ -30,7 +30,7 @@ import org.apache.juneau.server.annotation.*;
* This is opposite from the {@link RestMethod#guards()} annotation, where all guards
* are required to match in order to execute the method.
*
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jk>public class</jk> MyResource <jk>extends</jk> RestServlet {
*
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/RestRequest.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/RestRequest.java b/juneau-server/src/main/java/org/apache/juneau/server/RestRequest.java
index dbeaafc..f14cb37 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/RestRequest.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/RestRequest.java
@@ -80,7 +80,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
private BeanContext beanContext;
private VarResolverSession varSession;
private Map<String,String[]> queryParams;
- private Map<String,String> defaultServletHeaders, defaultMethodHeaders, overriddenHeaders, overriddenParams;
+ private Map<String,String> defaultServletHeaders, defaultMethodHeaders, overriddenHeaders, overriddenQueryParams, overriddenFormDataParams, pathParameters;
private boolean isPost;
private String servletURI, relativeServletURI;
private String charset, defaultCharset;
@@ -149,19 +149,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Returns <jk>true</jk> if the request contains any of the specified parameters.
- *
- * @param params The list of parameters to check for.
- * @return <jk>true</jk> if the request contains any of the specified parameters.
- */
- public boolean hasAnyQueryParameters(String...params) {
- for (String p : params)
- if (hasQueryParameter(p))
- return true;
- return false;
- }
-
- /**
* Returns a string of the form <js>"HTTP method-name full-url"</js>
*
* @return A description of the request.
@@ -171,6 +158,10 @@ public final class RestRequest extends HttpServletRequestWrapper {
return "HTTP " + getMethod() + " " + getRequestURI() + (qs == null ? "" : "?" + qs);
}
+ //--------------------------------------------------------------------------------
+ // Properties
+ //--------------------------------------------------------------------------------
+
/**
* Servlet calls this method to initialize the properties.
*/
@@ -181,7 +172,8 @@ public final class RestRequest extends HttpServletRequestWrapper {
/**
* Retrieve the properties active for this request.
- * These properties can be modified by the request.
+ * <p>
+ * These properties can be modified by the request.
*
* @return The properties active for this request.
*/
@@ -189,75 +181,25 @@ public final class RestRequest extends HttpServletRequestWrapper {
return this.properties;
}
- /**
- * Returns the <code>Content-Type</code> header value on the request, stripped
- * of any parameters such as <js>";charset=X"</js>.
- * <p>
- * Example: <js>"text/json"</js>.
- * <p>
- * If the content type is not specified, and the content is specified via a
- * <code>&content</code> query parameter, the content type is assumed to be
- * <js>"text/uon"</js>. Otherwise, the
- * content type is assumed to be <js>"text/json"</js>.
- *
- * @return The <code>Accept</code> media-type header values on the request.
- */
- public String getMediaType() {
- String cm = getHeader("Content-Type");
- if (cm == null) {
- if (body != null)
- return "text/uon";
- return "text/json";
- }
- int j = cm.indexOf(';');
- if (j != -1)
- cm = cm.substring(0, j);
- return cm;
- }
+ //--------------------------------------------------------------------------------
+ // Headers
+ //--------------------------------------------------------------------------------
/**
- * Returns the media types that are valid for <code>Content-Type</code> headers on the request.
+ * Sets a request header value.
*
- * @return The set of media types registered in the parser group of this request.
- */
- public List<String> getSupportedMediaTypes() {
- return parserGroup.getSupportedMediaTypes();
- }
-
- /**
- * Returns the charset specified on the <code>Content-Type</code> header, or
- * <js>"UTF-8"</js> if not specified.
+ * @param name The header name.
+ * @param value The header value.
*/
- @Override /* ServletRequest */
- public String getCharacterEncoding() {
- if (charset == null) {
- // Determine charset
- // NOTE: Don't use super.getCharacterEncoding() because the spec is implemented inconsistently.
- // Jetty returns the default charset instead of null if the character is not specified on the request.
- String h = getHeader("Content-Type");
- if (h != null) {
- int i = h.indexOf(";charset=");
- if (i > 0)
- charset = h.substring(i+9).trim();
- }
- if (charset == null)
- charset = defaultCharset;
- if (! RestServlet.availableCharsets.containsKey(charset))
- throw new RestException(SC_UNSUPPORTED_MEDIA_TYPE, "Unsupported charset in header ''Content-Type'': ''{0}''", h);
- }
- return charset;
+ public void setHeader(String name, String value) {
+ if (overriddenHeaders == null)
+ overriddenHeaders = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
+ overriddenHeaders.put(name, value);
}
- /**
- * Sets the charset to expect on the request body.
- */
- @Override /* ServletRequest */
- public void setCharacterEncoding(String charset) {
- this.charset = charset;
- }
/**
- * Returns the specified header value, or <jk>null</jk> if the header value isn't present.
+ * Returns the specified header value, or <jk>null</jk> if the header doesn't exist.
* <p>
* If {@code allowHeaderParams} init parameter is <jk>true</jk>, then first looks
* for {@code &HeaderName=x} in the URL query string.
@@ -268,50 +210,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Returns all the request headers as an {@link ObjectMap}.
- * <p>
- * Altering entries in this map does not alter headers in the underlying request.
- *
- * @return The request headers. Never <jk>null</jk>.
- */
- public ObjectMap getHeaders() {
- if (headers == null) {
- headers = new ObjectMap();
- for (Enumeration<String> e = getHeaderNames(); e.hasMoreElements();) {
- String key = e.nextElement();
- headers.put(key, getHeader(key));
- }
- }
- return headers;
- }
-
- /**
- * Set the request header to the specified value.
- *
- * @param name The header name.
- * @param value The header value.
- */
- public void setHeader(String name, String value) {
- if (overriddenHeaders == null)
- overriddenHeaders = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
- overriddenHeaders.put(name, value);
- }
-
- /**
- * Set the request parameter to the specified value.
- *
- * @param name The parameter name.
- * @param value The parameter value.
- */
- public void setParameter(String name, Object value) {
- if (overriddenParams == null)
- overriddenParams = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
- overriddenParams.put(name, value == null ? null : value.toString());
- }
-
- /**
- * Returns the specified header value, or the specified default value if the
- * header value isn't present.
+ * Returns the specified header value, or a default value if the header doesn't exist.
* <p>
* If {@code allowHeaderParams} init parameter is <jk>true</jk>, then first looks
* for {@code &HeaderName=x} in the URL query string.
@@ -338,343 +237,191 @@ public final class RestRequest extends HttpServletRequestWrapper {
return def;
}
- @Override /* ServletRequest */
- public Enumeration<String> getHeaders(String name) {
- String h = getOverriddenHeader(name);
- if (h != null)
- return enumeration(singleton(h));
- return super.getHeaders(name);
- }
-
- /*
- * Returns header value from URL-parameters or set via setHeader() meant
- * to override actual header values on the request.
- */
- private String getOverriddenHeader(String name) {
- String h = null;
- if (servlet.context.allowHeaderParams)
- h = getQueryParameter(name);
- if (h != null)
- return h;
- if (overriddenHeaders != null) {
- h = overriddenHeaders.get(name);
- if (h != null)
- return h;
- }
- return h;
- }
-
- @Override /* ServletRequest */
- public Locale getLocale() {
- String h = getOverriddenHeader("Accept-Language");
- if (h != null) {
- MediaRange[] mr = MediaRange.parse(h);
- if (mr.length > 0)
- return toLocale(mr[0].getType());
- }
- return super.getLocale();
- }
-
- @Override /* ServletRequest */
- public Enumeration<Locale> getLocales() {
- String h = getOverriddenHeader("Accept-Language");
- if (h != null) {
- MediaRange[] mr = MediaRange.parse(h);
- if (mr.length > 0) {
- List<Locale> l = new ArrayList<Locale>(mr.length);
- for (MediaRange r : mr)
- l.add(toLocale(r.getType()));
- return enumeration(l);
- }
- }
- return super.getLocales();
- }
-
- /**
- * Converts an Accept-Header value entry to a Locale.
- */
- private Locale toLocale(String lang) {
- String country = "";
- int i = lang.indexOf('-');
- if (i > -1) {
- country = lang.substring(i+1).trim();
- lang = lang.substring(0,i).trim();
- }
- return new Locale(lang, country);
- }
-
- /**
- * Returns the serializers associated with this request.
- *
- * @return The serializers associated with this request.
- */
- public SerializerGroup getSerializerGroup() {
- return serializerGroup;
- }
-
/**
- * Returns the parsers associated with this request.
- *
- * @return The parsers associated with this request.
- */
- public ParserGroup getParserGroup() {
- return parserGroup;
- }
-
- /**
- * Returns the method of this request.
+ * Returns the specified header value converted to a POJO.
* <p>
- * If <code>allowHeaderParams</code> init parameter is <jk>true</jk>, then first looks
- * for <code>&method=xxx</code> in the URL query string.
- */
- @Override /* ServletRequest */
- public String getMethod() {
- return method;
- }
-
- /**
- * Returns the parameter with the specified name.
- * <p>
- * Returns <jk>null</jk> for parameters with no value (e.g. <js>"&foo"</js>).
- * This is consistent with WAS, but differs from Tomcat behavior.
- * The presence of parameter <js>"&foo"</js> in this case can be determined using {@link #hasParameter(String)}.
- * <p>
- * Parameter lookup is case-insensitive (consistent with WAS, but differs from Tomcat).
- * <p>
- * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
- * the underlying servlet API.
- * <p>
- * <i>Note:</i> This method returns the raw unparsed value, and differs from calling <code>getParameter(name, String.<jk>class</js>)</code>
- * which will convert the value from UON notation:
- * <ul>
- * <li><js>"\u0000"</js> => <jk>null</jk>
- * <li><js>"$s(foo)"</js> => <js>"foo"</js>
- * <li><js>"(foo)"</js> => <js>"foo"</js>
- * </ul>
- */
- @Override /* ServletRequest */
- public String getParameter(String name) {
- String s = null;
- if (overriddenParams != null)
- s = overriddenParams.get(name);
- if (s != null)
- return s;
-
- String val = super.getParameter(name);
-
- // Fix for behavior difference between Tomcat and WAS.
- // getParameter("foo") on "&foo" in Tomcat returns "".
- // getParameter("foo") on "&foo" in WAS returns null.
- if (val != null && val.isEmpty())
- if (queryParams.containsKey(name))
- val = null;
-
- return val;
- }
-
- /**
- * Same as {@link #getParameter(String)} except returns the default value
- * if <jk>null</jk> or empty.
+ * The type can be any POJO type convertable from a <code>String</code> (See <a class='doclink' href='package-summary.html#PojosConvertableFromString'>POJOs Convertable From Strings</a>).
*
- * @param name The query parameter name.
- * @param def The default value.
- * @return The parameter value, or the default value if <jk>null</jk> or empty.
+ * @param name The HTTP header name.
+ * @param c The class type to convert the header value to.
+ * @param def The default value if the header was not specified or is <jk>null</jk>.
+ * @param <T> The class type to convert the header value to.
+ * @return The parameter value converted to the specified class type.
*/
- public String getParameter(String name, String def) {
- String val = getParameter(name);
- if (val == null || val.isEmpty())
+ public <T> T getHeader(String name, Class<T> c, T def) {
+ String h = getHeader(name);
+ if (h == null)
return def;
- return val;
+ return beanContext.convertToType(h, c);
}
/**
- * Returns the specified URL parameter value parsed to the specified class type using the
- * {@link UrlEncodingParser} registered with this servlet.
+ * Returns the specified header value converted to a POJO.
* <p>
- * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
- * the underlying servlet API.
+ * The type can be any POJO type convertable from a <code>String</code> (See <a class='doclink' href='package-summary.html#PojosConvertableFromString'>POJOs Convertable From Strings</a>).
*
- * @param name The parameter name.
- * @param c The class type to convert the parameter value to.
- * @param def The default value if the parameter was not specified or is <jk>null</jk>.
- * @param <T> The class type to convert the parameter value to.
+ * @param name The HTTP header name.
+ * @param c The class type to convert the header value to.
+ * @param <T> The class type to convert the header value to.
* @return The parameter value converted to the specified class type.
- * @throws ParseException
*/
- public <T> T getParameter(String name, Class<T> c, T def) throws ParseException {
- return getParameter(name, beanContext.getClassMeta(c), def);
+ public <T> T getHeader(String name, Class<T> c) {
+ String h = getHeader(name);
+ return beanContext.convertToType(h, c);
}
/**
- * Returns the specified URL parameter value parsed to the specified class type using the
- * {@link UrlEncodingParser} registered with this servlet.
- * <p>
- * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
- * the underlying servlet API.
- * <p>
- * Unlike {@link #getParameter(String, Class, Object)}, this method can be used to parse parameters
- * of complex types involving JCF classes.
- * <p class='bcode'>
- * ClassMeta<Map<String,Integer>> cm = request.getBeanContext().getMapClassMeta(TreeMap.<jk>class</jk>, String.<jk>class</jk>, Integer.<jk>class</jk>);
- * Map<String,Integer> m = request.getParameter(<js>"myParameter"</js>, cm, <jk>new</jk> TreeMap<String,Integer>());
- * </p>
+ * Same as {@link #getHeader(String, Class)} except works on parameterized
+ * types such as those returned by {@link Method#getGenericParameterTypes()}
*
- * @param name The parameter name.
- * @param cm The class type to convert the parameter value to.
- * @param def The default value if the parameter was not specified or is <jk>null</jk>.
- * @param <T> The class type to convert the parameter value to.
+ * @param name The HTTP header name.
+ * @param c The class type to convert the header value to.
+ * @param <T> The class type to convert the header value to.
* @return The parameter value converted to the specified class type.
- * @throws ParseException
*/
- public <T> T getParameter(String name, ClassMeta<T> cm, T def) throws ParseException {
- String val = getParameter(name);
- if (val == null)
- return def;
- return parseParameter(val, cm);
+ public <T> T getHeader(String name, Type c) {
+ String h = getHeader(name);
+ return (T)beanContext.convertToType(null, h, beanContext.getClassMeta(c));
}
/**
- * Returns the specified URL parameter value parsed to the specified class type using the
- * {@link UrlEncodingParser} registered with this servlet.
+ * Returns all the request headers as an {@link ObjectMap}.
* <p>
- * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
- * the underlying servlet API.
+ * Altering entries in this map does not alter headers in the underlying request.
*
- * @param name The parameter name.
- * @param c The class type to convert the parameter value to.
- * @param <T> The class type to convert the parameter value to.
- * @return The parameter value converted to the specified class type.
- * @throws ParseException
+ * @return The request headers. Never <jk>null</jk>.
*/
- public <T> T getParameter(String name, Class<T> c) throws ParseException {
- return getParameter(name, beanContext.getClassMeta(c));
+ public ObjectMap getHeaders() {
+ if (headers == null) {
+ headers = new ObjectMap();
+ for (Enumeration<String> e = getHeaderNames(); e.hasMoreElements();) {
+ String key = e.nextElement();
+ headers.put(key, getHeader(key));
+ }
+ }
+ return headers;
+ }
+
+ @Override /* ServletRequest */
+ public Enumeration<String> getHeaders(String name) {
+ String h = getOverriddenHeader(name);
+ if (h != null)
+ return enumeration(singleton(h));
+ return super.getHeaders(name);
}
/**
- * Same as {@link #getParameter(String, Class)} except for use on multi-part parameters
- * (e.g. <js>"&key=1&key=2&key=3"</js> instead of <js>"&key=(1,2,3)"</js>)
+ * Returns the <code>Content-Type</code> header value on the request, stripped
+ * of any parameters such as <js>";charset=X"</js>.
* <p>
- * This method must only be called when parsing into classes of type Collection or array.
+ * Example: <js>"text/json"</js>.
+ * <p>
+ * If the content type is not specified, and the content is specified via a
+ * <code>&body</code> query parameter, the content type is assumed to be
+ * <js>"text/uon"</js>. Otherwise, the content type is assumed to be <js>"text/json"</js>.
*
- * @param name The parameter name.
- * @param c The class type to convert the parameter value to.
- * @return The parameter value converted to the specified class type.
- * @throws ParseException
+ * @return The <code>Accept</code> media-type header value on the request.
*/
- public <T> T getParameters(String name, Class<T> c) throws ParseException {
- return getParameters(name, beanContext.getClassMeta(c));
+ public String getMediaType() {
+ String cm = getHeader("Content-Type");
+ if (cm == null) {
+ if (body != null)
+ return "text/uon";
+ return "text/json";
+ }
+ int j = cm.indexOf(';');
+ if (j != -1)
+ cm = cm.substring(0, j);
+ return cm;
}
/**
- * Same as {@link #getParameter(String, Class)} except works on parameterized
- * types such as those returned by {@link Method#getGenericParameterTypes()}
+ * Returns the media types that are valid for <code>Content-Type</code> headers on the request.
*
- * @param name The parameter name.
- * @param c The class type to convert the parameter value to.
- * @return The parameter value converted to the specified class type.
- * @throws ParseException
+ * @return The set of media types registered in the parser group of this request.
*/
- public <T> T getParameter(String name, Type c) throws ParseException {
- return (T)getParameter(name, beanContext.getClassMeta(c));
+ public List<String> getSupportedMediaTypes() {
+ return parserGroup.getSupportedMediaTypes();
}
/**
- * Same as {@link #getParameter(String, Class)} except for use on multi-part parameters
- * (e.g. <js>"&key=1&key=2&key=3"</js> instead of <js>"&key=(1,2,3)"</js>)
- * <p>
- * This method must only be called when parsing into classes of type Collection or array.
- *
- * @param name The parameter name.
- * @param c The class type to convert the parameter value to.
- * @return The parameter value converted to the specified class type.
- * @throws ParseException
+ * Sets the charset to expect on the request body.
*/
- public <T> T getParameters(String name, Type c) throws ParseException {
- return (T)getParameters(name, beanContext.getClassMeta(c));
+ @Override /* ServletRequest */
+ public void setCharacterEncoding(String charset) {
+ this.charset = charset;
}
/**
- * Returns the specified URL parameter value parsed to the specified class type using the
- * {@link UrlEncodingParser} registered with this servlet.
- * <p>
- * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
- * the underlying servlet API.
- * <p>
- * Unlike {@link #getParameter(String, Class)}, this method can be used to parse parameters
- * of complex types involving JCF classes.
- * <p class='bcode'>
- * ClassMeta<Map<String,Integer>> cm = request.getBeanContext().getMapClassMeta(TreeMap.<jk>class</jk>, String.<jk>class</jk>, Integer.<jk>class</jk>);
- * Map<String,Integer> m = request.getParameter(<js>"myParameter"</js>, cm);
- * </p>
- *
- * @param name The parameter name.
- * @param cm The class type to convert the parameter value to.
- * @param <T> The class type to convert the parameter value to.
- * @return The parameter value converted to the specified class type.
- * @throws ParseException
+ * Returns the charset specified on the <code>Content-Type</code> header, or
+ * <js>"UTF-8"</js> if not specified.
*/
- public <T> T getParameter(String name, ClassMeta<T> cm) throws ParseException {
-
- String val = getParameter(name);
-
- if (cm.isPrimitive() && (val == null || val.isEmpty()))
- return cm.getPrimitiveDefault();
+ @Override /* ServletRequest */
+ public String getCharacterEncoding() {
+ if (charset == null) {
+ // Determine charset
+ // NOTE: Don't use super.getCharacterEncoding() because the spec is implemented inconsistently.
+ // Jetty returns the default charset instead of null if the character is not specified on the request.
+ String h = getHeader("Content-Type");
+ if (h != null) {
+ int i = h.indexOf(";charset=");
+ if (i > 0)
+ charset = h.substring(i+9).trim();
+ }
+ if (charset == null)
+ charset = defaultCharset;
+ if (! RestServlet.availableCharsets.containsKey(charset))
+ throw new RestException(SC_UNSUPPORTED_MEDIA_TYPE, "Unsupported charset in header ''Content-Type'': ''{0}''", h);
+ }
+ return charset;
+ }
- return parseParameter(val, cm);
+ @Override /* ServletRequest */
+ public Locale getLocale() {
+ String h = getOverriddenHeader("Accept-Language");
+ if (h != null) {
+ MediaRange[] mr = MediaRange.parse(h);
+ if (mr.length > 0)
+ return toLocale(mr[0].getType());
+ }
+ return super.getLocale();
}
- /**
- * Same as {@link #getParameter(String, ClassMeta)} except for use on multi-part parameters
- * (e.g. <js>"&key=1&key=2&key=3"</js> instead of <js>"&key=(1,2,3)"</js>)
- * <p>
- * This method must only be called when parsing into classes of type Collection or array.
- *
- * @param name The parameter name.
- * @param cm The class type to convert the parameter value to.
- * @param <T> The class type to convert the parameter value to.
- * @return The parameter value converted to the specified class type.
- * @throws ParseException
- */
- @SuppressWarnings("rawtypes")
- public <T> T getParameters(String name, ClassMeta<T> cm) throws ParseException {
- String[] p = getParameterValues(name);
- if (p == null)
- return null;
- if (cm.isArray()) {
- List c = new ArrayList();
- for (int i = 0; i < p.length; i++)
- c.add(parseParameter(p[i], cm.getElementType()));
- return (T)ArrayUtils.toArray(c, cm.getElementType().getInnerClass());
- } else if (cm.isCollection()) {
- try {
- Collection c = (Collection)(cm.canCreateNewInstance() ? cm.newInstance() : new ObjectList());
- for (int i = 0; i < p.length; i++)
- c.add(parseParameter(p[i], cm.getElementType()));
- return (T)c;
- } catch (ParseException e) {
- throw e;
- } catch (Exception e) {
- // Typically an instantiation exception.
- throw new ParseException(e);
+ @Override /* ServletRequest */
+ public Enumeration<Locale> getLocales() {
+ String h = getOverriddenHeader("Accept-Language");
+ if (h != null) {
+ MediaRange[] mr = MediaRange.parse(h);
+ if (mr.length > 0) {
+ List<Locale> l = new ArrayList<Locale>(mr.length);
+ for (MediaRange r : mr)
+ l.add(toLocale(r.getType()));
+ return enumeration(l);
}
}
- throw new ParseException("Invalid call to getParameters(String, ClassMeta). Class type must be a Collection or array.");
+ return super.getLocales();
}
+ //--------------------------------------------------------------------------------
+ // Query parameters
+ //--------------------------------------------------------------------------------
+
/**
- * Returns <jk>true</jk> if the URL parameters on this request contains the specified entry.
- * <p>
- * Note that this returns <jk>true</jk> even if the value is set to null (e.g. <js>"?key"</js>).
+ * Sets a request query parameter value.
*
- * @param name The URL parameter name.
- * @return <jk>true</jk> if the URL parameters on this request contains the specified entry.
+ * @param name The parameter name.
+ * @param value The parameter value.
*/
- public boolean hasParameter(String name) {
- return getParameterMap().containsKey(name);
+ public void setQueryParameter(String name, Object value) {
+ if (overriddenQueryParams == null)
+ overriddenQueryParams = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
+ overriddenQueryParams.put(name, value == null ? null : value.toString());
}
/**
- * Same as {@link #getParameter(String)} except only looks in the URL string,
+ * Returns a query parameter value.
+ * <p>
+ * Same as {@link #getParameter(String)} except only looks in the URL string,
* not parameters from URL-Encoded FORM posts.
* <p>
* This method can be used to retrieve a parameter without triggering the underlying
@@ -685,8 +432,8 @@ public final class RestRequest extends HttpServletRequestWrapper {
*/
public String getQueryParameter(String name) {
String s = null;
- if (overriddenParams != null)
- s = overriddenParams.get(name);
+ if (overriddenQueryParams != null)
+ s = overriddenQueryParams.get(name);
if (s != null)
return s;
String[] v = queryParams.get(name);
@@ -699,7 +446,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
if (queryParams.containsKey(name))
return null;
}
-
return v[0];
}
@@ -717,8 +463,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Same as {@link #getParameter(String, Class, Object)} except only looks in the URL string,
- * not parameters from URL-Encoded FORM posts.
+ * Returns the specified query parameter value converted to a POJO.
* <p>
* This method can be used to retrieve a parameter without triggering the underlying
* servlet API to load and parse the request body.
@@ -735,8 +480,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Same as {@link #getParameter(String, ClassMeta, Object)} except only looks in the URL string,
- * not parameters from URL-Encoded FORM posts.
+ * Returns the specified query parameter value converted to a POJO.
* <p>
* This method can be used to retrieve a parameter without triggering the underlying
* servlet API to load and parse the request body.
@@ -756,8 +500,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Same as {@link #getParameter(String, ClassMeta, Object)} except only looks in the URL string,
- * not parameters from URL-Encoded FORM posts.
+ * Returns the specified query parameter value converted to a POJO.
* <p>
* This method can be used to retrieve a parameter without triggering the underlying
* servlet API to load and parse the request body.
@@ -819,10 +562,9 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Same as {@link #getParameter(String, ClassMeta)} except only looks in the URL string,
- * not parameters from URL-Encoded FORM posts.
+ * Returns the specified query parameter value converted to a POJO.
* <p>
- * This method can be used to retrieve a parameter without triggering the underlying
+ * This method can be used to retrieve a parameter without triggering the underlying
* servlet API to load and parse the request body.
*
* @param name The parameter name.
@@ -880,10 +622,11 @@ public final class RestRequest extends HttpServletRequestWrapper {
/**
* Returns the list of all query parameters with the specified name.
- * Same as {@link #getParameterValues(String)} except only looks in the URL string,
+ * <p>
+ * Same as {@link #getParameterValues(String)} except only looks in the URL string,
* not parameters from URL-Encoded FORM posts.
* <p>
- * This method can be used to retrieve parameters without triggering the underlying
+ * This method can be used to retrieve parameters without triggering the underlying
* servlet API to load and parse the request body.
*
* @param name
@@ -894,11 +637,11 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Returns <jk>true</jk> if the URL parameters on this request contains the specified entry.
+ * Returns <jk>true</jk> if the query parameters on this request contains the specified entry.
* <p>
- * Note that this returns <jk>true</jk> even if the value is set to null (e.g. <js>"?key"</js>).
+ * Note that this returns <jk>true</jk> even if the value is set to null (e.g. <js>"?key"</js>).
* <p>
- * This method can be used to check the existence of a parameter without triggering the underlying
+ * This method can be used to check the existence of a parameter without triggering the underlying
* servlet API to load and parse the request body.
*
* @param name The URL parameter name.
@@ -909,12 +652,25 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
+ * Returns <jk>true</jk> if the request contains any of the specified query parameters.
+ *
+ * @param params The list of parameters to check for.
+ * @return <jk>true</jk> if the request contains any of the specified query parameters.
+ */
+ public boolean hasAnyQueryParameters(String...params) {
+ for (String p : params)
+ if (hasQueryParameter(p))
+ return true;
+ return false;
+ }
+
+ /**
* Equivalent to {@link #getParameterMap()}, but only looks for query parameters in the URL, not form posts.
* <p>
- * This method can be used to retrieve query parameters without triggering the underlying
+ * This method can be used to retrieve query parameters without triggering the underlying
* servlet API to load and parse the request body.
* <p>
- * This object is modifiable.
+ * This object is modifiable.
*
* @return The query parameters as a modifiable map.
*/
@@ -925,10 +681,10 @@ public final class RestRequest extends HttpServletRequestWrapper {
/**
* Equivalent to {@link #getParameterNames()}, but only looks for query parameters in the URL, not form posts.
* <p>
- * This method can be used to retrieve query parameters without triggering the underlying
+ * This method can be used to retrieve query parameters without triggering the underlying
* servlet API to load and parse the request body.
* <p>
- * This object is modifiable.
+ * This object is modifiable.
*
* @return An iterator of query parameter names.
*/
@@ -936,68 +692,283 @@ public final class RestRequest extends HttpServletRequestWrapper {
return queryParams.keySet().iterator();
}
- private <T> T parseParameter(String val, ClassMeta<T> c) throws ParseException {
+ //--------------------------------------------------------------------------------
+ // Form data parameters
+ //--------------------------------------------------------------------------------
+
+ /**
+ * Sets a request form data parameter value.
+ *
+ * @param name The parameter name.
+ * @param value The parameter value.
+ */
+ public void setFormDataParameter(String name, Object value) {
+ if (overriddenFormDataParams == null)
+ overriddenFormDataParams = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
+ overriddenFormDataParams.put(name, value == null ? null : value.toString());
+ }
+
+ /**
+ * Returns a form data parameter value.
+ * <p>
+ * Parameter lookup is case-insensitive (consistent with WAS, but differs from Tomcat).
+ * <p>
+ * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
+ * the underlying servlet API.
+ * <p>
+ * <i>Note:</i> This method returns the raw unparsed value, and differs from calling <code>getFormDataParameter(name, String.<jk>class</js>)</code>
+ * which will convert the value from UON notation:
+ * <ul>
+ * <li><js>"\u0000"</js> => <jk>null</jk>
+ * <li><js>"$s(foo)"</js> => <js>"foo"</js>
+ * <li><js>"(foo)"</js> => <js>"foo"</js>
+ * </ul>
+ *
+ * @param name The form data parameter name.
+ * @return The parameter value, or <jk>null</jk> if parameter does not exist.
+ */
+ public String getFormDataParameter(String name) {
+ String s = null;
+ if (overriddenFormDataParams != null)
+ s = overriddenFormDataParams.get(name);
+ if (s != null)
+ return s;
+
+ return super.getParameter(name);
+ }
+
+ /**
+ * Same as {@link #getFormDataParameter(String)} except returns a default value if <jk>null</jk> or empty.
+ *
+ * @param name The form data parameter name.
+ * @param def The default value.
+ * @return The parameter value, or the default value if <jk>null</jk> or empty.
+ */
+ public String getFormDataParameter(String name, String def) {
+ String val = getParameter(name);
+ if (val == null || val.isEmpty())
+ return def;
+ return val;
+ }
+
+ /**
+ * Returns the specified form data parameter value converted to a POJO using the
+ * {@link UrlEncodingParser} registered with this servlet.
+ * <p>
+ * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
+ * the underlying servlet API.
+ *
+ * @param name The parameter name.
+ * @param c The class type to convert the parameter value to.
+ * @param def The default value if the parameter was not specified or is <jk>null</jk>.
+ * @param <T> The class type to convert the parameter value to.
+ * @return The parameter value converted to the specified class type.
+ * @throws ParseException
+ */
+ public <T> T getFormDataParameter(String name, Class<T> c, T def) throws ParseException {
+ return getFormDataParameter(name, beanContext.getClassMeta(c), def);
+ }
+
+ /**
+ * Returns the specified form data parameter value converted to a POJO using the
+ * {@link UrlEncodingParser} registered with this servlet.
+ * <p>
+ * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
+ * the underlying servlet API.
+ * <p>
+ * Unlike {@link #getFormDataParameter(String, Class, Object)}, this method can be used to parse parameters
+ * of complex types involving JCF classes.
+ * <p class='bcode'>
+ * ClassMeta<Map<String,Integer>> cm = request.getBeanContext().getMapClassMeta(TreeMap.<jk>class</jk>, String.<jk>class</jk>, Integer.<jk>class</jk>);
+ * Map<String,Integer> m = request.getFormDataParameter(<js>"myParameter"</js>, cm, <jk>new</jk> TreeMap<String,Integer>());
+ * </p>
+ *
+ * @param name The parameter name.
+ * @param cm The class type to convert the parameter value to.
+ * @param def The default value if the parameter was not specified or is <jk>null</jk>.
+ * @param <T> The class type to convert the parameter value to.
+ * @return The parameter value converted to the specified class type.
+ * @throws ParseException
+ */
+ public <T> T getFormDataParameter(String name, ClassMeta<T> cm, T def) throws ParseException {
+ String val = getParameter(name);
if (val == null)
+ return def;
+ return parseParameter(val, cm);
+ }
+
+ /**
+ * Returns the specified form data parameter value converted to a POJO using the
+ * {@link UrlEncodingParser} registered with this servlet.
+ * <p>
+ * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
+ * the underlying servlet API.
+ *
+ * @param name The parameter name.
+ * @param c The class type to convert the parameter value to.
+ * @param <T> The class type to convert the parameter value to.
+ * @return The parameter value converted to the specified class type.
+ * @throws ParseException
+ */
+ public <T> T getFormDataParameter(String name, Class<T> c) throws ParseException {
+ return getFormDataParameter(name, beanContext.getClassMeta(c));
+ }
+
+ /**
+ * Same as {@link #getFormDataParameter(String, Class)} except for use on multi-part parameters
+ * (e.g. <js>"key=1&key=2&key=3"</js> instead of <js>"key=(1,2,3)"</js>)
+ * <p>
+ * This method must only be called when parsing into classes of type Collection or array.
+ *
+ * @param name The parameter name.
+ * @param c The class type to convert the parameter value to.
+ * @return The parameter value converted to the specified class type.
+ * @throws ParseException
+ */
+ public <T> T getFormDataParameters(String name, Class<T> c) throws ParseException {
+ return getFormDataParameters(name, beanContext.getClassMeta(c));
+ }
+
+ /**
+ * Same as {@link #getFormDataParameter(String, Class)} except works on parameterized
+ * types such as those returned by {@link Method#getGenericParameterTypes()}
+ *
+ * @param name The parameter name.
+ * @param c The class type to convert the parameter value to.
+ * @return The parameter value converted to the specified class type.
+ * @throws ParseException
+ */
+ public <T> T getFormDataParameter(String name, Type c) throws ParseException {
+ return (T)getFormDataParameter(name, beanContext.getClassMeta(c));
+ }
+
+ /**
+ * Same as {@link #getFormDataParameter(String, Class)} except for use on multi-part parameters
+ * (e.g. <js>"key=1&key=2&key=3"</js> instead of <js>"key=(1,2,3)"</js>)
+ * <p>
+ * This method must only be called when parsing into classes of type Collection or array.
+ *
+ * @param name The parameter name.
+ * @param c The class type to convert the parameter value to.
+ * @return The parameter value converted to the specified class type.
+ * @throws ParseException
+ */
+ public <T> T getFormDataParameters(String name, Type c) throws ParseException {
+ return (T)getFormDataParameters(name, beanContext.getClassMeta(c));
+ }
+
+ /**
+ * Returns the specified form data parameter value converted to a POJO using the
+ * {@link UrlEncodingParser} registered with this servlet.
+ * <p>
+ * <i>Note:</i> Calling this method on URL-Encoded FORM posts causes the body content to be loaded and parsed by
+ * the underlying servlet API.
+ * <p>
+ * Unlike {@link #getFormDataParameter(String, Class)}, this method can be used to parse parameters
+ * of complex types involving JCF classes.
+ * <p class='bcode'>
+ * ClassMeta<Map<String,Integer>> cm = request.getBeanContext().getMapClassMeta(TreeMap.<jk>class</jk>, String.<jk>class</jk>, Integer.<jk>class</jk>);
+ * Map<String,Integer> m = request.getFormDataParameter(<js>"myParameter"</js>, cm);
+ * </p>
+ *
+ * @param name The parameter name.
+ * @param cm The class type to convert the parameter value to.
+ * @param <T> The class type to convert the parameter value to.
+ * @return The parameter value converted to the specified class type.
+ * @throws ParseException
+ */
+ public <T> T getFormDataParameter(String name, ClassMeta<T> cm) throws ParseException {
+
+ String val = getParameter(name);
+
+ if (cm.isPrimitive() && (val == null || val.isEmpty()))
+ return cm.getPrimitiveDefault();
+
+ return parseParameter(val, cm);
+ }
+
+ /**
+ * Same as {@link #getFormDataParameter(String, ClassMeta)} except for use on multi-part parameters
+ * (e.g. <js>"key=1&key=2&key=3"</js> instead of <js>"key=(1,2,3)"</js>)
+ * <p>
+ * This method must only be called when parsing into classes of type Collection or array.
+ *
+ * @param name The parameter name.
+ * @param cm The class type to convert the parameter value to.
+ * @param <T> The class type to convert the parameter value to.
+ * @return The parameter value converted to the specified class type.
+ * @throws ParseException
+ */
+ @SuppressWarnings("rawtypes")
+ public <T> T getFormDataParameters(String name, ClassMeta<T> cm) throws ParseException {
+ String[] p = getParameterValues(name);
+ if (p == null)
return null;
- // Shortcut - If we're returning a string and the value doesn't start with '$' or '(', then
- // just return the string since it's a plain value.
- if (c.getInnerClass() == String.class && val.length() > 0) {
- char x = val.charAt(0);
- if (x != '(' && x != '$' && x != '\u0000' && val.indexOf('~') == -1)
- return (T)val;
+ if (cm.isArray()) {
+ List c = new ArrayList();
+ for (int i = 0; i < p.length; i++)
+ c.add(parseParameter(p[i], cm.getElementType()));
+ return (T)ArrayUtils.toArray(c, cm.getElementType().getInnerClass());
+ } else if (cm.isCollection()) {
+ try {
+ Collection c = (Collection)(cm.canCreateNewInstance() ? cm.newInstance() : new ObjectList());
+ for (int i = 0; i < p.length; i++)
+ c.add(parseParameter(p[i], cm.getElementType()));
+ return (T)c;
+ } catch (ParseException e) {
+ throw e;
+ } catch (Exception e) {
+ // Typically an instantiation exception.
+ throw new ParseException(e);
+ }
}
- return urlEncodingParser.parseParameter(val, c);
+ throw new ParseException("Invalid call to getParameters(String, ClassMeta). Class type must be a Collection or array.");
}
/**
- * Shortcut for calling <code>getHeaders().get(c, name, def);</code>
+ * Returns <jk>true</jk> if the form data parameters on this request contains the specified entry.
* <p>
- * The type can be any POJO type convertable from a <code>String</code> (See <a class='doclink' href='package-summary.html#PojosConvertableFromString'>POJOs Convertable From Strings</a>).
+ * Note that this returns <jk>true</jk> even if the value is set to null (e.g. <js>"?key"</js>).
*
- * @param name The HTTP header name.
- * @param c The class type to convert the header value to.
- * @param def The default value if the header was not specified or is <jk>null</jk>.
- * @param <T> The class type to convert the header value to.
- * @return The parameter value converted to the specified class type.
+ * @param name The URL parameter name.
+ * @return <jk>true</jk> if the URL parameters on this request contains the specified entry.
*/
- public <T> T getHeader(String name, Class<T> c, T def) {
- String h = getHeader(name);
- if (h == null)
- return def;
- return beanContext.convertToType(h, c);
+ public boolean hasFormDataParameter(String name) {
+ return getParameterMap().containsKey(name);
}
+ //--------------------------------------------------------------------------------
+ // Path parameters
+ //--------------------------------------------------------------------------------
+
/**
- * Shortcut for calling <code>getHeaders().get(c, name);</code>
+ * Sets a path parameter value.
* <p>
- * The type can be any POJO type convertable from a <code>String</code> (See <a class='doclink' href='package-summary.html#PojosConvertableFromString'>POJOs Convertable From Strings</a>).
+ * A path parameter is a variable in the path pattern such as <js>"/{foo}"</js>
*
- * @param name The HTTP header name.
- * @param c The class type to convert the header value to.
- * @param <T> The class type to convert the header value to.
- * @return The parameter value converted to the specified class type.
+ * @param name The parameter name.
+ * @param value The parameter value.
*/
- public <T> T getHeader(String name, Class<T> c) {
- String h = getHeader(name);
- return beanContext.convertToType(h, c);
+ public void setPathParameter(String name, String value) {
+ if (pathParameters == null)
+ pathParameters = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
+ pathParameters.put(name, value == null ? null : value.toString());
}
/**
- * Same as {@link #getHeader(String, Class)} except works on parameterized
- * types such as those returned by {@link Method#getGenericParameterTypes()}
+ * Returns a path parameter value.
+ * <p>
+ * A path parameter is a variable in the path pattern such as <js>"/{foo}"</js>
*
- * @param name The HTTP header name.
- * @param c The class type to convert the header value to.
- * @param <T> The class type to convert the header value to.
- * @return The parameter value converted to the specified class type.
+ * @param name The parameter name.
+ * @return The paramter value, or <jk>null</jk> if path parameter not specified.
*/
- public <T> T getHeader(String name, Type c) {
- String h = getHeader(name);
- return (T)beanContext.convertToType(null, h, beanContext.getClassMeta(c));
+ public String getPathParameter(String name) {
+ return (pathParameters == null ? null : pathParameters.get(name));
}
/**
- * Returns the specified request attribute converted to the specified class type.
+ * Returns the specified path parameter converted to a POJO.
* <p>
* The type can be any POJO type convertable from a <code>String</code> (See <a class='doclink' href='package-summary.html#PojosConvertableFromString'>POJOs Convertable From Strings</a>).
*
@@ -1007,12 +978,12 @@ public final class RestRequest extends HttpServletRequestWrapper {
* @return The attribute value converted to the specified class type.
* @throws ParseException
*/
- public <T> T getAttribute(String name, Class<T> c) throws ParseException {
- return getAttribute(name, beanContext.getClassMeta(c));
+ public <T> T getPathParameter(String name, Class<T> c) throws ParseException {
+ return getPathParameter(name, beanContext.getClassMeta(c));
}
/**
- * Same as {@link #getAttribute(String, Class)} except works on parameterized
+ * Same as {@link #getPathParameter(String, Class)} except works on parameterized
* types such as those returned by {@link Method#getGenericParameterTypes()}
*
* @param name The attribute name.
@@ -1021,12 +992,12 @@ public final class RestRequest extends HttpServletRequestWrapper {
* @return The attribute value converted to the specified class type.
* @throws ParseException
*/
- public <T> T getAttribute(String name, Type c) throws ParseException {
- return (T)getAttribute(name, beanContext.getClassMeta(c));
+ public <T> T getPathParameter(String name, Type c) throws ParseException {
+ return (T)getPathParameter(name, beanContext.getClassMeta(c));
}
/**
- * Returns the specified request attribute converted to the specified class type.
+ * Returns the specified path parameter converted to a POJO.
* <p>
* The type can be any POJO type convertable from a <code>String</code> (See <a class='doclink' href='package-summary.html#PojosConvertableFromString'>POJOs Convertable From Strings</a>).
*
@@ -1036,8 +1007,8 @@ public final class RestRequest extends HttpServletRequestWrapper {
* @return The attribute value converted to the specified class type.
* @throws ParseException
*/
- public <T> T getAttribute(String name, ClassMeta<T> cm) throws ParseException {
- Object attr = getAttribute(name);
+ public <T> T getPathParameter(String name, ClassMeta<T> cm) throws ParseException {
+ Object attr = getPathParameter(name);
T t = null;
if (attr != null)
t = urlEncodingParser.parseParameter(attr.toString(), cm);
@@ -1046,42 +1017,9 @@ public final class RestRequest extends HttpServletRequestWrapper {
return t;
}
- /**
- * Same as {@link HttpServletRequest#getPathInfo()} except returns the path undecoded.
- *
- * @return The undecoded portion of the URL after the resource URL path pattern match.
- */
- public String getPathInfoUndecoded() {
- return RestUtils.getPathInfoUndecoded(this);
- }
-
- /**
- * Returns the value {@link #getPathInfo()} split on the <js>'/'</js> character.
- * <p>
- * If path info is <jk>null</jk>, returns an empty list.
- * <p>
- * URL-encoded characters in segments are automatically decoded by this method.
- *
- * @return The decoded segments, or an empty list if path info is <jk>null</jk>.
- */
- public String[] getPathInfoParts() {
- String s = getPathInfoUndecoded();
- if (s == null || s.isEmpty() || s.equals("/"))
- return new String[0];
- s = s.substring(1);
- if (s.endsWith("/"))
- s = s.substring(0, s.length()-1);
- boolean needsDecode = (s.indexOf('%') != -1 || s.indexOf('+') != -1);
- String[] l = s.split("/", Integer.MAX_VALUE);
- try {
- if (needsDecode)
- for (int i = 0; i < l.length; i++)
- l[i] = URLDecoder.decode(l[i], "UTF-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace(); // Won't happen.
- }
- return l;
- }
+ //--------------------------------------------------------------------------------
+ // Body methods
+ //--------------------------------------------------------------------------------
/**
* Same as {@link #getBody(ClassMeta)}, except a shortcut for passing in regular {@link Class} objects
@@ -1110,7 +1048,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Reads the input from the HTTP request as JSON, XML, or HTML and converts the input to the specified class type.
+ * Reads the input from the HTTP request as JSON, XML, or HTML and converts the input to a POJO.
* <p>
* If {@code allowHeaderParams} init parameter is <jk>true</jk>, then first looks
* for {@code &body=xxx} in the URL query string.
@@ -1209,36 +1147,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Returns the parser matching the request <code>Accept</code> header.
- *
- * @return The parser matching the request <code>Accept</code> header, or <jk>null</jk>
- * if no matching parser was found.
- */
- public Parser getParser() {
- String mediaType = getMediaType();
- Parser p = parserGroup.getParser(mediaType);
-
- // If no patching parser for URL-encoding, use the one defined on the servlet.
- if (p == null && mediaType.equals("application/x-www-form-urlencoded"))
- p = urlEncodingParser;
-
- return p;
- }
-
- /**
- * Returns the reader parser matching the request <code>Accept</code> header.
- *
- * @return The reader parser matching the request <code>Accept</code> header, or <jk>null</jk>
- * if no matching reader parser was found, or the matching parser was an input stream parser.
- */
- public ReaderParser getReaderParser() {
- Parser p = getParser();
- if (p.isReaderParser())
- return (ReaderParser)p;
- return null;
- }
-
- /**
* Returns the HTTP body content as a plain string.
* <p>
* If {@code allowHeaderParams} init parameter is true, then first looks
@@ -1255,27 +1163,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
/**
- * Returns a resolved URL.
- * <p>
- * <ul class='spaced-list'>
- * <li>Fully-qualified absolute URLs (e.g. <js>"http://..."</js>, <js>"https://"</js>) are simply converted to a URL.
- * <li>Absolute URLs (e.g. <js>"/foo/..."</js>) are interpreted as relative to the server hostname.
- * <li>Relative URLs (e.g. <js>"foo/..."</js>) are interpreted as relative to this servlet path.
- * </ul>
- *
- * @param path The URL path to resolve.
- * @return The resolved URL.
- * @throws MalformedURLException If path is not a valid URL component.
- */
- public URL getURL(String path) throws MalformedURLException {
- if (path.startsWith("http://") || path.startsWith("https://"))
- return new URL(path);
- if (StringUtils.startsWith(path, '/'))
- return new URL(getScheme(), getLocalName(), getLocalPort(), path);
- return new URL(getScheme(), getLocalName(), getLocalPort(), getContextPath() + getServletPath() + (StringUtils.isEmpty(path) ? "" : ('/' + path)));
- }
-
- /**
* Returns the HTTP body content as a {@link Reader}.
* <p>
* If {@code allowHeaderParams} init parameter is true, then first looks
@@ -1336,46 +1223,76 @@ public final class RestRequest extends HttpServletRequestWrapper {
return is;
}
- private Encoder getEncoder() {
- if (encoder == null) {
- String ce = getHeader("content-encoding");
- if (! (ce == null || ce.isEmpty())) {
- ce = ce.trim();
- encoder = servlet.getEncoders().getEncoder(ce);
- if (encoder == null)
- throw new RestException(SC_UNSUPPORTED_MEDIA_TYPE,
- "Unsupported encoding in request header ''Content-Encoding'': ''{0}''\n\tSupported codings: {1}",
- getHeader("content-encoding"), servlet.getEncoders().getSupportedEncodings()
- );
- }
+ //--------------------------------------------------------------------------------
+ // URI-related methods
+ //--------------------------------------------------------------------------------
- if (encoder != null)
- contentLength = -1;
- }
- // Note that if this is the identity encoder, we want to return null
- // so that we don't needlessly wrap the input stream.
- if (encoder == IdentityEncoder.INSTANCE)
- return null;
- return encoder;
+ /**
+ * Same as {@link HttpServletRequest#getPathInfo()} except returns the path undecoded.
+ *
+ * @return The undecoded portion of the URL after the resource URL path pattern match.
+ */
+ public String getPathInfoUndecoded() {
+ return RestUtils.getPathInfoUndecoded(this);
}
- @Override /* ServletRequest */
- public int getContentLength() {
- return contentLength == 0 ? super.getContentLength() : contentLength;
+ /**
+ * Returns the value {@link #getPathInfo()} split on the <js>'/'</js> character.
+ * <p>
+ * If path info is <jk>null</jk>, returns an empty list.
+ * <p>
+ * URL-encoded characters in segments are automatically decoded by this method.
+ *
+ * @return The decoded segments, or an empty list if path info is <jk>null</jk>.
+ */
+ public String[] getPathInfoParts() {
+ String s = getPathInfoUndecoded();
+ if (s == null || s.isEmpty() || s.equals("/"))
+ return new String[0];
+ s = s.substring(1);
+ if (s.endsWith("/"))
+ s = s.substring(0, s.length()-1);
+ boolean needsDecode = (s.indexOf('%') != -1 || s.indexOf('+') != -1);
+ String[] l = s.split("/", Integer.MAX_VALUE);
+ try {
+ if (needsDecode)
+ for (int i = 0; i < l.length; i++)
+ l[i] = URLDecoder.decode(l[i], "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace(); // Won't happen.
+ }
+ return l;
}
/**
- * Returns <jk>true</jk> if <code>&plainText=true</code> was specified as a URL parameter.
- * <p>
- * This indicates that the <code>Content-Type</code> of the output should always be set to <js>"text/plain"</js>
- * to make it easy to render in a browser.
+ * Returns a resolved URL.
* <p>
- * This feature is useful for debugging.
+ * <ul class='spaced-list'>
+ * <li>Fully-qualified absolute URLs (e.g. <js>"http://..."</js>, <js>"https://"</js>) are simply converted to a URL.
+ * <li>Absolute URLs (e.g. <js>"/foo/..."</js>) are interpreted as relative to the server hostname.
+ * <li>Relative URLs (e.g. <js>"foo/..."</js>) are interpreted as relative to this servlet path.
+ * </ul>
*
- * @return <jk>true</jk> if {@code &plainText=true} was specified as a URL parameter
+ * @param path The URL path to resolve.
+ * @return The resolved URL.
+ * @throws MalformedURLException If path is not a valid URL component.
*/
- public boolean isPlainText() {
- return "true".equals(getQueryParameter("plainText", "false"));
+ public URL getURL(String path) throws MalformedURLException {
+ if (path.startsWith("http://") || path.startsWith("https://"))
+ return new URL(path);
+ if (StringUtils.startsWith(path, '/'))
+ return new URL(getScheme(), getLocalName(), getLocalPort(), path);
+ return new URL(getScheme(), getLocalName(), getLocalPort(), getContextPath() + getServletPath() + (StringUtils.isEmpty(path) ? "" : ('/' + path)));
+ }
+
+ /**
+ * Returns the URI of the parent of this servlet.
+ *
+ * @return The URI of the parent of this servlet.
+ */
+ public String getServletParentURI() {
+ String s = getServletURI();
+ return s.substring(0, s.lastIndexOf('/'));
}
/**
@@ -1418,92 +1335,40 @@ public final class RestRequest extends HttpServletRequestWrapper {
* </tr>
* </table>
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
- * <jc>// REST method</jc>
- * <ja>@RestMethod</ja>(name=<js>"GET"</js>,path=<js>"/foo/{bar}/*"</js>)
- * <jk>public</jk> doGetById(RestServlet res, RestResponse res, <jk>int</jk> bar) {
- * System.<jsm>err</jsm>.println(res.getRemainder());
- * }
- *
- * <jc>// Prints "path/remainder"</jc>
- * <jk>new</jk> RestCall(servletPath + <js>"/foo/123/path/remainder"</js>).connect();
- * </p>
- * </dd>
- * </dl>
- *
- * @return The path remainder string.
- */
- public String getPathRemainder() {
- return RestUtils.decode(pathRemainder);
- }
-
- /**
- * Same as {@link #getPathRemainder()} but doesn't decode characters.
- *
- * @return The undecoded path remainder.
- */
- public String getPathRemainderUndecoded() {
- return pathRemainder;
- }
-
- /**
- * Shortcut method for calling {@link RestServlet#getMessage(Locale, String, Object...)} based
- * on the request locale.
*
- * @param key The message key.
- * @param args Optional {@link MessageFormat} variable values in the value.
- * @return The localized message.
- */
- public String getMessage(String key, Object...args) {
- return servlet.getMessage(getLocale(), key, args);
- }
-
- /**
- * Returns the resource bundle for the request locale.
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
+ * <jc>// REST method</jc>
+ * <ja>@RestMethod</ja>(name=<js>"GET"</js>,path=<js>"/foo/{bar}/*"</js>)
+ * <jk>public</jk> doGetById(RestServlet res, RestResponse res, <jk>int</jk> bar) {
+ * System.<jsm>err</jsm>.println(res.getRemainder());
+ * }
*
- * @return The resource bundle. Never <jk>null</jk>.
- */
- public MessageBundle getResourceBundle() {
- return servlet.getMessages(getLocale());
- }
-
- /**
- * Returns the servlet handling the request.
- * <p>
- * Can be used to access servlet-init parameters or annotations during requests,
- * such as in calls to {@link RestGuard#guard(RestRequest, RestResponse)}..
+ * <jc>// Prints "path/remainder"</jc>
+ * <jk>new</jk> RestCall(servletPath + <js>"/foo/123/path/remainder"</js>).connect();
+ * </p>
*
- * @return The servlet handling the request.
+ * @return The path remainder string.
*/
- public RestServlet getServlet() {
- return servlet;
+ public String getPathRemainder() {
+ return RestUtils.decode(pathRemainder);
}
/**
- * Returns the java method handling the request.
- * <p>
- * Can be used to access the method name or method annotations during requests, such
- * as in calls to {@link RestGuard#guard(RestRequest, RestResponse)}.
- * <p>
- * Note: This returns null when evaluating servlet-level guards since the method
- * has not been resolved at that point of execution.
+ * Same as {@link #getPathRemainder()} but doesn't decode characters.
*
- * @return The Java method handling the request, or <code>null</code> if the method
- * has not yet been resolved.
+ * @return The undecoded path remainder.
*/
- public Method getJavaMethod() {
- return javaMethod;
+ public String getPathRemainderUndecoded() {
+ return pathRemainder;
}
/**
* Returns the URI of the parent resource.
* <p>
- * Trailing slashes in the path are ignored by this method.
+ * Trailing slashes in the path are ignored by this method.
* <p>
- * The behavior is shown below:
+ * The behavior is shown below:
* <table class='styled'>
* <tr>
* <th>getRequestURI</th>
@@ -1600,18 +1465,14 @@ public final class RestRequest extends HttpServletRequestWrapper {
return RestUtils.trimPathInfo(getRequestURL(), getContextPath(), getServletPath());
}
- /**
- * Returns the {@link BeanContext} associated with this request.
- *
- * @return The request bean context.
- */
- public BeanContext getBeanContext() {
- return beanContext;
- }
+ //--------------------------------------------------------------------------------
+ // Labels
+ //--------------------------------------------------------------------------------
/**
* Returns the localized servlet title.
- * Equivalent to calling {@link RestServlet#getTitle(RestRequest)} with this object.
+ * <p>
+ * Equivalent to calling {@link RestServlet#getTitle(RestRequest)} with this object.
*
* @return The localized servlet label.
*/
@@ -1621,7 +1482,8 @@ public final class RestRequest extends HttpServletRequestWrapper {
/**
* Returns the localized servlet description.
- * Equivalent to calling {@link RestServlet#getDescription(RestRequest)} with this object.
+ * <p>
+ * Equivalent to calling {@link RestServlet#getDescription(RestRequest)} with this object.
*
* @return The localized servlet description.
*/
@@ -1631,7 +1493,8 @@ public final class RestRequest extends HttpServletRequestWrapper {
/**
* Returns the localized method summary.
- * Equivalent to calling {@link RestServlet#getMethodSummary(String, RestRequest)} with this object.
+ * <p>
+ * Equivalent to calling {@link RestServlet#getMethodSummary(String, RestRequest)} with this object.
*
* @return The localized method description.
*/
@@ -1641,7 +1504,8 @@ public final class RestRequest extends HttpServletRequestWrapper {
/**
* Returns the localized method description.
- * Equivalent to calling {@link RestServlet#getMethodDescription(String, RestRequest)} with this object.
+ * <p>
+ * Equivalent to calling {@link RestServlet#getMethodDescription(String, RestRequest)} with this object.
*
* @return The localized method description.
*/
@@ -1649,6 +1513,147 @@ public final class RestRequest extends HttpServletRequestWrapper {
return servlet.getMethodDescription(javaMethod.getName(), this);
}
+ //--------------------------------------------------------------------------------
+ // Other methods
+ //--------------------------------------------------------------------------------
+
+ /**
+ * Returns the serializers associated with this request.
+ *
+ * @return The serializers associated with this request.
+ */
+ public SerializerGroup getSerializerGroup() {
+ return serializerGroup;
+ }
+
+ /**
+ * Returns the parsers associated with this request.
+ *
+ * @return The parsers associated with this request.
+ */
+ public ParserGroup getParserGroup() {
+ return parserGroup;
+ }
+
+ /**
+ * Returns the parser matching the request <code>Accept</code> header.
+ *
+ * @return The parser matching the request <code>Accept</code> header, or <jk>null</jk>
+ * if no matching parser was found.
+ */
+ public Parser getParser() {
+ String mediaType = getMediaType();
+ Parser p = parserGroup.getParser(mediaType);
+
+ // If no patching parser for URL-encoding, use the one defined on the servlet.
+ if (p == null && mediaType.equals("application/x-www-form-urlencoded"))
+ p = urlEncodingParser;
+
+ return p;
+ }
+
+ /**
+ * Returns the reader parser matching the request <code>Accept</code> header.
+ *
+ * @return The reader parser matching the request <code>Accept</code> header, or <jk>null</jk>
+ * if no matching reader parser was found, or the matching parser was an input stream parser.
+ */
+ public ReaderParser getReaderParser() {
+ Parser p = getParser();
+ if (p.isReaderParser())
+ return (ReaderParser)p;
+ return null;
+ }
+
+ /**
+ * Returns the method of this request.
+ * <p>
+ * If <code>allowHeaderParams</code> init parameter is <jk>true</jk>, then first looks
+ * for <code>&method=xxx</code> in the URL query string.
+ */
+ @Override /* ServletRequest */
+ public String getMethod() {
+ return method;
+ }
+
+
+ @Override /* ServletRequest */
+ public int getContentLength() {
+ return contentLength == 0 ? super.getContentLength() : contentLength;
+ }
+
+ /**
+ * Returns <jk>true</jk> if <code>&plainText=true</code> was specified as a URL parameter.
+ * <p>
+ * This indicates that the <code>Content-Type</code> of the output should always be set to <js>"text/plain"</js>
+ * to make it easy to render in a browser.
+ * <p>
+ * This feature is useful for debugging.
+ *
+ * @return <jk>true</jk> if {@code &plainText=true} was specified as a URL parameter
+ */
+ public boolean isPlainText() {
+ return "true".equals(getQueryParameter("plainText", "false"));
+ }
+
+ /**
+ * Shortcut method for calling {@link RestServlet#getMessage(Locale, String, Object...)} based
+ * on the request locale.
+ *
+ * @param key The message key.
+ * @param args Optional {@link MessageFormat} variable values in the value.
+ * @return The localized message.
+ */
+ public String getMessage(String key, Object...args) {
+ return servlet.getMessage(getLocale(), key, args);
+ }
+
+ /**
+ * Returns the resource bundle for the request locale.
+ *
+ * @return The resource bundle. Never <jk>null</jk>.
+ */
+ public MessageBundle getResourceBundle() {
+ return servlet.getMessages(getLocale());
+ }
+
+ /**
+ * Returns the servlet handling the request.
+ * <p>
+ * Can be used to access servlet-init parameters or annotations during requests,
+ * such as in calls to {@link RestGuard#guard(RestRequest, RestResponse)}..
+ *
+ * @return The servlet handling the request.
+ */
+ public RestServlet getServlet() {
+ return servlet;
+ }
+
+ /**
+ * Returns the java method handling the request.
+ * <p>
+ * Can be used to access the method name or method annotations during requests, such
+ * as in calls to {@link RestGuard#guard(RestRequest, RestResponse)}.
+ * <p>
+ * Note: This returns null when evaluating servlet-level guards since the method
+ * has not been resolved at that point of execution.
+ *
+ * @return The Java method handling the request, or <code>null</code> if the method
+ * has not yet been resolved.
+ */
+ public Method getJavaMethod() {
+ return javaMethod;
+ }
+
+ /**
+ * Returns the {@link BeanContext} associated with this request.
+ *
+ * @return The request bean context.
+ */
+ public BeanContext getBeanContext() {
+ return beanContext;
+ }
+
/**
* Returns the variable resolver session for this request using session objects created by {@link RestServlet#getSessionObjects(RestRequest)}.
*
@@ -1672,10 +1677,9 @@ public final class RestRequest extends HttpServletRequestWrapper {
/**
* Returns an instance of a {@link ReaderResource} that represents the contents of a resource text file from the classpath.
- * <p>
*
* @param name The name of the resource (i.e. the value normally passed to {@link Class#getResourceAsStream(String)}.
- * @param resolveVars If <jk>true</jk>, any {@link Var} variables will be resolved by the variable resolver returned
+ * @param resolveVars If <jk>true</jk>, any {@link org.apache.juneau.server.annotation.Parameter} variables will be resolved by the variable resolver returned
* by {@link #getVarResolverSession()}.
* @param contentType 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.
@@ -1696,7 +1700,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
* to determine the media type.
*
* @param name The name of the resource (i.e. the value normally passed to {@link Class#getResourceAsStream(String)}.
- * @param resolveVars If <jk>true</jk>, any {@link Var} variables will be resolved by the variable resolver returned
+ * @param resolveVars If <jk>true</jk>, any {@link org.apache.juneau.server.annotation.Parameter} variables will be resolved by the variable resolver returned
* by {@link #getVarResolverSession()}.
* @return A new reader resource, or <jk>null</jk> if resource could not be found.
* @throws IOException
@@ -1741,10 +1745,10 @@ public final class RestRequest extends HttpServletRequestWrapper {
/**
* Returns the localized Swagger from the file system.
* <p>
- * Looks for a file called <js>"{ServletClass}_{locale}.json"</js> in the same package
- * as this servlet and returns it as a parsed {@link Swagger} object.
+ * Looks for a file called <js>"{ServletClass}_{locale}.json"</js> in the same package
+ * as this servlet and returns it as a parsed {@link Swagger} object.
* <p>
- * Returned objects are cached for later quick-lookup.
+ * Returned objects are cached for later quick-lookup.
*
* @return The parsed swagger object, or <jk>null</jk> if the swagger file could not be found.
*/
@@ -1780,13 +1784,74 @@ public final class RestRequest extends HttpServletRequestWrapper {
return sb.toString();
}
- /**
- * Returns the URI of the parent of this servlet.
- *
- * @return The URI of the parent of this servlet.
+ //--------------------------------------------------------------------------------
+ // Utility methods
+ //--------------------------------------------------------------------------------
+
+ private <T> T parseParameter(String val, ClassMeta<T> c) throws ParseException {
+ if (val == null)
+ return null;
+ // Shortcut - If we're returning a string and the value doesn't start with '$' or '(', then
+ // just return the string since it's a plain value.
+ if (c.getInnerClass() == String.class && val.length() > 0) {
+ char x = val.charAt(0);
+ if (x != '(' && x != '$' && x != '\u0000' && val.indexOf('~') == -1)
+ return (T)val;
+ }
+ return urlEncodingParser.parseParameter(val, c);
+ }
+
+ /*
+ * Converts an Accept-Language value entry to a Locale.
*/
- public String getServletParentURI() {
- String s = getServletURI();
- return s.substring(0, s.lastIndexOf('/'));
+ private Locale toLocale(String lang) {
+ String country = "";
+ int i = lang.indexOf('-');
+ if (i > -1) {
+ country = lang.substring(i+1).trim();
+ lang = lang.substring(0,i).trim();
+ }
+ return new Locale(lang, country);
+ }
+
+ private Encoder getEncoder() {
+ if (encoder == null) {
+ String ce = getHeader("content-encoding");
+ if (! (ce == null || ce.isEmpty())) {
+ ce = ce.trim();
+ encoder = servlet.getEncoders().getEncoder(ce);
+ if (encoder == null)
+ throw new RestException(SC_UNSUPPORTED_MEDIA_TYPE,
+ "Unsupported encoding in request header ''Content-Encoding'': ''{0}''\n\tSupported codings: {1}",
+ getHeader("content-encoding"), servlet.getEncoders().getSupportedEncodings()
+ );
+ }
+
+ if (encoder != null)
+ contentLength = -1;
+ }
+ // Note that if this is the identity encoder, we want to return null
+ // so that we don't needlessly wrap the input stream.
+ if (encoder == IdentityEncoder.INSTANCE)
+ return null;
+ return encoder;
+ }
+
+ /*
+ * Returns header value from URL-parameters or set via setHeader() meant
+ * to override actual header values on the request.
+ */
+ private String getOverriddenHeader(String name) {
+ String h = null;
+ if (servlet.context.allowHeaderParams)
+ h = getQueryParameter(name);
+ if (h != null)
+ return h;
+ if (overriddenHeaders != null) {
+ h = overriddenHeaders.get(name);
+ if (h != null)
+ return h;
+ }
+ return h;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/RestResponse.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/RestResponse.java b/juneau-server/src/main/java/org/apache/juneau/server/RestResponse.java
index ffe9ebe..34f5556 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/RestResponse.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/RestResponse.java
@@ -37,7 +37,7 @@ import org.apache.juneau.xml.*;
* convenience methods, or revert to using lower level methods like any other servlet response.
* </p>
*
- * <h6 class='topic'>Examples</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <ja>@RestMethod</ja>(name=<js>"GET"</js>)
* <jk>public void</jk> doGet(RestRequest req, RestResponse res) {
@@ -200,9 +200,7 @@ public final class RestResponse extends HttpServletResponseWrapper {
/**
* Shortcut method that allows you to use varargs to simplify setting array output.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jc>// Instead of...</jc>
* response.setOutput(<jk>new</jk> Object[]{x,y,z});
@@ -210,8 +208,6 @@ public final class RestResponse extends HttpServletResponseWrapper {
* <jc>// ...call this...</jc>
* response.setOutput(x,y,z);
* </p>
- * </dd>
- * </dl>
*
* @param output The output to serialize to the connection.
* @return This object (for method chaining).
[4/8] incubator-juneau git commit: Doc updates.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/xml/annotation/Xml.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/annotation/Xml.java b/juneau-core/src/main/java/org/apache/juneau/xml/annotation/Xml.java
index a2e2008..6f1b536 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/annotation/Xml.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/annotation/Xml.java
@@ -44,39 +44,36 @@ public @interface Xml {
* <p>
* Applies only to collection and array bean properties.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>public class</jk> MyBean {
* <ja>@Xml</ja>(childName=<js>"child"</js>}
* <jk>public</jk> String[] <jf>children</jf> = {<js>"foo"</js>,<js>"bar"</js>};
* }
- * </p>
- * <p>
- * Without the <ja>@Xml</ja> annotation, serializing this bean as XML would have produced the following...
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * Without the <ja>@Xml</ja> annotation, serializing this bean as XML would have produced the following...
+ * </p>
+ * <p class='bcode'>
* <xt><object></xt>
* <xt><children></xt>
* <xt><string></xt>foo<xt></string></xt>
* <xt><string></xt>bar<xt></string></xt>
* <xt></children></xt>
* <xt></object></xt>
- * </p>
- * <p>
- * With the annotations, serializing this bean as XML produces the following...
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * With the annotations, serializing this bean as XML produces the following...
+ * </p>
+ * <p class='bcode'>
* <xt><object></xt>
* <xt><children></xt>
* <xt><child></xt>foo<xt></child></xt>
* <xt><child></xt>bar<xt></child></xt>
* <xt></children></xt>
* <xt></object></xt>
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
String childName() default "";
@@ -106,10 +103,8 @@ public @interface Xml {
/**
* The {@link XmlFormat} to use for serializing this object type.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jk>public class</jk> MyBean {
*
* <jc>// Normally, bean properties would be rendered as child elements of the bean element.</jc>
@@ -128,11 +123,11 @@ public @interface Xml {
* <ja>@Xml</ja>(format=XmlFormat.<jsf>COLLAPSED</jsf>, childName=<js>"child"</js>}
* <jk>public</jk> String[] <jf>children</jf> = <js>"foo"</js>,<js>"bar"</js>};
* }
- * </p>
- * <p>
- * Without the <ja>@Xml</ja> annotations, serializing this bean as XML would have produced the following...
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * Without the <ja>@Xml</ja> annotations, serializing this bean as XML would have produced the following...
+ * </p>
+ * <p class='bcode'>
* <xt><object</xt> <xa>href</xa>=<js>'http://foo'</js><xt>></xt>
* <xt><f1></xt>123<xt></f1></xt>
* <xt><children></xt>
@@ -140,19 +135,17 @@ public @interface Xml {
* <xt><string></xt>bar<xt></string></xt>
* <xt></children></xt>
* <xt></object></xt>
- * </p>
- * <p>
- * With the annotations, serializing this bean as XML produces the following...
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * With the annotations, serializing this bean as XML produces the following...
+ * </p>
+ * <p class='bcode'>
* <xt><object</xt> <xa>f1</xa>=<js>'123'</js><xt>></xt>
* <xt><href></xt>http://foo<xt></href></xt>
* <xt><child></xt>foo<xt></child></xt>
* <xt><child></xt>bar<xt></child></xt>
* <xt></object></xt>
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
XmlFormat format() default XmlFormat.NORMAL;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/java/org/apache/juneau/xml/annotation/XmlSchema.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/annotation/XmlSchema.java b/juneau-core/src/main/java/org/apache/juneau/xml/annotation/XmlSchema.java
index 43859fc..21b1717 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/annotation/XmlSchema.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/annotation/XmlSchema.java
@@ -54,13 +54,11 @@ public @interface XmlSchema {
* <p>
* Inherited by child packages.
*
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p>
- * Contents of <code>package-info.java</code>...
- * </p>
- * <p class='bcode'>
+ * <h6 class='topic'>Example:</h6>
+ * <p>
+ * Contents of <code>package-info.java</code>...
+ * </p>
+ * <p class='bcode'>
* <jc>// XML namespaces used within this package.</jc>
* <ja>@XmlSchema</ja>(prefix=<js>"ab"</js>,
* namespaces={
@@ -72,11 +70,11 @@ public @interface XmlSchema {
* )
* <jk>package</jk> com.ibm.sample.addressbook;
* <jk>import</jk> org.apache.juneau.xml.annotation.*;
- * </p>
- * <p>
- * Class in package using defined namespaces...
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p>
+ * Class in package using defined namespaces...
+ * </p>
+ * <p class='bcode'>
* <jk>package</jk> com.ibm.sample.addressbook;
*
* <jc>// Bean class, override "ab" namespace on package.</jc>
@@ -90,9 +88,7 @@ public @interface XmlSchema {
* <ja>@Xml</ja>(prefix=<js>"mail"</js>)
* <jk>public</jk> String <jf>street</jf>, <jf>city</jf>, <jf>state</jf>;
* }
- * </p>
- * </dd>
- * </dl>
+ * </p>
*/
public XmlNs[] xmlNs() default {};
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/doc-files/Samples.AddressBookResource.2.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Samples.AddressBookResource.2.png b/juneau-core/src/main/javadoc/doc-files/Samples.AddressBookResource.2.png
deleted file mode 100644
index 36c3e42..0000000
Binary files a/juneau-core/src/main/javadoc/doc-files/Samples.AddressBookResource.2.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/doc-files/Samples.AddressBookResource.Options.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Samples.AddressBookResource.Options.png b/juneau-core/src/main/javadoc/doc-files/Samples.AddressBookResource.Options.png
new file mode 100644
index 0000000..8b87cb3
Binary files /dev/null and b/juneau-core/src/main/javadoc/doc-files/Samples.AddressBookResource.Options.png differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/doc-files/Samples.ConfigResource.2.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Samples.ConfigResource.2.png b/juneau-core/src/main/javadoc/doc-files/Samples.ConfigResource.2.png
deleted file mode 100644
index ec748e4..0000000
Binary files a/juneau-core/src/main/javadoc/doc-files/Samples.ConfigResource.2.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/doc-files/Samples.HelloWorldResource.3.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Samples.HelloWorldResource.3.png b/juneau-core/src/main/javadoc/doc-files/Samples.HelloWorldResource.3.png
deleted file mode 100644
index c493099..0000000
Binary files a/juneau-core/src/main/javadoc/doc-files/Samples.HelloWorldResource.3.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/doc-files/Samples.MethodExampleResource.2.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Samples.MethodExampleResource.2.png b/juneau-core/src/main/javadoc/doc-files/Samples.MethodExampleResource.2.png
index a621767..89c1360 100644
Binary files a/juneau-core/src/main/javadoc/doc-files/Samples.MethodExampleResource.2.png and b/juneau-core/src/main/javadoc/doc-files/Samples.MethodExampleResource.2.png differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/doc-files/Server.Html.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Server.Html.png b/juneau-core/src/main/javadoc/doc-files/Server.Html.png
index 87565c5..b8881d8 100644
Binary files a/juneau-core/src/main/javadoc/doc-files/Server.Html.png and b/juneau-core/src/main/javadoc/doc-files/Server.Html.png differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/doc-files/Server.Options.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Server.Options.png b/juneau-core/src/main/javadoc/doc-files/Server.Options.png
index f89fea0..fee32de 100644
Binary files a/juneau-core/src/main/javadoc/doc-files/Server.Options.png and b/juneau-core/src/main/javadoc/doc-files/Server.Options.png differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/doc-files/Server.SystemPropertiesResource.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Server.SystemPropertiesResource.png b/juneau-core/src/main/javadoc/doc-files/Server.SystemPropertiesResource.png
new file mode 100644
index 0000000..5cce399
Binary files /dev/null and b/juneau-core/src/main/javadoc/doc-files/Server.SystemPropertiesResource.png differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-core/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/overview.html b/juneau-core/src/main/javadoc/overview.html
index 7c52547..2ee2c64 100644
--- a/juneau-core/src/main/javadoc/overview.html
+++ b/juneau-core/src/main/javadoc/overview.html
@@ -1261,7 +1261,7 @@
<li>APIs for updating, modifying, and saving configuration files without losing comments or formatting.
<li>Extensive listener APIs.
</ul>
- <h6 class='topic'>Examples</h6>
+ <h6 class='topic'>Example:</h6>
<p class='bcode'>
<cc>#--------------------------</cc>
<cc># My section</cc>
@@ -1361,8 +1361,7 @@
<h2 class='topic' onclick='toggle(this)'>3 - Juneau Server (org.apache.juneau.server)</h2>
<div class='topic'>
<p>
- The Juneau REST Server API provides a variety of servlet-based REST resource classes that provides REST interfaces on top of existing POJOs,
- allowing manipulation of those models using familiar GET, PUT, POST, and DELETE operations.
+ The Juneau REST Server API provides servlet-based REST resources on top of existing POJOs.
</p>
<p>
The API automatically detects <l>Accept</l> header of requests and converts POJOs to any of the supported languages.
@@ -1376,47 +1375,132 @@
</p>
<p class='bcode'>
<ja>@RestResource</ja>(
- messages=<js>"nls/messages"</js>,
+ path=<js>"/systemProperties"</js>,
+ title=<js>"System properties resource"</js>,
+ description=<js>"REST interface for performing CRUD operations on system properties."</js>,
properties={
- <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, value=<js>"$L{label}"</js>),
- <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_description</jsf>, value=<js>"$L{description}"</js>),
- <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_links</jsf>, value=<js>"{up:'$R{requestParentURI}',options:'?method=OPTIONS'}"</js>),
- <ja>@Property</ja>(name=HtmlSerializerContext.<jsf>HTML_uriAnchorText</jsf>, value=<jsf>PROPERTY_NAME</jsf>)
- }
+ <ja>@Property</ja>(name=<jsf>SERIALIZER_quoteChar</jsf>, value=<js>"'"</js>),
+ <ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS'}"</js>),
+ },
+ stylesheet=<js>"styles/devops.css"</js>,
+ encoders=GzipEncoder.<jk>class</jk>,
+ contact=<js>"{name:'John Smith',email:'john@smith.com'}"</js>,
+ license=<js>"{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}"</js>,
+ version=<js>"2.0"</js>,
+ termsOfService=<js>"You're on your own."</js>,
+ tags=<js>"[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]"</js>,
+ externalDocs=<js>"{description:'Home page',url:'http://juneau.apache.org'}"</js>
)
- <jk>public class</jk> SystemPropertiesService <jk>extends</jk> RestServletJenaDefault {
+ <jk>public class</jk> SystemPropertiesResource <jk>extends</jk> RestServletDefault {
- <jd>/** [OPTIONS /*] - Show resource options. */</jd>
- <ja>@RestMethod</ja>(name=<js>"OPTIONS"</js>, path=<js>"/*"</js>)
- <jk>public</jk> Swagger getOptions(RestRequest req) {
- <jk>return</jk> req.getSwagger();
- }
-
- <jd>/** [GET /] - Get all system properties. */</jd>
- <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/"</js>)
- <jk>public</jk> TreeMap<String,String> getSystemProperties() <jk>throws</jk> Throwable {
- <jk>return new</jk> TreeMap(System.<jsm>getProperties()</jsm>);
+ <ja>@RestMethod</ja>(
+ name=<js>"GET"</js>, path=<js>"/"</js>,
+ summary=<js>"Show all system properties"</js>,
+ description=<js>"Returns all system properties defined in the JVM."</js>,
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"query"</js>, name=<js>"sort"</js>, description=<js>"Sort results alphabetically."</js>, _default=<js>"false"</js>)
+ },
+ responses={
+ <ja>@Response</ja>(value=200, description=<js>"Returns a map of key/value pairs."</js>)
+ }
+ )
+ <jk>public</jk> Map getSystemProperties(<ja>@Query</ja>(<js>"sort"</js>) <jk>boolean</jk> sort) <jk>throws</jk> Throwable {
+ <jk>if</jk> (sort)
+ <jk>return new</jk> TreeMap(System.<jsm>getProperties</jsm>());
+ <jk>return</jk> System.<jsm>getProperties</jsm>();
}
- <jd>/** [GET /{propertyName}] - Get system property with specified name. */</jd>
- <ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/{propertyName}"</js>)
+ <ja>@RestMethod</ja>(
+ name=<js>"GET"</js>, path=<js>"/{propertyName}"</js>,
+ summary=<js>"Get system property"</js>,
+ description=<js>"Returns the value of the specified system property."</js>,
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"propertyName"</js>, description=<js>"The system property name."</js>)
+ },
+ responses={
+ <ja>@Response</ja>(value=200, description=<js>"The system property value, or null if not found."</js>)
+ }
+ )
<jk>public</jk> String getSystemProperty(<ja>@Path</ja> String propertyName) <jk>throws</jk> Throwable {
<jk>return</jk> System.<jsm>getProperty</jsm>(propertyName);
}
-
- <jd>/** [PUT /{propertyName}] - Set system property with specified name. */</jd>
- <ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/{propertyName}"</js>, guards=AdminGuard.<jk>class</jk>)
+
+ <ja>@RestMethod</ja>(
+ name=<js>"PUT"</js>, path=<js>"/{propertyName}"</js>,
+ summary=<js>"Replace system property"</js>,
+ description=<js>"Sets a new value for the specified system property."</js>,
+ guards=AdminGuard.<jk>class</jk>,
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"propertyName"</js>, description=<js>"The system property name."</js>),
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"The new system property value."</js>),
+ },
+ responses={
+ <ja>@Response</ja>(value=302,
+ headers={
+ <ja>@Parameter</ja>(name=<js>"Location"</js>, description=<js>"The root URL of this resource."</js>)
+ }
+ ),
+ <ja>@Response</ja>(value=403, description=<js>"User is not an admin."</js>)
+ }
+ )
<jk>public</jk> Redirect setSystemProperty(<ja>@Path</ja> String propertyName, <ja>@Body</ja> String value) {
System.<jsm>setProperty</jsm>(propertyName, value);
<jk>return new</jk> Redirect();
}
- <jd>/** [DELETE /{propertyName}] - Delete system property with specified name. */</jd>
- <ja>@RestMethod</ja>(name=<js>"DELETE"</js>, path=<js>"/{propertyName}"</js>, guards=AdminGuard.<jk>class</jk>)
+ <ja>@RestMethod</ja>(
+ name=<js>"POST"</js>, path=<js>"/"</js>,
+ summary=<js>"Add an entire set of system properties"</js>,
+ description=<js>"Takes in a map of key/value pairs and creates a set of new system properties."</js>,
+ guards=AdminGuard.<jk>class</jk>,
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"propertyName"</js>, description=<js>"The system property key."</js>),
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"The new system property values.", schema="{example:{key1:'val1',key2:123}}"</js>),
+ },
+ responses={
+ <ja>@Response</ja>(value=302,
+ headers={
+ <ja>@Parameter</ja>(name=<js>"Location"</js>, description=<js>"The root URL of this resource."</js>)
+ }
+ ),
+ <ja>@Response</ja>(value=403, description=<js>"Unauthorized: User is not an admin."</js>)
+ }
+ )
+ <jk>public</jk> Redirect setSystemProperties(<ja>@Body</ja> java.util.Properties newProperties) {
+ System.<jsm>setProperties</jsm>(newProperties);
+ <jk>return new</jk> Redirect();
+ }
+
+ <ja>@RestMethod</ja>(
+ name=<js>"DELETE"</js>, path=<js>"/{propertyName}"</js>,
+ summary=<js>"Delete system property"</js>,
+ description=<js>"Deletes the specified system property."</js>,
+ guards=AdminGuard.<jk>class</jk>,
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"propertyName"</js>, description=<js>"The system property name."</js>),
+ },
+ responses={
+ <ja>@Response</ja>(value=302,
+ headers={
+ <ja>@Parameter</ja>(name=<js>"Location"</js>, description=<js>"The root URL of this resource."</js>)
+ }
+ ),
+ <ja>@Response</ja>(value=403, description=<js>"Unauthorized: User is not an admin"</js>)
+ }
+ )
<jk>public</jk> Redirect deleteSystemProperty(<ja>@Path</ja> String propertyName) {
System.<jsm>clearProperty</jsm>(propertyName);
<jk>return new</jk> Redirect();
}
+
+ <ja>@RestMethod</ja>(
+ name=<js>"OPTIONS"</js>, path=<js>"/*"</js>,
+ summary=<js>"Show resource options"</js>,
+ description=<js>"Show resource options as a Swagger doc"</js>
+ )
+ <jk>public</jk> Swagger getOptions(RestRequest req) {
+ <jk>return</jk> req.getSwagger();
+ }
}
</p>
<p>
@@ -1436,7 +1520,12 @@
<xt></web-app></xt>
</p>
<p>
- One of the most useful aspects of using this API is the self-discovering, self-documenting OPTIONS pages that describe how to use the resource using labels pulled from the associated resource bundle:
+ Pointing your browser to the resource renders the POJOs as HTML (since that's what the browser specifies in the <code>Accept</code> header).
+ </p>
+ <img class='bordered' src="doc-files/Server.SystemPropertiesResource.png">
+ <p>
+ One of the most useful aspects of using this API is the self-discovering, self-documenting OPTIONS pages.
+ These are constructed automatically using reflection, augmented with information pulled from annotations (as shown above), resource bundles, or Swagger JSON files:
</p>
<img class='bordered' src="doc-files/Server.Options.png">
@@ -2024,9 +2113,9 @@
<cc>#--------------------------------------------------------------------------------
# HelloWorldResource labels
#--------------------------------------------------------------------------------</cc>
- <ck>label</ck> = <cv>Hello World sample resource</cv>
+ <ck>title</ck> = <cv>Hello World sample resource</cv>
<ck>description</ck> = <cv>Simplest possible resource</cv>
- <ck>sayHello</ck> = <cv>Responds with "Hello world!"</cv>
+ <ck>sayHello.summary</ck> = <cv>Responds with "Hello world!"</cv>
</p>
<p>
The class hierarchy for this class is:
@@ -2055,11 +2144,6 @@
allows us to see this page rendered as JSON:
</p>
<img class='bordered' src='doc-files/Samples.HelloWorldResource.2.png'>
- <p>
- Clicking the OPTIONS link on the page shows the OPTIONS for this resource.
- Note how the <l>sayHello</l> Java method description is pulled from the resource bundle.
- </p>
- <img class='bordered' src='doc-files/Samples.HelloWorldResource.3.png'>
</div>
<!-- ======================================================================================================== -->
@@ -2127,14 +2211,14 @@
String method = req.getMethod();
<jc>// Attributes (from URL pattern variables)</jc>
- String a1 = req.getAttribute(<js>"a1"</js>, String.<jk>class</jk>);
- <jk>int</jk> a2 = req.getAttribute(<js>"a2"</js>, <jk>int</jk>.<jk>class</jk>);
- UUID a3 = req.getAttribute(<js>"a3"</js>, UUID.<jk>class</jk>);
+ String a1 = req.getPathParameter(<js>"a1"</js>, String.<jk>class</jk>);
+ <jk>int</jk> a2 = req.getPathParameter(<js>"a2"</js>, <jk>int</jk>.<jk>class</jk>);
+ UUID a3 = req.getPathParameter(<js>"a3"</js>, UUID.<jk>class</jk>);
<jc>// Optional GET parameters</jc>
- <jk>int</jk> p1 = req.getParameter(<js>"p1"</js>, <jk>int</jk>.<jk>class</jk>, 0);
- String p2 = req.getParameter(<js>"p2"</js>, String.<jk>class</jk>);
- UUID p3 = req.getParameter(<js>"p3"</js>, UUID.<jk>class</jk>);
+ <jk>int</jk> p1 = req.getQueryParameter(<js>"p1"</js>, <jk>int</jk>.<jk>class</jk>, 0);
+ String p2 = req.getQueryParameter(<js>"p2"</js>, String.<jk>class</jk>);
+ UUID p3 = req.getQueryParameter(<js>"p3"</js>, UUID.<jk>class</jk>);
<jc>// URL pattern post-match</jc>
String remainder = req.getPathRemainder();
@@ -2171,8 +2255,8 @@
<li class='m'><l>doGetExample2()</l>
<br>Identical to <l>doGetExample1()</l> but shows how to use the {@link org.apache.juneau.server.RestRequest} and {@link org.apache.juneau.server.RestResponse} objects:
<ul>
- <li class='m'>{@link org.apache.juneau.server.RestRequest#getAttribute(String,Class)}
- <li class='m'>{@link org.apache.juneau.server.RestRequest#getParameter(String,Class)}
+ <li class='m'>{@link org.apache.juneau.server.RestRequest#getPathParameter(String,Class)}
+ <li class='m'>{@link org.apache.juneau.server.RestRequest#getQueryParameter(String,Class)}
<li class='m'>{@link org.apache.juneau.server.RestRequest#getHeader(String,Class)}
<li class='m'>{@link org.apache.juneau.server.RestRequest#getMethod()}
<li class='m'>{@link org.apache.juneau.server.RestRequest#getPathRemainder()}
@@ -2194,15 +2278,24 @@
<p>
Notice how the conversion to POJOs is automatically done for us, even for non-standard POJOs such as UUID.
</p>
- <h6 class='topic'>Self-documenting design through OPTIONS pages</h6>
+ <h6 class='topic'>Self-documenting design through Swagger OPTIONS pages</h6>
<p>
- One of the main features of Juneau is that it produces OPTIONS pages for self-documenting designs (i.e. REST interfaces that document themselves).
+ One of the main features of Juneau is that it produces OPTIONS pages for self-documenting design (i.e. REST interfaces that document themselves).
</p>
<p>
- To facilitate this, the <del><code>ResourceOptions</code></del> class is provided.
- It inspects a <l>RestServlet</l> and its methods, and returns a serializable POJO data structure
- that describes the options for that resource and pulls localized strings from the resource
- bundle associated with the servlet.
+ Much of the information populated on the OPTIONS page is determined through reflection.
+ This basic information can be augmented with information defined through:
+ </p>
+ <ul>
+ <li>Annotations - An example of this was shown in the <code>SystemPropertiesResource</code> example above.<br>
+ Localized strings can be pulled from resource bundles using the <code>$L</code> localization variable.
+ <li>Resource bundle properties - Described in detail in this section.
+ <li>Swagger JSON files with the same name and location as the resource class (e.g. <code>MethodExampleResource.json</code>).<br>
+ Localized versions are defined by appending the locale to the file name (e.g. <code>MethodExampleResource_ja_JP.json</code>);
+ </ul>
+ <p>
+ OPTIONS pages are simply serialized {@link org.apache.juneau.dto.swagger.Swagger} DTO beans.
+ Localized versions of these beans are retrieved using the {@link org.apache.juneau.server.RestRequest#getSwagger()} method.
</p>
<p>
To define an OPTIONS request handler, the {@link org.apache.juneau.server.RestServletDefault} class defines the following Java method:
@@ -2243,28 +2336,28 @@
<cc>#--------------------------------------------------------------------------------
# MethodExampleResource labels
#--------------------------------------------------------------------------------</cc>
- <ck>label = <cv>A simple REST method example resource</cv>
+ <ck>title = <cv>A simple REST method example resource</cv>
- <ck>doGetExample</ck> = <cv>Sample GET method</cv>
- <ck>doGetExample1</ck> = <cv>Sample GET using annotations</cv>
- <ck>doGetExample1.req.attr.a1</ck> = <cv>Sample variable</cv>
- <ck>doGetExample1.req.attr.a2</ck> = <cv>Sample variable</cv>
- <ck>doGetExample1.req.attr.a3</ck> = <cv>Sample variable</cv>
- <ck>doGetExample1.req.param.p1</ck> = <cv>Sample parameter</cv>
- <ck>doGetExample1.req.param.p2</ck> = <cv>Sample parameter</cv>
- <ck>doGetExample1.req.param.p3</ck> = <cv>Sample parameter</cv>
- <ck>doGetExample1.req.header.Accept-Language</ck> = <cv>Sample header</cv>
- <ck>doGetExample1.req.header.DNT</ck> = <cv>Sample header</cv>
- <ck>doGetExample2</ck> = <cv>Sample GET using Java APIs</cv>
- <ck>doGetExample2.req.attr.a1</ck> = <cv>Sample variable</cv>
- <ck>doGetExample2.req.attr.a2</ck> = <cv>Sample variable</cv>
- <ck>doGetExample2.req.attr.a3</ck> = <cv>Sample variable</cv>
- <ck>doGetExample2.req.param.p1</ck> = <cv>Sample parameter</cv>
- <ck>doGetExample2.req.param.p2</ck> = <cv>Sample parameter</cv>
- <ck>doGetExample2.req.param.p3</ck> = <cv>Sample parameter</cv>
- <ck>doGetExample2.req.header.Accept-Language</ck> = <cv>Sample header</cv>
- <ck>doGetExample2.req.header.DNT</ck> = <cv>Sample header</cv>
- <ck>getOptions</ck> = <cv>View these options</cv>
+ <ck>doGetExample.summary</ck> = <cv>Sample GET method</cv>
+ <ck>doGetExample1.summary</ck> = <cv>Sample GET using annotations</cv>
+ <ck>doGetExample1.req.path.a1.description</ck> = <cv>Sample variable</cv>
+ <ck>doGetExample1.req.path.a2.description</ck> = <cv>Sample variable</cv>
+ <ck>doGetExample1.req.path.a3.description</ck> = <cv>Sample variable</cv>
+ <ck>doGetExample1.req.query.p1.description</ck> = <cv>Sample parameter</cv>
+ <ck>doGetExample1.req.query.p2.description</ck> = <cv>Sample parameter</cv>
+ <ck>doGetExample1.req.query.p3.description</ck> = <cv>Sample parameter</cv>
+ <ck>doGetExample1.req.header.Accept-Language.description</ck> = <cv>Sample header</cv>
+ <ck>doGetExample1.req.header.DNT.description</ck> = <cv>Sample header</cv>
+ <ck>doGetExample2.summary</ck> = <cv>Sample GET using Java APIs</cv>
+ <ck>doGetExample2.req.path.a1.description</ck> = <cv>Sample variable</cv>
+ <ck>doGetExample2.req.path.a2.description</ck> = <cv>Sample variable</cv>
+ <ck>doGetExample2.req.path.a3.description</ck> = <cv>Sample variable</cv>
+ <ck>doGetExample2.req.query.p1.description</ck> = <cv>Sample parameter</cv>
+ <ck>doGetExample2.req.query.p2.description</ck> = <cv>Sample parameter</cv>
+ <ck>doGetExample2.req.query.p3.description</ck> = <cv>Sample parameter</cv>
+ <ck>doGetExample2.req.header.Accept-Language.description</ck> = <cv>Sample header</cv>
+ <ck>doGetExample2.req.header.DNT.description</ck> = <cv>Sample header</cv>
+ <ck>getOptions.summary</ck> = <cv>View these options</cv>
</p>
<p>
Clicking the <l>options</l> link on the page presents you with information about how to use this resource:
@@ -2383,7 +2476,7 @@
<cc>#--------------------------------------------------------------------------------
# UrlEncodedFormResource labels
#--------------------------------------------------------------------------------</cc>
- <ck>label</ck> = <cv>URL-Encoded Form Post Example</cv>
+ <ck>title</ck> = <cv>URL-Encoded Form Post Example</cv>
<ck>description</ck> = <cv>Shows how URL-Encoded form input can be loaded into POJOs. POJO is simply echoed back.</cv>
<ck>aString</ck> = <cv>A String:</cv>
<ck>aNumber</ck> = <cv>A Number:</cv>
@@ -2556,10 +2649,6 @@
Pointing a browser to the resource shows the following:
</p>
<img class='bordered' src='doc-files/Samples.AddressBookResource.1.png'>
- <p>
- If you click the <l>options</l> link, you can see the following self-documenting OPTIONS page:
- </p>
- <img class='bordered' src='doc-files/Samples.AddressBookResource.2.png'>
<!-- ======================================================================================================== -->
<a id="Samples.AddressBookResource.Classes"></a>
@@ -2916,7 +3005,13 @@
<ja>@Property</ja>(name=<jsf>SERIALIZER_relativeUriBase</jsf>, value=<js>"$R{servletURI}"</js>),
},
stylesheet=<js>"styles/devops.css"</js>,
- encoders=GzipEncoder.<jk>class</jk>
+ encoders=GzipEncoder.<jk>class</jk>,
+ contact=<js>"{name:'John Smith',email:'john@smith.com'}"</js>,
+ license=<js>"{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}"</js>,
+ version=<js>"2.0"</js>,
+ termsOfService=<js>"You're on your own."</js>,
+ tags=<js>"[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]"</js>,
+ externalDocs=<js>"{description:'Home page',url:'http://juneau.apache.org'}"</js>
)
<jk>public class</jk> AddressBookResource <jk>extends</jk> ResourceJena {
<jk>private static final long</jk> <jsf>serialVersionUID</jsf> = 1L;
@@ -3197,65 +3292,80 @@
</p>
<h6 class='figure'>AddressBookResource.properties</h6>
<p class='bcode'>
- <ck>label</ck> = <cv>AddressBook sample resource</cv>
+ <ck>title</ck> = <cv>AddressBook sample resource</cv>
<ck>description</ck> = <cv>Proof-of-concept resource that shows off the capabilities of working with POJO resources</cv>
- <ck>getRoot</ck> = <cv>Get root page</cv>
+ <ck>getRoot.summary</ck> = <cv>Get root page</cv>
+ <ck>getRoot.description</ck> = <cv>Jumping off page for top-level Person and Address beans.</cv>
- <ck>getAllPeople</ck> = <cv>Get all people in the address book</cv>
- <ck>getAllPeople.res.200.content</ck> = <cv>List<Person></cv>
+ <ck>doInit.summary</ck> = <cv>Reinitialize this resource</cv>
+ <ck>doInit.description</ck> = <cv>Resets the address book to the original contents.</cv>
+ <ck>doInit.res.200.description</ck> = <cv>Returns the string "OK"</cv>
- <ck>getPerson</ck> = <cv>Get a single person by ID</cv>
- <ck>getPerson.req.attr.id</ck> = <cv>Person UUID</cv>
- <ck>getPerson.res.200.content</ck> = <cv>Person bean</cv>
- <ck>getPerson.res.404</ck> = <cv>Person ID not found</cv>
+ <ck>getAllPeople.summary</ck> = <cv>Get all people in the address book</cv>
+ <ck>getAllPeople.res.200.description</ck> = <cv>Returns a serialized List<Person></cv>
+ <ck>getAllPeople.res.200.examples</ck> = <cv>{'text/json':"[\n\t{\n\t\turi:'http://hostname/addressBook/person/1',\n\t\taddressBookUri:'http://localhost/addressBook',\n\t\tid:1,\n\t\tname:'John Smith',\n\t\tbirthDate:'Jan 1, 2000',\n\t\taddresses:[\n\t\t\t{\n\t\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\t\tid:1,\n\t\t\t\tstreet:'101 Main St',\n\t\t\t\tcity:'Anywhere',\n\t\t\t\tstate:'NY',\n\t\t\t\tzip:12345,\n\t\t\t\tisCurrent:true\n\t\t\t}\n\t\t]\n\t}\n]"}</cv>
- <ck>getAllAddresses</ck> = <cv>Get all addresses in the address book</cv>
- <ck>getAllAddresses.res.200.content</ck> = <cv>List<Address></cv>
+ <ck>getPerson.summary</ck> = <cv>Get a single person by ID</cv>
+ <ck>getPerson.req.path.id.description</ck> = <cv>Person ID</cv>
+ <ck>getPerson.req.path.id.type</ck> = <cv>integer</cv>
+ <ck>getPerson.res.200.description</ck> = <cv>Returns a serialized Person bean</cv>
+ <ck>getPerson.res.200.examples</ck> = <cv>{'text/json':"{\n\turi:'http://hostname/addressBook/person/1',\n\taddressBookUri:'http://localhost/addressBook',\n\tid:1,\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\tid:1,\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"}</cv>
+ <ck>getPerson.res.404.description</ck> = <cv>Person ID not found</cv>
- <ck>getAddress</ck> = <cv>Get a single address by ID</cv>
- <ck>getAddress.req.attr.id</ck> = <cv>Address UUID</cv>
- <ck>getAddress.res.200.content</ck> = <cv>Address bean</cv>
- <ck>getAddress.res.404</ck> = <cv>Address ID not found</cv>
+ <ck>getAllAddresses.summary</ck> = <cv>Get all addresses in the address book</cv>
+ <ck>getAllAddresses.res.200.description</ck> = <cv>Returns a serialized List<Address></cv>
+ <ck>getAllAddresses.res.200.examples</ck> = <cv>{'text/json':"[\n\t{\n\t\turi:'http://localhost/addressBook/addresses/1',\n\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\tid:1,\n\t\tstreet:'101 Main St',\n\t\tcity:'Anywhere',\n\t\tstate:'NY',\n\t\tzip:12345,\n\t\tisCurrent:true\n\t}\n]"}</cv>
- <ck>createPerson</ck> = <cv>Create a new Person bean </cv>
- <ck>createPerson.res.307.header.Location</ck> = <cv>URL of new person</cv>
+ <ck>getAddress.summary</ck> = <cv>Get a single address by ID</cv>
+ <ck>getAddress.req.path.id.description</ck> = <cv>Address ID</cv>
+ <ck>getAddress.req.path.id.type</ck> = <cv>integer</cv>
+ <ck>getAddress.res.200.description</ck> = <cv>Returns a serialized Address bean</cv>
+ <ck>getAddress.res.200.examples</ck> = <cv>{'text/json':"{\n\turi:'http://localhost/addressBook/addresses/1',\n\tpersonUri:'http://localhost/addressBook/people/1',\n\tid:1,\n\tstreet:'101 Main St',\n\tcity:'Anywhere',\n\tstate:'NY',\n\tzip:12345,\n\tisCurrent:true\n}"}</cv>
+ <ck>getAddress.res.404.description</ck> = <cv>Address ID not found</cv>
- <ck>createAddress</ck> = <cv>Create a new Address bean</cv>
- <ck>createAddress.req.attr.id</ck> = <cv>Person UUID</cv>
- <ck>createAddress.res.307.header.Location</ck> = <cv>URL of new address</cv>
+ <ck>createPerson.summary</ck> = <cv>Create a new Person bean </cv>
+ <ck>createPerson.req.body.description</ck> = <cv>Serialized CreatePerson bean</cv>
+ <ck>createPerson.req.body.schema</ck> = <cv>{example:"{\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"}</cv>
+ <ck>createPerson.res.307.header.Location.description</ck> = <cv>URL of new person</cv>
- <ck>deletePerson</ck> = <cv>Delete a Person bean</cv>
- <ck>deletePerson.req.attr.id</ck> = <cv>Person UUID</cv>
- <ck>deletePerson.res.200.content</ck> = <cv>"DELETE successful"</cv>
- <ck>deletePerson.res.404</ck> = <cv>Person ID not found</cv>
+ <ck>createAddress.summary</ck> = <cv>Create a new Address bean</cv>
+ <ck>createAddress.req.path.id.description</ck> = <cv>Person ID</cv>
+ <ck>createAddress.req.path.id.type</ck> = <cv>integer</cv>
+ <ck>createAddress.req.body.schema</ck> = <cv>{example:"{\n\tstreet:'101 Main St',\n\tcity:'Anywhere',\n\tstate:'NY',\n\tzip:12345,\n\tisCurrent:true\n}"}</cv>
+ <ck>createAddress.res.307.header.Location.description</ck> = <cv>URL of new address</cv>
- <ck>deleteAddress</ck> = <cv>Delete an Address bean</cv>
- <ck>deleteAddress.req.attr.id</ck> = <cv>Address UUID</cv>
- <ck>deleteAddress.res.200.content</ck> = <cv>"DELETE successful"</cv>
- <ck>deleteAddress.res.404</ck> = <cv>Address ID not found</cv>
+ <ck>deletePerson.summary</ck> = <cv>Delete a Person bean</cv>
+ <ck>deletePerson.req.path.id.description</ck> = <cv>Person ID</cv>
+ <ck>deletePerson.req.path.id.type</ck> = <cv>integer</cv>
+ <ck>deletePerson.res.200.description</ck> = <cv>Returns the string "DELETE successful"</cv>
+ <ck>deletePerson.res.404.description</ck> = <cv>Person ID not found</cv>
- <ck>updatePerson</ck> = <cv>Change property on Person bean</cv>
- <ck>updatePerson.req.attr.id</ck> = <cv>Person UUID</cv>
- <ck>updatePerson.req.content</ck> = <cv>Anything</cv>
- <ck>updatePerson.res.200.content</ck> = <cv>"PUT successful"</cv>
- <ck>updatePerson.res.400</ck> = <cv>Invalid object type used</cv>
- <ck>updatePerson.res.404</ck> = <cv>Person ID not found</cv>
+ <ck>deleteAddress.summary</ck> = <cv>Delete an Address bean</cv>
+ <ck>deleteAddress.req.path.id.description</ck> = <cv>Address ID</cv>
+ <ck>deleteAddress.res.200.description</ck> = <cv>Returns the string "DELETE successful"</cv>
+ <ck>deleteAddress.res.404.description</ck> = <cv>Address ID not found</cv>
- <ck>updateAddress</ck> = <cv>Change property on Address bean</cv>
- <ck>updateAddress.req.attr.id</ck> = <cv>Address UUID</cv>
- <ck>updateAddress.req.content</ck> = <cv>Anything</cv>
- <ck>updateAddress.res.200.content</ck> = <cv>"PUT successful"</cv>
- <ck>updateAddress.res.400</ck> = <cv>Invalid object type used</cv>
- <ck>updateAddress.res.404</ck> = <cv>Address ID not found</cv>
+ <ck>updatePerson.summary</ck> = <cv>Change property on Person bean</cv>
+ <ck>updatePerson.req.path.id.description</ck> = <cv>Person ID</cv>
+ <ck>updatePerson.req.path.id.type</ck> = <cv>integer</cv>
+ <ck>updatePerson.req.body.description</ck> = <cv>Any object matching the field</cv>
+ <ck>updatePerson.res.200.description</ck> = <cv>Returns the string "PUT successful"</cv>
+ <ck>updatePerson.res.400.description</ck> = <cv>Invalid object type used</cv>
+ <ck>updatePerson.res.404.description</ck> = <cv>Person ID not found</cv>
- <ck>doInit</ck> = <cv>Reinitialize this resource</cv>
- <ck>doInit.res.200.content</ck> = <cv>"OK"</cv>
+ <ck>updateAddress.summary</ck> = <cv>Change property on Address bean</cv>
+ <ck>updateAddress.req.path.id.description</ck> = <cv>Address ID</cv>
+ <ck>updateAddress.req.path.id.type</ck> = <cv>integer</cv>
+ <ck>updateAddress.req.body.description</ck> = <cv>Any object matching the field</cv>
+ <ck>updateAddress.res.200.description</ck> = <cv>Returns the string "PUT successful"</cv>
+ <ck>updateAddress.res.400.description</ck> = <cv>Invalid object type used</cv>
+ <ck>updateAddress.res.404.description</ck> = <cv>Address ID not foundv
- <ck>getOptions</ck> = <cv>View resource options</cv>
+ <ck>getOptions.summary</ck> = <cv>View resource options</cv>
- <ck>getCognosData</ck> = <cv>Get data in Cognos/XML format</cv>
- <ck>getCognosData.res.200.content</ck> = <cv>DataSet</cv>
+ <ck>getCognosData.summary</ck> = <cv>Get data in Cognos/XML format</cv>
+ <ck>getCognosData.res.200.description</ck> = <cv>Returns a serialized DataSet</cv>
<ck>otherNotes</ck> = <cv>GZip support enabled. Public methods can be invoked by using the &Method URL parameter. 'text/cognos+xml' support available under root resource only</cv>
</p>
@@ -3322,6 +3432,10 @@
Clicking on the first <l>personUri</l> link executes the <l>getPerson()</l> method, which renders a serialized <l>Person</l> object:
</p>
<img class='bordered' src="doc-files/Samples.AddressBookResource.Demo.10.png">
+ <p>
+ Clicking on the OPTIONS link on the page shows you the Swagger doc generated from our annotations and resource bundle properties:
+ </p>
+ <img class='bordered' src="doc-files/Samples.AddressBookResource.Options.png">
</div>
<!-- ======================================================================================================== -->
@@ -3688,7 +3802,7 @@
<cc>#--------------------------------------------------------------------------------
# TempDirResource labels
#--------------------------------------------------------------------------------</cc>
- <ck>label</ck> = <cv>Temp Directory View Service</cv>
+ <ck>title</ck> = <cv>Temp Directory View Service</cv>
<ck>description</ck> = <cv>View and download files in the '$S{java.io.tmpdir}' directory.</cv>
</p>
<p>
@@ -3860,7 +3974,7 @@
*/</jd>
<ja>@RestResource</ja>(
path=<js>"/docker"</js>,
- label=<js>"Sample Docker resource"</js>,
+ title=<js>"Sample Docker resource"</js>,
properties={
<ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{up:'$R{requestParentURI}',options:'?method=OPTIONS',source:'$R{servletParentURI}/source?classes=(org.apache.juneau.server.samples.AtomFeedResource)'}"</js>)
}
@@ -4425,10 +4539,6 @@
</p>
<img class='bordered' src='doc-files/Samples.ConfigResource.1.png'>
<p>
- The OPTIONS page shows the REST methods available to alter the config files:
- </p>
- <img class='bordered' src='doc-files/Samples.ConfigResource.2.png'>
- <p>
An edit page is provided for altering the raw config file:
</p>
<img class='bordered' src='doc-files/Samples.ConfigResource.3.png'>
@@ -4443,7 +4553,7 @@
*/</jd>
<ja>@RestResource</ja>(
path=<js>"/config"</js>,
- label=<js>"Configuration"</js>,
+ title=<js>"Configuration"</js>,
description=<js>"Contents of configuration file."</js>,
properties={
<ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS',edit:'$R{servletURI}/edit'}"</js>),
@@ -4487,8 +4597,8 @@
*/</jd>
<ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/{section}"</js>,
description=<js>"Show config file section."</js>,
- input={
- <ja>@Var</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>)
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>)
}
)
<jk>public</jk> ObjectMap getConfigSection(<ja>@Path</ja>(<js>"section"</js>) String section) <jk>throws</jk> Exception {
@@ -4505,9 +4615,9 @@
*/</jd>
<ja>@RestMethod</ja>(name=<js>"GET"</js>, path=<js>"/{section}/{key}"</js>,
description=<js>"Show config file entry."</js>,
- input={
- <ja>@Var</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>),
- <ja>@Var</ja>(in=<js>"path"</js>, name=<js>"key"</js>, description=<js>"Entry name."</js>)
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>),
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"key"</js>, description=<js>"Entry name."</js>)
}
)
<jk>public</jk> String getConfigEntry(<ja>@Path</ja>(<js>"section"</js>) String section, <ja>@Path</ja>(<js>"key"</js>) String key) <jk>throws</jk> Exception {
@@ -4523,8 +4633,8 @@
*/</jd>
<ja>@RestMethod</ja>(name=<js>"POST"</js>, path=<js>"/"</js>,
description=<js>"Sets contents of config file from a FORM post."</js>,
- input={
- <ja>@Var</ja>(in=<js>"formData"</js>, name=<js>"contents"</js>, description=<js>"New contents in INI file format."</js>)
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"formData"</js>, name=<js>"contents"</js>, description=<js>"New contents in INI file format."</js>)
}
)
<jk>public</jk> ConfigFile setConfigContentsFormPost(<ja>@FormData</ja>(<js>"contents"</js>) String contents) <jk>throws</jk> Exception {
@@ -4540,8 +4650,8 @@
*/</jd>
<ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/"</js>,
description=<js>"Sets contents of config file."</js>,
- input={
- <ja>@Var</ja>(in=<js>"body"</js>, description=<js>"New contents in INI file format."</js>)
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New contents in INI file format."</js>)
}
)
<jk>public</jk> ConfigFile setConfigContents(<ja>@Body</ja> Reader contents) <jk>throws</jk> Exception {
@@ -4559,9 +4669,9 @@
*/</jd>
<ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/{section}"</js>,
description=<js>"Add or overwrite a config file section."</js>,
- input={
- <ja>@Var</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>),
- <ja>@Var</ja>(in=<js>"body"</js>, description=<js>"New contents for section as a simple map with string keys and values."</js>)
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>),
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New contents for section as a simple map with string keys and values."</js>)
}
)
<jk>public</jk> ObjectMap setConfigSection(<ja>@Path</ja>(<js>"section"</js>) String section, <ja>@Body</ja> Map<String,String> contents) <jk>throws</jk> Exception {
@@ -4580,10 +4690,10 @@
*/</jd>
<ja>@RestMethod</ja>(name=<js>"PUT"</js>, path=<js>"/{section}/{key}"</js>,
description=<js>"Add or overwrite a config file entry."</js>,
- input={
- <ja>@Var</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>),
- <ja>@Var</ja>(in=<js>"path"</js>, name=<js>"key"</js>, description=<js>"Entry name."</js>),
- <ja>@Var</ja>(in=<js>"body"</js>, description=<js>"New value as a string."</js>)
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>, description=<js>"Section name."</js>),
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"key"</js>, description=<js>"Entry name."</js>),
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New value as a string."</js>)
}
)
<jk>public</jk> String setConfigSection(<ja>@Path</ja>(<js>"section"</js>) String section, <ja>@Path</ja>(<js>"key"</js>) String key, <ja>@Body</ja> String value) <jk>throws</jk> Exception {
@@ -4617,7 +4727,7 @@
<xt><table></xt>
<xt><tr></xt><xt><td</xt> <xa>colspan</xa>=<xs>'2'</xs> <xa>align</xa>=<xs>'right'</xs><xt>></xt><xt><button</xt> <xa>type</xa>=<xs>'submit'</xs><xt>></xt>Submit<xt></button></xt><xt><button</xt> <xa>type</xa>=<xs>'reset'</xs><xt>></xt>Reset<xt></button></xt><xt></td></xt><xt></tr></xt>
<xt><tr></xt><xt><th</xt> <xa>colspan</xa>=<xs>'2'</xs><xt>></xt>Contents<xt></th></xt><xt></tr></xt>
- <xt><tr></xt><xt><td</xt> <xa>colspan</xa>=<xs>'2'</xs><xt>></xt><xt><textarea</xt> <xa>name</xa>=<xs>'contents'</xs> <xa>rows</xa>=<xs>'40'</xs> <xa>cols</xa>=<xs>'120'</xs> <xa>style</xa>=<xs>'white-space: pre; word-wrap: normal; overflow-x: scroll;'</xs><xt>></xt>$A{contents}<xt></textarea></xt><xt></td></xt><xt></tr></xt>
+ <xt><tr></xt><xt><td</xt> <xa>colspan</xa>=<xs>'2'</xs><xt>></xt><xt><textarea</xt> <xa>name</xa>=<xs>'contents'</xs> <xa>rows</xa>=<xs>'40'</xs> <xa>cols</xa>=<xs>'120'</xs> <xa>style</xa>=<xs>'white-space: pre; word-wrap: normal; overflow-x: scroll;'</xs><xt>></xt>$SA{contents}<xt></textarea></xt><xt></td></xt><xt></tr></xt>
<xt></table></xt>
<xt></div></xt>
<xt></form></xt>
@@ -6092,7 +6202,7 @@
<li>Performance improvements around query parameters.
<li>New methods on {@link org.apache.juneau.server.RestRequest} for handling multi-part parameters:
<ul>
- <li>{@link org.apache.juneau.server.RestRequest#getParameters(String,Class)}
+ <li><del><code>RestRequest.getParameters(String,Class)</code></del>
<li>{@link org.apache.juneau.server.RestRequest#getQueryParameters(String,Class)}
</ul>
</li>
@@ -6151,7 +6261,7 @@
<h6 class='topic'>com.ibm.team.juno.server</h6>
<ul class='spaced-list'>
<li>Fixed major issue that prevented parsing URL-Encoded form posts into POJOs.
- Calling <code>HttpServlet.getParameter(String)</code> was forcing the underlying servlet code to process the HTTP body itself, preventing the <code>UrlEncodingSerializer</code>
+ Calling <del><code>HttpServlet.getParameter(String)</code></del> was forcing the underlying servlet code to process the HTTP body itself, preventing the <code>UrlEncodingSerializer</code>
class from being able to parse the content. Updated code no longer inadvertantly calls this method.
<li>New {@link org.apache.juneau.server.RestRequest#getQueryParameter(String)}, {@link org.apache.juneau.server.RestRequest#hasQueryParameter(String)}, and {@link org.apache.juneau.server.RestRequest#hasAnyQueryParameters(String[])}
methods that only look for parameters in the URL query string to prevent loading and parsing of URL-Encoded form posts.
@@ -6399,7 +6509,7 @@
<li>New {@link org.apache.juneau.server.RestRequest#getJavaMethod()} method for getting access to the method used to handle a request.
Useful for accessing the method name or annotations during requests, such as in calls to {@link org.apache.juneau.server.RestGuard#guard(RestRequest,RestResponse)}.
<li>Fixed bug when using Jetty where you tried to read text input after a header was written.
- <li>Added new string variables <code>$A{...}</code> (request attributes) and <code>$P{...}</code> (request parameters) to <code>RestServlet.createRequestVarResolver(RestRequest)</code>.
+ <li>Added new string variables <del><code>$A{...}</code></del> (request attributes) and <del><code>$P{...}</code></del> (request parameters) to <code>RestServlet.createRequestVarResolver(RestRequest)</code>.
</ul>
</div>
@@ -6489,7 +6599,7 @@
<li>More consistent handling of exceptions across all parsers.
<li>Minor changes to {@link org.apache.juneau.server.RestRequest} class.
<ul>
- <li>Changed the order of parameters on {@link org.apache.juneau.server.RestRequest#getParameter(String,Class)}.
+ <li>Changed the order of parameters on <del><code>RestRequest#getParameter(String,Class)</code></del>.
<li>Added <code>RestRequest.getMapParameter(String,Class,Class,Class)</code> and
<code>RestRequest.getCollectionParameter(String,Class,Class)}</code> methods.
</ul>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java
index e7c3688..32dea9b 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java
@@ -221,10 +221,9 @@ public abstract class Microservice {
* </ul>
* <p>
* Subclasses can override this method to provide their own variables.
- * <dl>
- * <dt>Examples:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jd>/**
* * Augment default var resolver with a custom $B{...} variable that simply wraps strings inside square brackets.
* * /</jd>
@@ -240,8 +239,8 @@ public abstract class Microservice {
* }
* );
* }
- * </p>
- * <p class='bcode'>
+ * </p>
+ * <p class='bcode'>
* <cc># Example config file</cc>
* <cs>[MySection]</cs>
* <ck>myEntry</ck> = $B{foo}
@@ -249,9 +248,7 @@ public abstract class Microservice {
* <p class='bcode'>
* <jc>// Example java code</jc>
* String myentry = getConfig().getString(<js>"MySection/myEntry"</js>); <jc>// == "[foo]"</js>
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @return A new {@link VarResolver}.
*/
@@ -293,10 +290,9 @@ public abstract class Microservice {
* String variables defined by {@link #createVarResolver()} are automatically resolved when using this method.
* <p>
* This method can be called from the class constructor.
- * <dl>
- * <dt>Examples:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <cc>#--------------------------</cc>
* <cc># My section</cc>
* <cc>#--------------------------</cc>
@@ -357,9 +353,7 @@ public abstract class Microservice {
* <jk>int</jk> sameAsAnInt = cf.getInt(<js>"MySection/sameAsAnInt"</js>);
* String myArg = cf.getString(<js>"MySection/myArg"</js>);
* String firstArg = cf.getString(<js>"MySection/firstArg"</js>);
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @return The config file for this application, or <jk>null</jk> if no config file is configured.
*/
@@ -374,18 +368,15 @@ public abstract class Microservice {
* and entries converted to simple strings.
* <p>
* This method can be called from the class constructor.
- * <dl>
- * <dt>Examples:</dt>
- * <dd>
- * <p class='bcode'>
+ *
+ * <h6 class='topic'>Example:</h6>
+ * <p class='bcode'>
* <jc>// Get Main-Class from manifest file.</jc>
* String mainClass = Microservice.<jsm>getManifest</jsm>().getString(<js>"Main-Class"</js>, <js>"unknown"</js>);
*
* <jc>// Get Rest-Resources from manifest file.</jc>
* String[] restResources = Microservice.<jsm>getManifest</jsm>().getStringArray(<js>"Rest-Resources"</js>);
- * </p>
- * </dd>
- * </dl>
+ * </p>
*
* @return The manifest file from the main jar, or <jk>null</jk> if the manifest file could not be retrieved.
*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html b/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html
index a80812d..6ab0126 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html
@@ -163,7 +163,7 @@
*/</jd>
<ja>@RestResource</ja>(
path=<js>"/"</js>,
- label=<js>"Juneau Microservice Template"</js>,
+ title=<js>"Juneau Microservice Template"</js>,
description=<js>"Template for creating REST microservices"</js>,
properties={
<ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{options:'$R{servletURI}?method=OPTIONS'}"</js>)
@@ -644,14 +644,18 @@
The following variables are available in addition to the variables defined above:
<ul>
<li><l>$L{key}, $L{key,args}</l> - Localized variables pulled from {@link org.apache.juneau.server.RestRequest#getMessage(String, Object...)}.
- <li><l>$A{key}, $A{key,default}</l> - Request attributes pulled from {@link org.apache.juneau.server.RestRequest#getAttribute(String)}.
- <li><l>$P{key}, $P{key,default}</l> - Request parameters pulled from {@link org.apache.juneau.server.RestRequest#getParameter(String)}.
<li><l>$R{key}</l> - Request variables.
<ul>
+ <li><l>$R{attribute.X}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getAttribute(String)} converted to a string.
<li><l>$R{contextPath}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getContextPath()}.
+ <li><l>$R{formData.X}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getFormDataParameter(String)}.
+ <li><l>$R{header.X}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getHeader(String)}.
<li><l>$R{method}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getMethod()}.
+ <li><l>$R{methodSummary}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getMethodSummary()}.
<li><l>$R{methodDescription}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getMethodDescription()}.
+ <li><l>$R{path.X}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getPathParameter(String)}.
<li><l>$R{pathInfo}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getPathInfo()}.
+ <li><l>$R{query.X}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getQueryParameter(String)}.
<li><l>$R{requestParentURI}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getRequestParentURI()}.
<li><l>$R{requestURI}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getRequestURI()}.
<li><l>$R{servletDescription}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getServletDescription()}.
@@ -661,6 +665,7 @@
<li><l>$R{servletURI}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getServletURI()}.
<li><l>$R{trimmedRequestURI}</l> - Value returned by {@link org.apache.juneau.server.RestRequest#getTrimmedRequestURI()}.
</ul>
+ <li><l>$SA{key,mediaType}</l> - Object returned by {@link org.apache.juneau.server.RestRequest#getAttribute(String)} converted to a string using the serializer registered to handle the specified media type.
<li><l>$UE{...}</l> - URL-Encode the specified value by calling {@link org.apache.juneau.server.RestUtils#encode(String)}.
</ul>
<h6 class='figure'>Example usage:</h6>
@@ -669,8 +674,8 @@
<cc># Contents of microservice.cfg </cc>
<cc>#-----------------------------</cc>
<cs>[MyHelloResource]</cs>
- <ck>greeting</ck> = <cv>Hello $A{person}!</cv>
- <ck>localizedGreeting</ck> = <cv>$L{HelloMessage,$A{person}}</cv>
+ <ck>greeting</ck> = <cv>Hello $R{path.person}!</cv>
+ <ck>localizedGreeting</ck> = <cv>$L{HelloMessage,$R{path.person}}</cv>
</p>
<p class='bcode'>
<cc>#---------------------------------</cc>
@@ -714,7 +719,7 @@
<li>The HTTP call matches the <l>/localized/{person}</l> path on the <l>sayLocalizedHello()</l> method.
<li>The request attribute <l>person</l> gets assigned the value <l>"Bob"</l>.
<li>The call to <l>req.getConfig().getString("MyHelloResource/localizedGreeting")</l>
- finds the value <l>"$L{HelloMessage,$A{person}}"</l>.
+ finds the value <l>"$L{HelloMessage,$R{path.person}}"</l>.
<li>The arguments in the <l>$L{}</l> variable get resolved, resulting in <l>"$L{HelloMessage,Bob}"</l>.
<li>The <l>$L{}</l> variable gets resolved to the message <l>"Hello {0}!"</l> in the localized properties file of the servlet based on the <l>Accept-Language</l> header on the request.
<li>The arguments get replaced in the message resulting in <l>"Hello Bob!"</l>.
@@ -743,7 +748,7 @@
*/</jd>
<ja>@RestResource</ja>(
path=<js>"/"</js>,
- label=<js>"Juneau Microservice Template"</js>,
+ title=<js>"Juneau Microservice Template"</js>,
description=<js>"Template for creating REST microservices"</js>,
properties={
<ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{options:'$R{servletURI}?method=OPTIONS'}"</js>)
@@ -782,7 +787,7 @@
*/</jd>
<ja>@RestResource</ja>(
path=<js>"/helloWorld"</js>,
- label=<js>"Hello World example"</js>,
+ title=<js>"Hello World example"</js>,
description=<js>"Simplest possible REST resource"</js>
)
<jk>public class</jk> HelloWorldResource <jk>extends</jk> Resource {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java
index 2e3cc4f..f09e860 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java
@@ -74,7 +74,7 @@ public class ConfigResource extends Resource {
@RestMethod(name="GET", path="/{section}",
description="Show config file section.",
parameters={
- @Var(in="path", name="section", description="Section name.")
+ @Parameter(in="path", name="section", description="Section name.")
}
)
public ObjectMap getConfigSection(@Path("section") String section) throws Exception {
@@ -92,8 +92,8 @@ public class ConfigResource extends Resource {
@RestMethod(name="GET", path="/{section}/{key}",
description="Show config file entry.",
parameters={
- @Var(in="path", name="section", description="Section name."),
- @Var(in="path", name="key", description="Entry name.")
+ @Parameter(in="path", name="section", description="Section name."),
+ @Parameter(in="path", name="key", description="Entry name.")
}
)
public String getConfigEntry(@Path("section") String section, @Path("key") String key) throws Exception {
@@ -110,7 +110,7 @@ public class ConfigResource extends Resource {
@RestMethod(name="POST", path="/",
description="Sets contents of config file from a FORM post.",
parameters={
- @Var(in="formData", name="contents", description="New contents in INI file format.")
+ @Parameter(in="formData", name="contents", description="New contents in INI file format.")
}
)
public ConfigFile setConfigContentsFormPost(@FormData("contents") String contents) throws Exception {
@@ -127,7 +127,7 @@ public class ConfigResource extends Resource {
@RestMethod(name="PUT", path="/",
description="Sets contents of config file.",
parameters={
- @Var(in="body", description="New contents in INI file format.")
+ @Parameter(in="body", description="New contents in INI file format.")
}
)
public ConfigFile setConfigContents(@Body Reader contents) throws Exception {
@@ -146,8 +146,8 @@ public class ConfigResource extends Resource {
@RestMethod(name="PUT", path="/{section}",
description="Add or overwrite a config file section.",
parameters={
- @Var(in="path", name="section", description="Section name."),
- @Var(in="body", description="New contents for section as a simple map with string keys and values.")
+ @Parameter(in="path", name="section", description="Section name."),
+ @Parameter(in="body", description="New contents for section as a simple map with string keys and values.")
}
)
public ObjectMap setConfigSection(@Path("section") String section, @Body Map<String,String> contents) throws Exception {
@@ -167,9 +167,9 @@ public class ConfigResource extends Resource {
@RestMethod(name="PUT", path="/{section}/{key}",
description="Add or overwrite a config file entry.",
parameters={
- @Var(in="path", name="section", description="Section name."),
- @Var(in="path", name="key", description="Entry name."),
- @Var(in="body", description="New value as a string.")
+ @Parameter(in="path", name="section", description="Section name."),
+ @Parameter(in="path", name="key", description="Entry name."),
+ @Parameter(in="body", description="New value as a string.")
}
)
public String setConfigSection(@Path("section") String section, @Path("key") String key, @Body String value) throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
index e18a9ad..d8cda6a 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
@@ -56,7 +56,7 @@ import org.apache.juneau.utils.*;
*/
@RestResource(
title="File System Explorer",
- description="Contents of $A{path}",
+ description="Contents of $R{attribute.path}",
messages="nls/DirectoryResource",
properties={
@Property(name=HTML_uriAnchorText, value=PROPERTY_NAME),
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-samples/src/main/java/org/apache/juneau/server/samples/MethodExampleResource.java
----------------------------------------------------------------------
diff --git a/juneau-samples/src/main/java/org/apache/juneau/server/samples/MethodExampleResource.java b/juneau-samples/src/main/java/org/apache/juneau/server/samples/MethodExampleResource.java
index c9a1765..5c83aaf 100755
--- a/juneau-samples/src/main/java/org/apache/juneau/server/samples/MethodExampleResource.java
+++ b/juneau-samples/src/main/java/org/apache/juneau/server/samples/MethodExampleResource.java
@@ -66,14 +66,14 @@ public class MethodExampleResource extends Resource {
String method = req.getMethod();
// Attributes (from URL pattern variables)
- String a1 = req.getAttribute("a1", String.class);
- int a2 = req.getAttribute("a2", int.class);
- UUID a3 = req.getAttribute("a3", UUID.class);
+ String a1 = req.getPathParameter("a1", String.class);
+ int a2 = req.getPathParameter("a2", int.class);
+ UUID a3 = req.getPathParameter("a3", UUID.class);
// Optional GET parameters
- int p1 = req.getParameter("p1", int.class, 0);
- String p2 = req.getParameter("p2", String.class);
- UUID p3 = req.getParameter("p3", UUID.class);
+ int p1 = req.getQueryParameter("p1", int.class, 0);
+ String p2 = req.getQueryParameter("p2", String.class);
+ UUID p3 = req.getQueryParameter("p3", UUID.class);
// URL pattern post-match
String remainder = req.getPathRemainder();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-samples/src/main/java/org/apache/juneau/server/samples/RootResources.java
----------------------------------------------------------------------
diff --git a/juneau-samples/src/main/java/org/apache/juneau/server/samples/RootResources.java b/juneau-samples/src/main/java/org/apache/juneau/server/samples/RootResources.java
index bbabc14..206f99c 100755
--- a/juneau-samples/src/main/java/org/apache/juneau/server/samples/RootResources.java
+++ b/juneau-samples/src/main/java/org/apache/juneau/server/samples/RootResources.java
@@ -30,6 +30,7 @@ import org.apache.juneau.server.samples.addressbook.*;
},
children={
HelloWorldResource.class,
+ SystemPropertiesResource.class,
MethodExampleResource.class,
RequestEchoResource.class,
TempDirResource.class,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-samples/src/main/java/org/apache/juneau/server/samples/SystemPropertiesResource.java
----------------------------------------------------------------------
diff --git a/juneau-samples/src/main/java/org/apache/juneau/server/samples/SystemPropertiesResource.java b/juneau-samples/src/main/java/org/apache/juneau/server/samples/SystemPropertiesResource.java
new file mode 100644
index 0000000..e9cee37
--- /dev/null
+++ b/juneau-samples/src/main/java/org/apache/juneau/server/samples/SystemPropertiesResource.java
@@ -0,0 +1,153 @@
+// ***************************************************************************************************************************
+// * 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.server.samples;
+
+import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+
+import java.util.*;
+
+import org.apache.juneau.dto.swagger.*;
+import org.apache.juneau.encoders.*;
+import org.apache.juneau.server.*;
+import org.apache.juneau.server.annotation.*;
+
+@RestResource(
+ path="/systemProperties",
+ title="System properties resource",
+ description="REST interface for performing CRUD operations on system properties.",
+ properties={
+ @Property(name=SERIALIZER_quoteChar, value="'"),
+ @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS'}"),
+ },
+ stylesheet="styles/devops.css",
+ encoders=GzipEncoder.class,
+ contact="{name:'John Smith',email:'john@smith.com'}",
+ license="{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}",
+ version="2.0",
+ termsOfService="You're on your own.",
+ tags="[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]",
+ externalDocs="{description:'Home page',url:'http://juneau.apache.org'}"
+)
+public class SystemPropertiesResource extends RestServletDefault {
+ private static final long serialVersionUID = 1L;
+
+ @RestMethod(
+ name="GET", path="/",
+ summary="Show all system properties",
+ description="Returns all system properties defined in the JVM.",
+ parameters={
+ @Parameter(in="query", name="sort", description="Sort results alphabetically.", _default="false")
+ },
+ responses={
+ @Response(value=200, description="Returns a map of key/value pairs.")
+ }
+ )
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public Map getSystemProperties(@Query("sort") boolean sort) throws Throwable {
+ if (sort)
+ return new TreeMap(System.getProperties());
+ return System.getProperties();
+ }
+
+ @RestMethod(
+ name="GET", path="/{propertyName}",
+ summary="Get system property",
+ description="Returns the value of the specified system property.",
+ parameters={
+ @Parameter(in="path", name="propertyName", description="The system property name.")
+ },
+ responses={
+ @Response(value=200, description="The system property value, or null if not found.")
+ }
+ )
+ public String getSystemProperty(@Path String propertyName) throws Throwable {
+ return System.getProperty(propertyName);
+ }
+
+ @RestMethod(
+ name="PUT", path="/{propertyName}",
+ summary="Replace system property",
+ description="Sets a new value for the specified system property.",
+ guards=AdminGuard.class,
+ parameters={
+ @Parameter(in="path", name="propertyName", description="The system property name."),
+ @Parameter(in="body", description="The new system property value."),
+ },
+ responses={
+ @Response(value=302,
+ headers={
+ @Parameter(name="Location", description="The root URL of this resource.")
+ }
+ ),
+ @Response(value=403, description="User is not an admin.")
+ }
+ )
+ public Redirect setSystemProperty(@Path String propertyName, @Body String value) {
+ System.setProperty(propertyName, value);
+ return new Redirect();
+ }
+
+ @RestMethod(
+ name="POST", path="/",
+ summary="Add an entire set of system properties",
+ description="Takes in a map of key/value pairs and creates a set of new system properties.",
+ guards=AdminGuard.class,
+ parameters={
+ @Parameter(in="path", name="propertyName", description="The system property key."),
+ @Parameter(in="body", description="The new system property values.", schema="{example:{key1:'val1',key2:123}}"),
+ },
+ responses={
+ @Response(value=302,
+ headers={
+ @Parameter(name="Location", description="The root URL of this resource.")
+ }
+ ),
+ @Response(value=403, description="Unauthorized: User is not an admin.")
+ }
+ )
+ public Redirect setSystemProperties(@Body java.util.Properties newProperties) {
+ System.setProperties(newProperties);
+ return new Redirect();
+ }
+
+ @RestMethod(
+ name="DELETE", path="/{propertyName}",
+ summary="Delete system property",
+ description="Deletes the specified system property.",
+ guards=AdminGuard.class,
+ parameters={
+ @Parameter(in="path", name="propertyName", description="The system property name."),
+ },
+ responses={
+ @Response(value=302,
+ headers={
+ @Parameter(name="Location", description="The root URL of this resource.")
+ }
+ ),
+ @Response(value=403, description="Unauthorized: User is not an admin")
+ }
+ )
+ public Redirect deleteSystemProperty(@Path String propertyName) {
+ System.clearProperty(propertyName);
+ return new Redirect();
+ }
+
+ @RestMethod(
+ name="OPTIONS", path="/*",
+ summary="Show resource options",
+ description="Show resource options as a Swagger doc"
+ )
+ public Swagger getOptions(RestRequest req) {
+ return req.getSwagger();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-samples/src/main/resources/org/apache/juneau/server/samples/addressbook/nls/AddressBookResource.properties
----------------------------------------------------------------------
diff --git a/juneau-samples/src/main/resources/org/apache/juneau/server/samples/addressbook/nls/AddressBookResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/server/samples/addressbook/nls/AddressBookResource.properties
index fcb3f67..61aec3e 100755
--- a/juneau-samples/src/main/resources/org/apache/juneau/server/samples/addressbook/nls/AddressBookResource.properties
+++ b/juneau-samples/src/main/resources/org/apache/juneau/server/samples/addressbook/nls/AddressBookResource.properties
@@ -29,7 +29,7 @@ getPerson.summary = Get a single person by ID
getPerson.req.path.id.description = Person ID
getPerson.req.path.id.type = integer
getPerson.res.200.description = Returns a serialized Person bean
-getAllPeople.res.200.examples = {'text/json':"{\n\turi:'http://hostname/addressBook/person/1',\n\taddressBookUri:'http://localhost/addressBook',\n\tid:1,\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\tid:1,\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"}
+getPerson.res.200.examples = {'text/json':"{\n\turi:'http://hostname/addressBook/person/1',\n\taddressBookUri:'http://localhost/addressBook',\n\tid:1,\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\tid:1,\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"}
getPerson.res.404.description = Person ID not found
getAllAddresses.summary = Get all addresses in the address book
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java
index 074a410..63f46ad 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java
@@ -49,20 +49,20 @@ public class NlsResource extends RestServletGroupDefault {
name="POST", path="/{a}",
description="Test1.c",
parameters={
- @Var(in="path", name="a", description="Test1.d"),
- @Var(in="query", name="b", description="Test1.e"),
- @Var(in="body", description="Test1.f"),
- @Var(in="header", name="D", description="Test1.g"),
- @Var(in="path", name="a2", description="Test1.h"),
- @Var(in="query", name="b2", description="Test1.i"),
- @Var(in="header", name="D2", description="Test1.j"),
+ @Parameter(in="path", name="a", description="Test1.d"),
+ @Parameter(in="query", name="b", description="Test1.e"),
+ @Parameter(in="body", description="Test1.f"),
+ @Parameter(in="header", name="D", description="Test1.g"),
+ @Parameter(in="path", name="a2", description="Test1.h"),
+ @Parameter(in="query", name="b2", description="Test1.i"),
+ @Parameter(in="header", name="D2", description="Test1.j"),
},
responses={
@Response(200),
@Response(value=201,
description="Test1.l",
headers={
- @Var(in="foo", name="bar", description="Test1.m"),
+ @Parameter(in="foo", name="bar", description="Test1.m"),
}
)
}
@@ -167,20 +167,20 @@ public class NlsResource extends RestServletGroupDefault {
name="POST", path="/{a}",
description="$L{foo}",
parameters={
- @Var(in="path", name="a", description="$L{foo}"),
- @Var(in="query", name="b", description="$L{foo}"),
- @Var(in="body", description="$L{foo}"),
- @Var(in="header", name="D", description="$L{foo}"),
- @Var(in="path", name="a2", description="$L{foo}"),
- @Var(in="query", name="b2", description="$L{foo}"),
- @Var(in="header", name="D2", description="$L{foo}")
+ @Parameter(in="path", name="a", description="$L{foo}"),
+ @Parameter(in="query", name="b", description="$L{foo}"),
+ @Parameter(in="body", description="$L{foo}"),
+ @Parameter(in="header", name="D", description="$L{foo}"),
+ @Parameter(in="path", name="a2", description="$L{foo}"),
+ @Parameter(in="query", name="b2", description="$L{foo}"),
+ @Parameter(in="header", name="D2", description="$L{foo}")
},
responses={
@Response(200),
@Response(value=201,
description="$L{foo}",
headers={
- @Var(in="foo", name="bar", description="$L{foo}"),
+ @Parameter(in="foo", name="bar", description="$L{foo}"),
}
)
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server-test/src/main/java/org/apache/juneau/server/test/OverlappingMethodsResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/OverlappingMethodsResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/OverlappingMethodsResource.java
index f3dc673..9c5d3ff 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/OverlappingMethodsResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/OverlappingMethodsResource.java
@@ -45,14 +45,14 @@ public class OverlappingMethodsResource extends RestServletDefault {
public static class Test1Guard extends RestGuard {
@Override /* RestGuard */
public boolean isRequestAllowed(RestRequest req) {
- return req.getParameter("t1","").equals("1");
+ return req.getQueryParameter("t1","").equals("1");
}
}
public static class Test2Guard extends RestGuard {
@Override /* RestGuard */
public boolean isRequestAllowed(RestRequest req) {
- return req.getParameter("t2","").equals("2");
+ return req.getQueryParameter("t2","").equals("2");
}
}
@@ -77,14 +77,14 @@ public class OverlappingMethodsResource extends RestServletDefault {
public static class Test3aMatcher extends RestMatcher {
@Override /* RestMatcher */
public boolean matches(RestRequest req) {
- return req.getParameter("t1","").equals("1");
+ return req.getQueryParameter("t1","").equals("1");
}
}
public static class Test3bMatcher extends RestMatcher {
@Override /* RestMatcher */
public boolean matches(RestRequest req) {
- return req.getParameter("t2","").equals("2");
+ return req.getQueryParameter("t2","").equals("2");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java
index b2cc2d1..a7e0237 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java
@@ -117,7 +117,7 @@ public class ParamsResource extends RestServletDefault {
//====================================================================================================
@RestMethod(name="GET", path="/testParamGet/*")
public String testParamGet(RestRequest req, @Query("p1") String p1, @Query("p2") int p2) throws Exception {
- return "p1=["+p1+","+req.getParameter("p1")+","+req.getParameter("p1", String.class)+"],p2=["+p2+","+req.getParameter("p2")+","+req.getParameter("p2", int.class)+"]";
+ return "p1=["+p1+","+req.getQueryParameter("p1")+","+req.getQueryParameter("p1", String.class)+"],p2=["+p2+","+req.getQueryParameter("p2")+","+req.getQueryParameter("p2", int.class)+"]";
}
//====================================================================================================
@@ -125,7 +125,7 @@ public class ParamsResource extends RestServletDefault {
//====================================================================================================
@RestMethod(name="POST", path="/testParamPost/*")
public String testParamPost(RestRequest req, @FormData("p1") String p1, @FormData("p2") int p2) throws Exception {
- return "p1=["+p1+","+req.getParameter("p1")+","+req.getParameter("p1", String.class)+"],p2=["+p2+","+req.getParameter("p2")+","+req.getParameter("p2", int.class)+"]";
+ return "p1=["+p1+","+req.getFormDataParameter("p1")+","+req.getFormDataParameter("p1", String.class)+"],p2=["+p2+","+req.getFormDataParameter("p2")+","+req.getFormDataParameter("p2", int.class)+"]";
}
//====================================================================================================
@@ -149,7 +149,7 @@ public class ParamsResource extends RestServletDefault {
//====================================================================================================
@RestMethod(name="GET", path="/testPlainParamGet/*")
public String testPlainParamGet(RestRequest req, @Query(value="p1",format="PLAIN") String p1) throws Exception {
- return "p1=["+p1+","+req.getParameter("p1")+","+req.getParameter("p1", String.class)+"]";
+ return "p1=["+p1+","+req.getQueryParameter("p1")+","+req.getQueryParameter("p1", String.class)+"]";
}
//====================================================================================================
@@ -157,7 +157,7 @@ public class ParamsResource extends RestServletDefault {
//====================================================================================================
@RestMethod(name="POST", path="/testPlainParamPost/*")
public String testPlainParamPost(RestRequest req, @FormData(value="p1",format="PLAIN") String p1) throws Exception {
- return "p1=["+p1+","+req.getParameter("p1")+","+req.getParameter("p1", String.class)+"]";
+ return "p1=["+p1+","+req.getFormDataParameter("p1")+","+req.getFormDataParameter("p1", String.class)+"]";
}
//====================================================================================================
@@ -181,7 +181,7 @@ public class ParamsResource extends RestServletDefault {
//====================================================================================================
@RestMethod(name="GET", path="/testHasParamGet/*")
public String testHasParamGet(RestRequest req, @HasQuery("p1") boolean p1, @HasQuery("p2") Boolean p2) throws Exception {
- return "p1=["+p1+","+req.hasParameter("p1")+"],p2=["+p2+","+req.hasParameter("p2")+"]";
+ return "p1=["+p1+","+req.hasQueryParameter("p1")+"],p2=["+p2+","+req.hasQueryParameter("p2")+"]";
}
//====================================================================================================
@@ -189,7 +189,7 @@ public class ParamsResource extends RestServletDefault {
//====================================================================================================
@RestMethod(name="POST", path="/testHasParamPost/*")
public String testHasParamPost(RestRequest req, @HasFormData("p1") boolean p1, @HasFormData("p2") Boolean p2) throws Exception {
- return "p1=["+p1+","+req.hasParameter("p1")+"],p2=["+p2+","+req.hasParameter("p2")+"]";
+ return "p1=["+p1+","+req.hasFormDataParameter("p1")+"],p2=["+p2+","+req.hasFormDataParameter("p2")+"]";
}
//====================================================================================================
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/ReaderResource.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/ReaderResource.java b/juneau-server/src/main/java/org/apache/juneau/server/ReaderResource.java
index 1a2805c..7367678 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/ReaderResource.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/ReaderResource.java
@@ -16,12 +16,13 @@ import java.io.*;
import java.util.*;
import org.apache.juneau.*;
+import org.apache.juneau.server.annotation.*;
import org.apache.juneau.server.response.*;
import org.apache.juneau.svl.*;
/**
* Represents the contents of a text file with convenience methods for resolving
- * {@link Var} variables and adding HTTP response headers.
+ * {@link Parameter} variables and adding HTTP response headers.
* <p>
* This class is handled special by the {@link WritableHandler} class.
*
@@ -58,7 +59,7 @@ public class ReaderResource implements Writable {
}
/**
- * Use the specified {@link VarResolver} to resolve any {@link Var StringVars} in the
+ * Use the specified {@link VarResolver} to resolve any {@link Parameter StringVars} in the
* contents of this file when the {@link #writeTo(Writer)} or {@link #toString()} methods are called.
*
* @param varSession The string variable resolver to use to resolve string variables.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/RestConverter.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/RestConverter.java b/juneau-server/src/main/java/org/apache/juneau/server/RestConverter.java
index b218936..ee81f58 100755
--- a/juneau-server/src/main/java/org/apache/juneau/server/RestConverter.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/RestConverter.java
@@ -24,7 +24,7 @@ import org.apache.juneau.server.converters.*;
* converted to some other POJO after invocation of the REST method.
* <p>
* Converters are associated with REST methods through the {@link RestMethod#converters()} annotation.
- * <h6 class='topic'>Example</h6>
+ * <h6 class='topic'>Example:</h6>
* <p class='bcode'>
* <jk>public class</jk> RequestEchoResource <jk>extends</jk> RestServlet {
*