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 2017/06/27 02:38:22 UTC
[08/19] incubator-juneau git commit: Clean up javadocs.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
index 672fd69..9116112 100644
--- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
+++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java
@@ -73,7 +73,7 @@ public class TempDirResource extends DirectoryResource {
FileItemIterator iter = upload.getItemIterator(req);
while (iter.hasNext()) {
FileItemStream item = iter.next();
- if (item.getFieldName().equals("contents")) { //$NON-NLS-1$
+ if (item.getFieldName().equals("contents")) {
File f = new File(getRootDir(), item.getName());
IOPipe.create(item.openStream(), new FileOutputStream(f)).closeOut().run();
}
@@ -86,7 +86,7 @@ public class TempDirResource extends DirectoryResource {
@Override /* RestMatcher */
public boolean matches(RestRequest req) {
String contentType = req.getContentType();
- return contentType != null && contentType.startsWith("multipart/form-data"); //$NON-NLS-1$
+ return contentType != null && contentType.startsWith("multipart/form-data");
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/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 b65aa34..4aabb8f 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
@@ -44,9 +44,12 @@ import org.apache.juneau.utils.*;
* This class defines the following method for accessing configuration for your microservice:
* <p>
* <ul class='spaced-list'>
- * <li>{@link #getArgs()} - The command-line arguments passed to the jar file.
- * <li>{@link #getConfig()} - An external INI-style configuration file.
- * <li>{@link #getManifest()} - The manifest file for the main jar file.
+ * <li>
+ * {@link #getArgs()} - The command-line arguments passed to the jar file.
+ * <li>
+ * {@link #getConfig()} - An external INI-style configuration file.
+ * <li>
+ * {@link #getManifest()} - The manifest file for the main jar file.
* </ul>
*
* <h6 class='topic'>Entry point Method</h6>
@@ -65,9 +68,12 @@ import org.apache.juneau.utils.*;
* Subclasses must implement the following lifecycle methods:
* <p>
* <ul class='spaced-list'>
- * <li>{@link #start()} - Gets executed during startup.
- * <li>{@link #stop()} - Gets executed when 'exit' is typed in the console or an external shutdown signal is received.
- * <li>{@link #kill()} - Can be used to forcibly shut down the service. Doesn't get called during normal operation.
+ * <li>
+ * {@link #start()} - Gets executed during startup.
+ * <li>
+ * {@link #stop()} - Gets executed when 'exit' is typed in the console or an external shutdown signal is received.
+ * <li>
+ * {@link #kill()} - Can be used to forcibly shut down the service. Doesn't get called during normal operation.
* </ul>
*
* <h6 class='topic'>Lifecycle Listener Methods</h6>
@@ -75,10 +81,14 @@ import org.apache.juneau.utils.*;
* Subclasses can optionally implement the following event listener methods:
* <p>
* <ul class='spaced-list'>
- * <li>{@link #onStart()} - Gets executed before {@link #start()}.
- * <li>{@link #onStop()} - Gets executed before {@link #stop()}.
- * <li>{@link #onConfigSave(ConfigFile)} - Gets executed after a config file has been saved.
- * <li>{@link #onConfigChange(ConfigFile, Set)} - Gets executed after a config file has been modified.
+ * <li>
+ * {@link #onStart()} - Gets executed before {@link #start()}.
+ * <li>
+ * {@link #onStop()} - Gets executed before {@link #stop()}.
+ * <li>
+ * {@link #onConfigSave(ConfigFile)} - Gets executed after a config file has been saved.
+ * <li>
+ * {@link #onConfigChange(ConfigFile, Set)} - Gets executed after a config file has been modified.
* </ul>
*
* <h6 class='topic'>Other Methods</h6>
@@ -86,7 +96,8 @@ import org.apache.juneau.utils.*;
* Subclasses can optionally override the following methods to provide customized behavior:
* <p>
* <ul class='spaced-list'>
- * <li>{@link #createVarResolver()} - Creates the {@link VarResolver} used to resolve variables in the config file
+ * <li>
+ * {@link #createVarResolver()} - Creates the {@link VarResolver} used to resolve variables in the config file
* returned by {@link #getConfig()}.
* </ul>
*/
@@ -285,9 +296,12 @@ public abstract class Microservice {
* <p>
* The config file location is determined in the following order:
* <ol class='spaced-list'>
- * <li>The first argument passed to the microservice jar.
- * <li>The <code>Main-ConfigFile</code> entry in the microservice jar manifest file.
- * <li>The name of the microservice jar with a <js>".cfg"</js> suffix (e.g.
+ * <li>
+ * The first argument passed to the microservice jar.
+ * <li>
+ * The <code>Main-ConfigFile</code> entry in the microservice jar manifest file.
+ * <li>
+ * The name of the microservice jar with a <js>".cfg"</js> suffix (e.g.
* <js>"mymicroservice.jar"</js>-><js>"mymicroservice.cfg"</js>).
* </ol>
* <p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java
index 38b5c69..2c6283c 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java
@@ -22,15 +22,17 @@ import org.apache.juneau.svl.vars.*;
* In additional to the functionality of the {@link RestServletDefault} group,
* augments the {@link RestContext#getVarResolver()} method with the following additional variable types:
* <ul class='spaced-list'>
- * <li><code class='snippet'>$ARG{...}</code> - Command line arguments pulled from {@link Microservice#getArgs()}.
- * <br>
- * <h6 class='figure'>Example:</h6>
+ * <li>
+ * <code class='snippet'>$ARG{...}</code> - Command line arguments pulled from {@link Microservice#getArgs()}.
+ *
+ * <h6 class='figure'>Example:</h6>
* <p class='bcode'>
* String firstArg = request.getVarResolver().resolve(<js>"$ARG{0}"</js>); <jc>// First argument.</jc>
* String namedArg = request.getVarResolver().resolve(<js>"$ARG{myarg}"</js>); <jc>// Named argument (e.g. "myarg=foo"). </jc>
* </p>
- * <li><code class='snippet'>$MF{...}</code> - Manifest file entries pulled from {@link Microservice#getManifest()}.
- * <br>
+ * <li>
+ * <code class='snippet'>$MF{...}</code> - Manifest file entries pulled from {@link Microservice#getManifest()}.
+ *
* <h6 class='figure'>Example:</h6>
* <p class='bcode'>
* String mainClass = request.getVarResolver().resolve(<js>"$MF{Main-Class}"</js>); <jc>// Main class. </jc>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java
index 8728c00..793ab6e 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java
@@ -22,16 +22,18 @@ import org.apache.juneau.svl.vars.*;
* In additional to the functionality of the {@link RestServletGroupDefault} group,
* augments the {@link RestContext#getVarResolver()} method with the following additional variable types:
* <ul class='spaced-list'>
- * <li><jk>$ARG{...}</jk> - Command line arguments.
- * <br>
- * Resolves values from {@link Microservice#getArgs()}.
- * <br>
+ * <li>
+ * <jk>$ARG{...}</jk> - Command line arguments.
+ * <br>Resolves values from {@link Microservice#getArgs()}.
+ *
* <h6>Example:</h6>
* <p class='bcode'>
* String firstArg = request.getVarResolver().resolve(<js>"$ARG{0}"</js>); <jc>// First argument.</jc>
* String namedArg = request.getVarResolver().resolve(<js>"$ARG{myarg}"</js>); <jc>// Named argument (e.g. "myarg=foo"). </jc>
* </p>
- * <li><jk>$MF{...}</jk> - Manifest file entries.
+ * <li>
+ * <jk>$MF{...}</jk> - Manifest file entries.
+ *
* <h6>Example:</h6>
* <p class='bcode'>
* String mainClass = request.getVarResolver().resolve(<js>"$MF{Main-Class}"</js>); <jc>// Main class. </jc>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java
index 6765849..6fbdd72 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java
@@ -46,13 +46,11 @@ import org.eclipse.jetty.util.ssl.*;
* <p>
* The Jetty server is created by the {@link #createServer()} method and started with the {@link #startServer()} method.
* These methods can be overridden to provided customized behavior.
- * <p>
*
* <h6 class='topic'>Defining REST Resources</h6>
* <p>
* Top-level REST resources are defined by the {@link #getResourceMap()} method.
* This method can be overridden to provide a customized list of REST resources.
- * <p>
*
* <h6 class='topic'>Logging</h6>
* <p>
@@ -62,13 +60,20 @@ import org.eclipse.jetty.util.ssl.*;
* <h6 class='topic'>Lifecycle Listener Methods</h6>
* Subclasses can optionally implement the following event listener methods:
* <ul class='spaced-list'>
- * <li>{@link #onStart()} - Gets executed before {@link #start()}.
- * <li>{@link #onStop()} - Gets executed before {@link #stop()}.
- * <li>{@link #onCreateServer()} - Gets executed before {@link #createServer()}.
- * <li>{@link #onStartServer()} - Gets executed before {@link #startServer()}.
- * <li>{@link #onPostStartServer()} - Gets executed after {@link #startServer()}.
- * <li>{@link #onStopServer()} - Gets executed before {@link #stop()}.
- * <li>{@link #onPostStopServer()} - Gets executed after {@link #stop()}.
+ * <li>
+ * {@link #onStart()} - Gets executed before {@link #start()}.
+ * <li>
+ * {@link #onStop()} - Gets executed before {@link #stop()}.
+ * <li>
+ * {@link #onCreateServer()} - Gets executed before {@link #createServer()}.
+ * <li>
+ * {@link #onStartServer()} - Gets executed before {@link #startServer()}.
+ * <li>
+ * {@link #onPostStartServer()} - Gets executed after {@link #startServer()}.
+ * <li>
+ * {@link #onStopServer()} - Gets executed before {@link #stop()}.
+ * <li>
+ * {@link #onPostStopServer()} - Gets executed after {@link #stop()}.
* </ul>
*/
public class RestMicroservice extends Microservice {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/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 02b427a..7b00fca 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
@@ -96,14 +96,20 @@
Features include:
</p>
<ul class='spaced-list'>
- <li>An out-of-the-box zipped Eclipse project to get started quickly.
- <li>Packaged as a simple executable jar and configuration file.
- <li>All the power of the Juneau Cloud Tools for defining REST servlets and clients with the ability to
+ <li>
+ An out-of-the-box zipped Eclipse project to get started quickly.
+ <li>
+ Packaged as a simple executable jar and configuration file.
+ <li>
+ All the power of the Juneau Cloud Tools for defining REST servlets and clients with the ability to
serialize and parse POJOs as HTML, JSON, XML, RDF, URL-Encoding, and others.
- <li>An extensible API that allows you to hook into various lifecycle events.
- <li>Simple-to-use APIs for accessing manifest file entries, command-line arguments, and external configuration
+ <li>
+ An extensible API that allows you to hook into various lifecycle events.
+ <li>
+ Simple-to-use APIs for accessing manifest file entries, command-line arguments, and external configuration
file properties.
- <li>Predefined REST resources for configuring microservice and accessing log files.
+ <li>
+ Predefined REST resources for configuring microservice and accessing log files.
</ul>
</div>
@@ -124,15 +130,19 @@
Follow these instructions to create a new template project in Eclipse.
</p>
<ol class='spaced-list'>
- <li>Download the latest microservice-project zip file (e.g. <l>microservice-project-5.2.zip</l>).
- <li>In your Eclipse workspace, go to <b>File->Import->General->Existing Projects into Workspace</b>
+ <li>
+ Download the latest microservice-project zip file (e.g. <l>microservice-project-5.2.zip</l>).
+ <li>
+ In your Eclipse workspace, go to <b>File->Import->General->Existing Projects into Workspace</b>
and click <b>Next</b>.
<br><br>
<img class='bordered' src="doc-files/instructions1.png">
- <li>Select the zip file and click <b>Finish</b>.
+ <li>
+ Select the zip file and click <b>Finish</b>.
<br><br>
<img class='bordered' src="doc-files/instructions2.png">
- <li>In your workspace, you should now see the following project:
+ <li>
+ In your workspace, you should now see the following project:
<br><br>
<img class='bordered' src="doc-files/instructions3.png">
</ol>
@@ -140,8 +150,9 @@
The important elements in this project are:
</p>
<ul class='spaced-list'>
- <li><l>META-INF/MANIFEST.MF</l> - The manifest file. <br>
- This defines the entry point, classpath, top-level REST resources, and location of external
+ <li>
+ <l>META-INF/MANIFEST.MF</l> - The manifest file.
+ <br>This defines the entry point, classpath, top-level REST resources, and location of external
configuration file.
<br><br>
<p class='bcode'>
@@ -161,12 +172,12 @@
lib/juneau-all-5.2.jar
lib/org.apache.commons.fileupload_1.3.1.jar
</p>
- <li><l>RestMicroservice.java</l> - The application class.
- <br>
- This is a specialized microservice in Juneau for exposing REST servlets.
- <li><l>RootResources.java</l> - The top-level REST resource.
- <br>
- This class routes HTTP requests to child resources:
+ <li>
+ <l>RestMicroservice.java</l> - The application class.
+ <br>This is a specialized microservice in Juneau for exposing REST servlets.
+ <li>
+ <l>RootResources.java</l> - The top-level REST resource.
+ <br>This class routes HTTP requests to child resources:
<br><br>
<p class='bcode'>
<jd>/**
@@ -189,10 +200,11 @@
<jc>// No actual code!</jc>
}
</p>
- <li><l>microservice.cfg</l> - The external configuration file. <br>
- A deceivingly simple yet powerful INI-style configuration file:
+ <li>
+ <l>microservice.cfg</l> - The external configuration file.
+ <br>A deceivingly simple yet powerful INI-style configuration file:
<br><br>
- <p class='bcode'>
+ <p class='bcode'>
<cc>#================================================================================
# Basic configuration file for SaaS microservices
# Subprojects can use this as a starting point.
@@ -322,15 +334,15 @@
Other manifest file entries are also provided:
</p>
<ul class='spaced-list'>
- <li><mk>Rest-Port</mk> - The HTTP port to use. Default is <l>10000</l>.
- <li><mk>Rest-ContextPath</mk> - The servlet context path. Default is <l>"/"</l>.
- <li><mk>Rest-AuthType</mk> - Authentication support.
- <br>
- Possible values are <l>"NONE"</l> and <l>"BASIC"</l>.
- <br>
- Default is <l>"NONE"</l>.
- <br>
- Used with the following additional settings:
+ <li>
+ <mk>Rest-Port</mk> - The HTTP port to use. Default is <l>10000</l>.
+ <li>
+ <mk>Rest-ContextPath</mk> - The servlet context path. Default is <l>"/"</l>.
+ <li>
+ <mk>Rest-AuthType</mk> - Authentication support.
+ <br>Possible values are <l>"NONE"</l> and <l>"BASIC"</l>.
+ <br>Default is <l>"NONE"</l>.
+ <br>Used with the following additional settings:
<ul>
<li><mk>Rest-LoginUser</mk>
<li><mk>Rest-LoginPassword</mk>
@@ -541,12 +553,17 @@
capabilities, including:
</p>
<ul class='spaced-list'>
- <li>The ability to use variables to reference environment variables, system properties, other config file
+ <li>
+ The ability to use variables to reference environment variables, system properties, other config file
entries, and a host of other types.
- <li>The ability to store and retrieve POJOs as JSON.
- <li>APIs for updating, modifying, and saving configuration files without losing comments or formatting.
- <li>Extensive listener APIs.
+ <li>
+ The ability to store and retrieve POJOs as JSON.
+ <li>
+ APIs for updating, modifying, and saving configuration files without losing comments or formatting.
+ <li>
+ Extensive listener APIs.
</ul>
+
<h6 class='topic'>Examples:</h6>
<p class='bcode'>
<cc>#--------------------------</cc>
@@ -614,9 +631,11 @@
String myArg = cf.getString(<js>"MySection/myArg"</js>);
String firstArg = cf.getString(<js>"MySection/firstArg"</js>);
</p>
+
<h6 class='topic'>Additional Information</h6>
<ul class='doctree'>
- <li class='jp'><a href='../core/ini/package-summary.html#TOC'><l>org.apache.juneau.ini</l></a>
+ <li class='jp'>
+ <a href='../core/ini/package-summary.html#TOC'><l>org.apache.juneau.ini</l></a>
- Juneau Configuration API Javadocs.
</ul>
@@ -628,10 +647,10 @@
There are 3 primary ways of getting access to the config file.
</p>
<ul class='doctree'>
- <li class='jm'>{@link org.apache.juneau.microservice.Microservice#getConfig()}
+ <li class='jm'>
+ {@link org.apache.juneau.microservice.Microservice#getConfig()}
- A static method that can be used to access the config file from anywhere in your application.
- <br>
- When using this method, any of the following variables can be resolved:
+ <br>When using this method, any of the following variables can be resolved:
<ul>
<li><l>$S{key}, $S{key,default}</l> - System properties.
<li><l>$E{key}, $E{key,default}</l> - Environment variables.
@@ -642,13 +661,14 @@
Additional user-defined variables can be defined by overriding the
{@link org.apache.juneau.microservice.Microservice#createVarResolver()} method
and using the {@link org.apache.juneau.rest.RestConfig#addVars(Class...)} method.
- <li class='jm'>{@link org.apache.juneau.rest.RestContext#getConfigFile()}
+ <li class='jm'>
+ {@link org.apache.juneau.rest.RestContext#getConfigFile()}
- An instance method to access it from inside a REST servlet.
- <br>
- The following variables are available in addition to the variables defined above:
+ <br>The following variables are available in addition to the variables defined above:
<ul>
<li><l>$I{key}, $I{key,default}</l> - Servlet initialization parameters.
</ul>
+
<h6 class='figure'>Example usage:</h6>
<p class='bcode'>
<cc>#-------------------------------</cc>
@@ -675,10 +695,10 @@
{@link org.apache.juneau.microservice.Resource#init(RestConfig)} method
and using the {@link org.apache.juneau.rest.RestConfig#addVars(Class...)} method.
</p>
- <li class='jm'>{@link org.apache.juneau.rest.RestRequest#getConfigFile()}
+ <li class='jm'>
+ {@link org.apache.juneau.rest.RestRequest#getConfigFile()}
- An instance method to access it from inside a REST method.
- <br>
- The following variables are available in addition to the variables defined above:
+ <br>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.rest.RestRequest#getMessage(String, Object...)}.
@@ -705,6 +725,7 @@
<li><l>$SA{key,mediaType}</l> - Object returned by {@link org.apache.juneau.rest.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.
</ul>
+
<h6 class='figure'>Example usage:</h6>
<p class='bcode'>
<cc>#-----------------------------</cc>
@@ -753,16 +774,24 @@
Here's what happens when an HTTP call is made to <l>GET /hello/localized/Bob</l>:
</p>
<ol class='spaced-list'>
- <li>The HTTP call matches the <l>/hello</l> path on the <l>MyHelloResource</l> class.
- <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>
+ <li>
+ The HTTP call matches the <l>/hello</l> path on the <l>MyHelloResource</l> class.
+ <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,$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
+ <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>.
- <li>The resulting message <l>"Hello Bob!"</l> is returned as a POJO to be serialized to whatever content
+ <li>
+ The arguments get replaced in the message resulting in <l>"Hello Bob!"</l>.
+ <li>
+ The resulting message <l>"Hello Bob!"</l> is returned as a POJO to be serialized to whatever content
type was specified on the <l>Accept</l> header on the request.
</ol>
<p>
@@ -805,17 +834,17 @@
}
</p>
<ul class='spaced-list'>
- <li>The </l>label</l> and <l>description</l> annotations define the titles on the page.
- <br>
- These can be globalized using <l>$L{...}</l> variables, or by defining specially-named properties in the
+ <li>
+ The </l>label</l> and <l>description</l> annotations define the titles on the page.
+ <br>These can be globalized using <l>$L{...}</l> variables, or by defining specially-named properties in the
properties file for the resource.
- <li>In this case, the <l>path</l> annotation defines the context root of your application since it was
+ <li>
+ In this case, the <l>path</l> annotation defines the context root of your application since it was
not specified in the manifest or config file.
- <br>
- Therefore, this resource is mapped to <l>http://localhost:10000</l>.
- <li>The <l>children</l> annotation make up the list of child resources.
- <br>
- These child resources can be anything that extends from <l>Servlet</l>, although usually
+ <br>Therefore, this resource is mapped to <l>http://localhost:10000</l>.
+ <li>
+ The <l>children</l> annotation make up the list of child resources.
+ <br>These child resources can be anything that extends from <l>Servlet</l>, although usually
they will be subclasses of {@link org.apache.juneau.microservice.Resource} or other resource groups.
</ul>
<p>
@@ -848,9 +877,11 @@
classes are powerful servlets designed specifically for creating REST APIs using nothing more than serialized
and parsed POJOs.
</p>
+
<h6 class='topic'>Additional Information</h6>
<ul class='doctree'>
- <li class='jp'><a href='../server/package-summary.html#TOC'><l>org.apache.juneau.rest</l></a>
+ <li class='jp'>
+ <a href='../server/package-summary.html#TOC'><l>org.apache.juneau.rest</l></a>
- Juneau Server API Javadocs.
</ul>
</div>
@@ -868,14 +899,17 @@
The class hierarchy is:
</p>
<ul class='doctree'>
- <li class='jac'>{@link org.apache.juneau.microservice.Microservice}
+ <li class='jac'>
+ {@link org.apache.juneau.microservice.Microservice}
- Abstract class that defines simple start/stop methods and access to the manifest file, config file, and
arguments.
<ul>
- <li class='jc'>{@link org.apache.juneau.microservice.RestMicroservice}
+ <li class='jc'>
+ {@link org.apache.juneau.microservice.RestMicroservice}
- Specialized microservice for starting up REST interfaces using Jetty and specifying REST servlets
through the manifest file or config file.
</ul>
+ </li>
</ul>
<p>
Refer to the Javadocs for these class for more information.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/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 060a7e6..99ea01c 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
@@ -39,16 +39,21 @@ import org.apache.juneau.utils.*;
* The root directory is specified in one of two ways:
* </p>
* <ul class='spaced-list'>
- * <li>Specifying the location via a <l>DirectoryResource.rootDir</l> property.
- * <li>Overriding the {@link #getRootDir()} method.
+ * <li>
+ * Specifying the location via a <l>DirectoryResource.rootDir</l> property.
+ * <li>
+ * Overriding the {@link #getRootDir()} method.
* </ul>
* <p>
* Read/write access control is handled through the following properties:
* </p>
* <ul class='spaced-list'>
- * <li><l>DirectoryResource.allowViews</l> - If <jk>true</jk>, allows view and download access to files.
- * <li><l>DirectoryResource.allowPuts</l> - If <jk>true</jk>, allows files to be created or overwritten.
- * <li><l>DirectoryResource.allowDeletes</l> - If <jk>true</jk>, allows files to be deleted.
+ * <li>
+ * <l>DirectoryResource.allowViews</l> - If <jk>true</jk>, allows view and download access to files.
+ * <li>
+ * <l>DirectoryResource.allowPuts</l> - If <jk>true</jk>, allows files to be created or overwritten.
+ * <li>
+ * <l>DirectoryResource.allowDeletes</l> - If <jk>true</jk>, allows files to be deleted.
* </ul>
* <p>
* Access can also be controlled by overriding the {@link #checkAccess(RestRequest)} method.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java
index 8731183..ad547fb 100644
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java
@@ -27,9 +27,13 @@ import java.util.regex.*;
* <p>
* Uses three simple parameter for configuring log entry formats:
* <ul class='spaced-list'>
- * <li><code>dateFormat</code> - A {@link SimpleDateFormat} string describing the format for dates.
- * <li><code>format</code> - A string with <code>{...}</code> replacement variables representing predefined fields.
- * <li><code>useStackTraceHashes</code> - A setting that causes duplicate stack traces to be replaced with 8-character hash strings.
+ * <li>
+ * <code>dateFormat</code> - A {@link SimpleDateFormat} string describing the format for dates.
+ * <li>
+ * <code>format</code> - A string with <code>{...}</code> replacement variables representing predefined fields.
+ * <li>
+ * <code>useStackTraceHashes</code> - A setting that causes duplicate stack traces to be replaced with 8-character
+ * hash strings.
* </ul>
* <p>
* This class converts the format strings into a regular expression that can be used to parse the resulting log file.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
index e271c1c..3aca085 100644
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
@@ -122,7 +122,7 @@ public class LogParser implements Iterable<LogParser.Entry>, Iterator<LogParser.
public void writeTo(Writer w) throws IOException {
try {
if (! hasNext())
- w.append("[EMPTY]"); //$NON-NLS-1$
+ w.append("[EMPTY]");
else for (LogParser.Entry le : this)
le.append(w);
} finally {
@@ -187,10 +187,10 @@ public class LogParser implements Iterable<LogParser.Entry>, Iterator<LogParser.
}
public Writer appendHtml(Writer w) throws IOException {
- w.append(toHtml(line)).append("<br>"); //$NON-NLS-1$
+ w.append(toHtml(line)).append("<br>");
if (additionalText != null)
for (String t : additionalText)
- w.append(toHtml(t)).append("<br>"); //$NON-NLS-1$
+ w.append(toHtml(t)).append("<br>");
return w;
}
@@ -221,7 +221,7 @@ public class LogParser implements Iterable<LogParser.Entry>, Iterator<LogParser.
private static String toHtml(String s) {
if (s.indexOf('<') != -1)
- return s.replaceAll("<", "<"); //$NON-NLS-1$//$NON-NLS-2$
+ return s.replaceAll("<", "<");//$NON-NLS-2$
return s;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
index 3bee423..32976f5 100755
--- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
+++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
@@ -251,7 +251,7 @@ public class LogsResource extends Resource {
if (f.isDirectory())
throw new RestException(SC_METHOD_NOT_ALLOWED, "Download not available on directories");
- res.setContentType("application/octet-stream"); //$NON-NLS-1$
+ res.setContentType("application/octet-stream");
res.setContentLength((int)f.length());
return new FileInputStream(f);
}
@@ -281,7 +281,7 @@ public class LogsResource extends Resource {
if (! f.delete())
throw new RestException(SC_FORBIDDEN, "Could not delete file.");
- return new Redirect(path + "/.."); //$NON-NLS-1$
+ return new Redirect(path + "/..");
}
private static BufferedReader getReader(File f) throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-releng/eclipse-preferences/user-dictionary.txt
----------------------------------------------------------------------
diff --git a/juneau-releng/eclipse-preferences/user-dictionary.txt b/juneau-releng/eclipse-preferences/user-dictionary.txt
index b24928d..03e4024 100644
--- a/juneau-releng/eclipse-preferences/user-dictionary.txt
+++ b/juneau-releng/eclipse-preferences/user-dictionary.txt
@@ -419,3 +419,58 @@ doctype
iri
api
juneaubp
+deserialize
+lifecycle
+myentry
+myarg
+auth
+username
+codec
+lib
+io
+httpclient
+httpcore
+httpmime
+globalized
+sorta
+writeable
+tomcat
+myheader
+streamable
+htm
+txt
+png
+stylesheets
+favicon
+subdirectories
+nowrap
+hashsums
+stacktrace
+msg
+qs
+filesystem
+nosniff
+chrome
+admin
+apache
+mystyles
+mydocs
+myresource
+tooltips
+testcases
+interceptors
+seemlessly
+pl
+pw
+rc
+localhost
+retryable
+hostname
+hv
+tm
+ctx
+sf
+ssl
+intercepters
+cert
+gigabytes
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java
index 07801b8..17e945f 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java
@@ -16,10 +16,11 @@ import org.apache.http.impl.client.*;
/**
* Redirect strategy that allows for redirects on any request type, not just <code>GET</code> or <code>HEAD</code>.
- * <p>
+ *
* <h5 class='section'>Notes:</h5>
* <ul>
- * <li>This class is similar to <code>org.apache.http.impl.client.LaxRedirectStrategy</code>
+ * <li>
+ * This class is similar to <code>org.apache.http.impl.client.LaxRedirectStrategy</code>
* in Apache HttpClient 4.2, but also allows for redirects on <code>PUTs</code> and <code>DELETEs</code>.
* </ul>
*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java
index 25908de..4a9a98b 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java
@@ -22,8 +22,8 @@ import org.apache.juneau.serializer.*;
import org.apache.juneau.urlencoding.*;
/**
- * Convenience class for constructing instances of <code>List<NameValuePair></code>
- * for the {@link UrlEncodedFormEntity} class.
+ * Convenience class for constructing instances of <code>List<NameValuePair></code> for the
+ * {@link UrlEncodedFormEntity} class.
* <p>
* Instances of this method can be passed directly to the {@link RestClient#doPost(Object, Object)} method or
* {@link RestCall#input(Object)} methods to perform URL-encoded form posts.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java
index ce49c5e..a0e1ae0 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java
@@ -21,8 +21,8 @@ import java.util.regex.*;
* Response patterns are applied to REST calls through the {@link RestCall#responsePattern(ResponsePattern)} method.
*
* <h5 class='section'>Example:</h5>
- * 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.
+ * 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>
* <p class='bcode'>
* <jk>final</jk> List<Number> xList = <jk>new</jk> ArrayList<Number>();
@@ -55,26 +55,22 @@ import java.util.regex.*;
* )
* .run();
* </p>
- * <p>
+ *
* <h5 class='notes'>Important Notes:</h5>
* <ol class='notes'>
- * <li><p>
+ * <li>
* Using response patterns does not affect the functionality of any of the other methods
- * used to retrieve the response such as {@link RestCall#getResponseAsString()} or {@link RestCall#getResponse(Class)}.<br>
- * HOWEVER, if you want to retrieve the entire text of the response from inside the match methods,
- * use {@link RestCall#getCapturedResponse()} since this method will not absorb the response for those other methods.
- * </p>
- * <li><p>
+ * used to retrieve the response such as {@link RestCall#getResponseAsString()} or {@link RestCall#getResponse(Class)}.
+ * <br>HOWEVER, if you want to retrieve the entire text of the response from inside the match methods, use
+ * {@link RestCall#getCapturedResponse()} since this method will not absorb the response for those other methods.
+ * <li>
* Response pattern methods are NOT executed if a REST exception occurs during the request.
- * </p>
- * <li><p>
- * The {@link RestCall#successPattern(String)} and {@link RestCall#failurePattern(String)} methods use instances of
- * this class to throw {@link RestCallException RestCallExceptions} when success patterns are not found or failure patterns
- * are found.
- * </p>
- * <li><p>
+ * <li>
+ * The {@link RestCall#successPattern(String)} and {@link RestCall#failurePattern(String)} methods use instances
+ * of this class to throw {@link RestCallException RestCallExceptions} when success patterns are not found or
+ * failure patterns are found.
+ * <li>
* {@link ResponsePattern} objects are reusable and thread-safe.
- * </p>
* </ol>
*/
public abstract class ResponsePattern {
@@ -115,8 +111,8 @@ public abstract class ResponsePattern {
}
/**
- * Instances can override this method to handle when a regular expression pattern matches
- * on the output.
+ * Instances can override this method to handle when a regular expression pattern matches on the output.
+ *
* <p>
* This method is called once for every pattern match that occurs in the response text.
*
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0d913b38/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
----------------------------------------------------------------------
diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
index 7f70117..231218e 100644
--- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
+++ b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
@@ -45,22 +45,28 @@ import org.apache.juneau.utils.*;
/**
* Represents a connection to a remote REST resource.
+ *
* <p>
* Instances of this class are created by the various {@code doX()} methods on the {@link RestClient} class.
- * <p>
- * This class uses only Java standard APIs. Requests can be built up using a fluent interface with method chaining, like so...
*
+ * <p>
+ * This class uses only Java standard APIs. Requests can be built up using a fluent interface with method chaining,
+ * like so...
* <p class='bcode'>
* RestClient client = <jk>new</jk> RestClient();
* RestCall c = client.doPost(<jsf>URL</jsf>).setInput(o).setHeader(x,y);
* MyBean b = c.getResponse(MyBean.<jk>class</jk>);
* </p>
+ *
* <p>
- * The actual connection and request/response transaction occurs when calling one of the <code>getResponseXXX()</code> methods.
+ * The actual connection and request/response transaction occurs when calling one of the <code>getResponseXXX()</code>
+ * methods.
*
* <h5 class='section'>Additional information:</h5>
* <ul>
- * <li><a class="doclink" href="package-summary.html#RestClient">org.apache.juneau.rest.client > REST client API</a> for more information and code examples.
+ * <li>
+ * <a class="doclink" href="package-summary.html#RestClient">org.apache.juneau.rest.client > REST client
+ * API</a> for more information and code examples.
* </ul>
*/
@SuppressWarnings({ "hiding", "unchecked" })
@@ -69,7 +75,7 @@ public final class RestCall {
private final RestClient client; // The client that created this call.
private final HttpRequestBase request; // The request.
private HttpResponse response; // The response.
- private List<RestCallInterceptor> interceptors = new ArrayList<RestCallInterceptor>(); // Used for intercepting and altering requests.
+ private List<RestCallInterceptor> intercepters = new ArrayList<RestCallInterceptor>(); // Used for intercepting and altering requests.
private boolean isConnected = false; // connect() has been called.
private boolean allowRedirectsOnPosts;
@@ -103,8 +109,8 @@ public final class RestCall {
protected RestCall(RestClient client, HttpRequestBase request, URI uri) throws RestCallException {
this.client = client;
this.request = request;
- for (RestCallInterceptor i : this.client.interceptors)
- interceptor(i);
+ for (RestCallInterceptor i : this.client.intercepters)
+ intercepter(i);
this.retryOn = client.retryOn;
this.retries = client.retries;
this.retryInterval = client.retryInterval;
@@ -115,6 +121,7 @@ public final class RestCall {
/**
* Sets the URI for this call.
+ *
* <p>
* Can be any of the following types:
* <ul>
@@ -123,10 +130,13 @@ public final class RestCall {
* <li>{@link URIBuilder}
* <li>Anything else converted to a string using {@link Object#toString()}.
* </ul>
+ *
+ * <p>
* Relative URL strings will be interpreted as relative to the root URL defined on the client.
*
- * @param uri The URI to use for this call.
- * This overrides the URI passed in from the client.
+ * @param uri
+ * The URI to use for this call.
+ * This overrides the URI passed in from the client.
* @return This object (for method chaining).
* @throws RestCallException
*/
@@ -176,13 +186,16 @@ public final class RestCall {
/**
* Adds a query parameter to the URI query.
*
- * @param name The parameter name.
+ * @param name
+ * The parameter name.
* Can be null/blank/* if the value is a {@link Map}, {@link String}, {@link NameValuePairs}, or bean.
- * @param value The parameter value converted to a string using UON notation.
+ * @param value
+ * The parameter value converted to a string using UON notation.
* Can also be {@link Map}, {@link String}, {@link NameValuePairs}, or bean if the name is null/blank/*.
* If a {@link String} and the name is null/blank/*, then calls {@link URIBuilder#setCustomQuery(String)}.
* @param skipIfEmpty Don't add the pair if the value is empty.
- * @param partSerializer The part serializer to use to convert the value to a string.
+ * @param partSerializer
+ * The part serializer to use to convert the value to a string.
* If <jk>null</jk>, then the URL-encoding serializer defined on the client is used.
* @return This object (for method chaining).
* @throws RestCallException
@@ -242,6 +255,7 @@ public final class RestCall {
/**
* Adds a query parameter to the URI query if the parameter value is not <jk>null</jk> or an empty string.
+ *
* <p>
* NE = "not empty"
*
@@ -256,6 +270,7 @@ public final class RestCall {
/**
* Adds query parameters to the URI for any parameters that aren't null/empty.
+ *
* <p>
* NE = "not empty"
*
@@ -281,12 +296,15 @@ public final class RestCall {
/**
* Adds a form data pair to this request to perform a URL-encoded form post.
*
- * @param name The parameter name.
+ * @param name
+ * The parameter name.
* Can be null/blank/* if the value is a {@link Map}, {@link NameValuePairs}, or bean.
- * @param value The parameter value converted to a string using UON notation.
+ * @param value
+ * The parameter value converted to a string using UON notation.
* Can also be {@link Map}, {@link NameValuePairs}, or bean if the name is null/blank/*.
* @param skipIfEmpty Don't add the pair if the value is empty.
- * @param partSerializer The part serializer to use to convert the value to a string.
+ * @param partSerializer
+ * The part serializer to use to convert the value to a string.
* If <jk>null</jk>, then the URL-encoding serializer defined on the client is used.
* @return This object (for method chaining).
* @throws RestCallException
@@ -325,10 +343,12 @@ public final class RestCall {
/**
* Adds a form data pair to this request to perform a URL-encoded form post.
*
- * @param name The parameter name.
- * Can be null/blank if the value is a {@link Map} or {@link NameValuePairs}.
- * @param value The parameter value converted to a string using UON notation.
- * Can also be a {@link Map} or {@link NameValuePairs}.
+ * @param name
+ * The parameter name.
+ * Can be null/blank if the value is a {@link Map} or {@link NameValuePairs}.
+ * @param value
+ * The parameter value converted to a string using UON notation.
+ * Can also be a {@link Map} or {@link NameValuePairs}.
* @return This object (for method chaining).
* @throws RestCallException If name was null/blank and value wasn't a {@link Map} or {@link NameValuePairs}.
*/
@@ -360,6 +380,7 @@ public final class RestCall {
/**
* Adds a form data pair to the request if the parameter value is not <jk>null</jk> or an empty string.
+ *
* <p>
* NE = "not empty"
*
@@ -374,6 +395,7 @@ public final class RestCall {
/**
* Adds form data parameters to the request for any parameters that aren't null/empty.
+ *
* <p>
* NE = "not empty"
*
@@ -390,7 +412,8 @@ public final class RestCall {
*
* @param name The path variable name.
* @param value The replacement value.
- * @param partSerializer The part serializer to use to convert the value to a string.
+ * @param partSerializer
+ * The part serializer to use to convert the value to a string.
* If <jk>null</jk>, then the URL-encoding serializer defined on the client is used.
* @return This object (for method chaining).
* @throws RestCallException If variable could not be found in path.
@@ -457,15 +480,22 @@ public final class RestCall {
/**
* Sets the input for this REST call.
*
- * @param input The input to be sent to the REST resource (only valid for PUT and POST) requests. <br>
- * Can be of the following types:
- * <ul class='spaced-list'>
- * <li>{@link Reader} - Raw contents of {@code Reader} will be serialized to remote resource.
- * <li>{@link InputStream} - Raw contents of {@code InputStream} will be serialized to remote resource.
- * <li>{@link Object} - POJO to be converted to text using the {@link Serializer} registered with the {@link RestClient}.
- * <li>{@link HttpEntity} - Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
- * <li>{@link NameValuePairs} - Converted to a URL-encoded FORM post.
- * </ul>
+ * @param input
+ * The input to be sent to the REST resource (only valid for PUT and POST) requests. <br>
+ * Can be of the following types:
+ * <ul class='spaced-list'>
+ * <li>
+ * {@link Reader} - Raw contents of {@code Reader} will be serialized to remote resource.
+ * <li>
+ * {@link InputStream} - Raw contents of {@code InputStream} will be serialized to remote resource.
+ * <li>
+ * {@link Object} - POJO to be converted to text using the {@link Serializer} registered with the
+ * {@link RestClient}.
+ * <li>
+ * {@link HttpEntity} - Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
+ * <li>
+ * {@link NameValuePairs} - Converted to a URL-encoded FORM post.
+ * </ul>
* @return This object (for method chaining).
* @throws RestCallException If a retry was attempted, but the entity was not repeatable.
*/
@@ -478,6 +508,7 @@ public final class RestCall {
/**
* Specifies the serializer to use on this call.
+ *
* <p>
* Overrides the serializer specified on the {@link RestClient}.
*
@@ -491,6 +522,7 @@ public final class RestCall {
/**
* Specifies the parser to use on this call.
+ *
* <p>
* Overrides the parser specified on the {@link RestClient}.
*
@@ -510,11 +542,13 @@ public final class RestCall {
/**
* Sets a header on the request.
*
- * @param name The header name.
- * The name can be null/empty if the value is a {@link Map}.
+ * @param name
+ * The header name.
+ * The name can be null/empty if the value is a {@link Map}.
* @param value The header value.
* @param skipIfEmpty Don't add the header if the name is null/empty.
- * @param partSerializer The part serializer to use to convert the value to a string.
+ * @param partSerializer
+ * The part serializer to use to convert the value to a string.
* If <jk>null</jk>, then the URL-encoding serializer defined on the client is used.
* @return This object (for method chaining).
* @throws RestCallException
@@ -543,8 +577,9 @@ public final class RestCall {
/**
* Sets a header on the request.
*
- * @param name The header name.
- * The name can be null/empty if the value is a {@link Map}.
+ * @param name
+ * The header name.
+ * The name can be null/empty if the value is a {@link Map}.
* @param value The header value.
* @return This object (for method chaining).
* @throws RestCallException
@@ -566,11 +601,13 @@ public final class RestCall {
/**
* Sets a header on the request if the value is not null/empty.
+ *
* <p>
* NE = "not empty"
*
- * @param name The header name.
- * The name can be null/empty if the value is a {@link Map}.
+ * @param name
+ * The header name.
+ * The name can be null/empty if the value is a {@link Map}.
* @param value The header value.
* @return This object (for method chaining).
* @throws RestCallException
@@ -581,6 +618,7 @@ public final class RestCall {
/**
* Sets headers on the request if the values are not null/empty.
+ *
* <p>
* NE = "not empty"
*
@@ -594,8 +632,10 @@ public final class RestCall {
/**
* Sets the value for the <code>Accept</code> request header.
+ *
* <p>
- * This overrides the media type specified on the parser, but is overridden by calling <code>header(<js>"Accept"</js>, value);</code>
+ * This overrides the media type specified on the parser, but is overridden by calling
+ * <code>header(<js>"Accept"</js>, value);</code>
*
* @param value The new header value.
* @return This object (for method chaining).
@@ -607,6 +647,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Accept-Charset</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Accept-Charset"</js>, value);</code>
*
@@ -620,6 +661,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Accept-Encoding</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Accept-Encoding"</js>, value);</code>
*
@@ -633,6 +675,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Accept-Language</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Accept-Language"</js>, value);</code>
*
@@ -646,6 +689,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Authorization</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Authorization"</js>, value);</code>
*
@@ -659,6 +703,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Cache-Control</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Cache-Control"</js>, value);</code>
*
@@ -672,6 +717,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Connection</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Connection"</js>, value);</code>
*
@@ -685,6 +731,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Content-Length</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Content-Length"</js>, value);</code>
*
@@ -698,8 +745,10 @@ public final class RestCall {
/**
* Sets the value for the <code>Content-Type</code> request header.
+ *
* <p>
- * This overrides the media type specified on the serializer, but is overridden by calling <code>header(<js>"Content-Type"</js>, value);</code>
+ * This overrides the media type specified on the serializer, but is overridden by calling
+ * <code>header(<js>"Content-Type"</js>, value);</code>
*
* @param value The new header value.
* @return This object (for method chaining).
@@ -711,6 +760,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Date</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Date"</js>, value);</code>
*
@@ -724,6 +774,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Expect</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Expect"</js>, value);</code>
*
@@ -737,6 +788,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Forwarded</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Forwarded"</js>, value);</code>
*
@@ -750,6 +802,7 @@ public final class RestCall {
/**
* Sets the value for the <code>From</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"From"</js>, value);</code>
*
@@ -763,6 +816,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Host</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Host"</js>, value);</code>
*
@@ -776,6 +830,7 @@ public final class RestCall {
/**
* Sets the value for the <code>If-Match</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"If-Match"</js>, value);</code>
*
@@ -789,6 +844,7 @@ public final class RestCall {
/**
* Sets the value for the <code>If-Modified-Since</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"If-Modified-Since"</js>, value);</code>
*
@@ -802,6 +858,7 @@ public final class RestCall {
/**
* Sets the value for the <code>If-None-Match</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"If-None-Match"</js>, value);</code>
*
@@ -815,6 +872,7 @@ public final class RestCall {
/**
* Sets the value for the <code>If-Range</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"If-Range"</js>, value);</code>
*
@@ -828,6 +886,7 @@ public final class RestCall {
/**
* Sets the value for the <code>If-Unmodified-Since</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"If-Unmodified-Since"</js>, value);</code>
*
@@ -841,6 +900,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Max-Forwards</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Max-Forwards"</js>, value);</code>
*
@@ -854,6 +914,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Origin</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Origin"</js>, value);</code>
*
@@ -867,6 +928,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Pragma</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Pragma"</js>, value);</code>
*
@@ -880,6 +942,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Proxy-Authorization</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Proxy-Authorization"</js>, value);</code>
*
@@ -893,6 +956,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Range</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Range"</js>, value);</code>
*
@@ -906,6 +970,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Referer</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Referer"</js>, value);</code>
*
@@ -919,6 +984,7 @@ public final class RestCall {
/**
* Sets the value for the <code>TE</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"TE"</js>, value);</code>
*
@@ -932,6 +998,7 @@ public final class RestCall {
/**
* Sets the value for the <code>User-Agent</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"User-Agent"</js>, value);</code>
*
@@ -945,6 +1012,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Upgrade</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Upgrade"</js>, value);</code>
*
@@ -958,6 +1026,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Via</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Via"</js>, value);</code>
*
@@ -971,6 +1040,7 @@ public final class RestCall {
/**
* Sets the value for the <code>Warning</code> request header.
+ *
* <p>
* This is a shortcut for calling <code>header(<js>"Warning"</js>, value);</code>
*
@@ -998,8 +1068,9 @@ public final class RestCall {
*
* @param retries The number of retries to attempt.
* @param interval The time in milliseconds between attempts.
- * @param retryOn Optional object used for determining whether a retry should be attempted.
- * If <jk>null</jk>, uses {@link RetryOn#DEFAULT}.
+ * @param retryOn
+ * Optional object used for determining whether a retry should be attempted.
+ * If <jk>null</jk>, uses {@link RetryOn#DEFAULT}.
* @return This object (for method chaining).
* @throws RestCallException If current entity is not repeatable.
*/
@@ -1019,14 +1090,13 @@ public final class RestCall {
}
/**
- * For this call, allow automatic redirects when a 302 or 307 occurs when
- * performing a POST.
+ * For this call, allow automatic redirects when a 302 or 307 occurs when performing a POST.
+ *
* <p>
- * Note that this can be inefficient since the POST body needs to be serialized
- * twice.
- * The preferred approach if possible is to use the {@link LaxRedirectStrategy} strategy
- * on the underlying HTTP client. However, this method is provided if you don't
- * have access to the underlying client.
+ * Note that this can be inefficient since the POST body needs to be serialized twice.
+ * The preferred approach if possible is to use the {@link LaxRedirectStrategy} strategy on the underlying HTTP
+ * client.
+ * However, this method is provided if you don't have access to the underlying client.
*
* @param b Redirect flag.
* @return This object (for method chaining).
@@ -1048,21 +1118,23 @@ public final class RestCall {
}
/**
- * Add an interceptor for this call only.
+ * Add an intercepter for this call only.
*
- * @param interceptor The interceptor to add to this call.
+ * @param intercepter The intercepter to add to this call.
* @return This object (for method chaining).
*/
- public RestCall interceptor(RestCallInterceptor interceptor) {
- interceptors.add(interceptor);
- interceptor.onInit(this);
+ public RestCall intercepter(RestCallInterceptor intercepter) {
+ intercepters.add(intercepter);
+ intercepter.onInit(this);
return this;
}
/**
* Pipes the request output to the specified writer when {@link #run()} is called.
+ *
* <p>
* The writer is not closed.
+ *
* <p>
* This method can be called multiple times to pipe to multiple writers.
*
@@ -1075,6 +1147,7 @@ public final class RestCall {
/**
* Pipe output from response to the specified writer when {@link #run()} is called.
+ *
* <p>
* This method can be called multiple times to pipe to multiple writers.
*
@@ -1087,8 +1160,9 @@ public final class RestCall {
}
/**
- * Pipe output from response to the specified writer when {@link #run()} is called and associate
- * that writer with an ID so it can be retrieved through {@link #getWriter(String)}.
+ * Pipe output from response to the specified writer when {@link #run()} is called and associate that writer with an
+ * ID so it can be retrieved through {@link #getWriter(String)}.
+ *
* <p>
* This method can be called multiple times to pipe to multiple writers.
*
@@ -1124,8 +1198,10 @@ public final class RestCall {
/**
* Pipes the request output to the specified output stream when {@link #run()} is called.
+ *
* <p>
* The output stream is not closed.
+ *
* <p>
* This method can be called multiple times to pipe to multiple output streams.
*
@@ -1138,6 +1214,7 @@ public final class RestCall {
/**
* Pipe output from response to the specified output stream when {@link #run()} is called.
+ *
* <p>
* This method can be called multiple times to pipe to multiple output stream.
*
@@ -1152,6 +1229,7 @@ public final class RestCall {
/**
* Pipe output from response to the specified output stream when {@link #run()} is called and associate
* that output stream with an ID so it can be retrieved through {@link #getOutputStream(String)}.
+ *
* <p>
* This method can be called multiple times to pipe to multiple output stream.
*
@@ -1177,6 +1255,7 @@ public final class RestCall {
/**
* Prevent {@link RestCallException RestCallExceptions} from being thrown when HTTP status 400+ is encountered.
+ *
* @return This object (for method chaining).
*/
public RestCall ignoreErrors() {
@@ -1186,6 +1265,7 @@ public final class RestCall {
/**
* Stores the response text so that it can later be captured using {@link #getCapturedResponse()}.
+ *
* <p>
* This method should only be called once. Multiple calls to this method are ignored.
*
@@ -1202,11 +1282,13 @@ public final class RestCall {
/**
* Look for the specified regular expression pattern in the response output.
+ *
* <p>
* Causes a {@link RestCallException} to be thrown if the specified pattern is found in the output.
+ *
* <p>
* This method uses {@link #getCapturedResponse()} to read the response text and so does not affect the other output
- * methods such as {@link #getResponseAsString()}.
+ * methods such as {@link #getResponseAsString()}.
*
* <h5 class='section'>Example:</h5>
* <p class='bcode'>
@@ -1233,11 +1315,13 @@ public final class RestCall {
/**
* Look for the specified regular expression pattern in the response output.
+ *
* <p>
* Causes a {@link RestCallException} to be thrown if the specified pattern is not found in the output.
+ *
* <p>
* This method uses {@link #getCapturedResponse()} to read the response text and so does not affect the other output
- * methods such as {@link #getResponseAsString()}.
+ * methods such as {@link #getResponseAsString()}.
*
* <h5 class='section'>Example:</h5>
* <p class='bcode'>
@@ -1264,18 +1348,20 @@ public final class RestCall {
/**
* Adds a response pattern finder to look for regular expression matches in the response output.
+ *
* <p>
* This method can be called multiple times to add multiple response pattern finders.
+ *
* <p>
- * {@link ResponsePattern ResponsePatterns} use the {@link #getCapturedResponse()} to read the response text and so does not affect the other output
- * methods such as {@link #getResponseAsString()}.
+ * {@link ResponsePattern ResponsePatterns} use the {@link #getCapturedResponse()} to read the response text and so
+ * does not affect the other output methods such as {@link #getResponseAsString()}.
*
* @param responsePattern The response pattern finder.
* @return This object (for method chaining).
*/
public RestCall responsePattern(final ResponsePattern responsePattern) {
captureResponse();
- interceptor(
+ intercepter(
new RestCallInterceptor() {
@Override
public void onClose(RestCall restCall) throws RestCallException {
@@ -1288,6 +1374,7 @@ public final class RestCall {
/**
* Set configuration settings on this request.
+ *
* <p>
* Use {@link RequestConfig#custom()} to create configuration parameters for the request.
*
@@ -1311,9 +1398,10 @@ public final class RestCall {
/**
* Method used to execute an HTTP response where you're only interested in the HTTP response code.
+ *
* <p>
- * The response entity is discarded unless one of the pipe methods have been specified to pipe the
- * output to an output stream or writer.
+ * The response entity is discarded unless one of the pipe methods have been specified to pipe the output to an
+ * output stream or writer.
*
* <h5 class='section'>Example:</h5>
* <p class='bcode'>
@@ -1355,7 +1443,8 @@ public final class RestCall {
*
* @return The HTTP status code.
* @throws RestCallException If the executor service was not defined.
- * @see RestClientBuilder#executorService(ExecutorService, boolean) for defining the executor service for creating {@link Future Futures}.
+ * @see RestClientBuilder#executorService(ExecutorService, boolean) for defining the executor service for creating
+ * {@link Future Futures}.
*/
public Future<Integer> runFuture() throws RestCallException {
return client.getExecutorService(true).submit(
@@ -1370,12 +1459,14 @@ public final class RestCall {
/**
* Connects to the REST resource.
+ *
* <p>
* If this is a <code>PUT</code> or <code>POST</code>, also sends the input to the remote resource.<br>
+ *
* <p>
* Typically, you would only call this method if you're not interested in retrieving the body of the HTTP response.
* Otherwise, you're better off just calling one of the {@link #getReader()}/{@link #getResponse(Class)}/{@link #pipeTo(Writer)}
- * methods directly which automatically call this method already.
+ * methods directly which automatically call this method already.
*
* @return This object (for method chaining).
* @throws RestCallException If an exception or <code>400+</code> HTTP status code occurred during the connection attempt.
@@ -1430,7 +1521,7 @@ public final class RestCall {
if (! retryOn.onResponse(response))
retries = 0;
if (retries > 0) {
- for (RestCallInterceptor rci : interceptors)
+ for (RestCallInterceptor rci : intercepters)
rci.onRetry(this, sc, request, response, ex);
request.reset();
long w = retryInterval;
@@ -1441,13 +1532,13 @@ public final class RestCall {
throw ex;
}
}
- for (RestCallInterceptor rci : interceptors)
+ for (RestCallInterceptor rci : intercepters)
rci.onConnect(this, sc, request, response);
if (response == null)
throw new RestCallException("HttpClient returned a null response");
StatusLine sl = response.getStatusLine();
String method = request.getMethod();
- sc = sl.getStatusCode(); // Read it again in case it was changed by one of the interceptors.
+ sc = sl.getStatusCode(); // Read it again in case it was changed by one of the intercepters.
if (sc >= 400 && ! ignoreErrors)
throw new RestCallException(sc, sl.getReasonPhrase(), method, request.getURI(), getResponseAsString())
.setServerException(response.getFirstHeader("Exception-Name"), response.getFirstHeader("Exception-Message"), response.getFirstHeader("Exception-Trace"))
@@ -1491,16 +1582,22 @@ public final class RestCall {
}
/**
- * Connects to the remote resource (if <code>connect()</code> hasn't already been called) and returns the HTTP response message body as a reader.
+ * Connects to the remote resource (if <code>connect()</code> hasn't already been called) and returns the HTTP
+ * response message body as a reader.
+ *
* <p>
- * If an {@link Encoder} has been registered with the {@link RestClient}, then the underlying input stream
- * will be wrapped in the encoded stream (e.g. a <code>GZIPInputStream</code>).
+ * If an {@link Encoder} has been registered with the {@link RestClient}, then the underlying input stream will be
+ * wrapped in the encoded stream (e.g. a <code>GZIPInputStream</code>).
+ *
* <p>
* If present, automatically handles the <code>charset</code> value in the <code>Content-Type</code> response header.
+ *
* <p>
* <b>IMPORTANT:</b> It is your responsibility to close this reader once you have finished with it.
*
- * @return The HTTP response message body reader. <jk>null</jk> if response was successful but didn't contain a body (e.g. HTTP 204).
+ * @return
+ * The HTTP response message body reader.
+ * <jk>null</jk> if response was successful but didn't contain a body (e.g. HTTP 204).
* @throws IOException If an exception occurred while streaming was already occurring.
*/
public Reader getReader() throws IOException {
@@ -1534,12 +1631,14 @@ public final class RestCall {
/**
* Returns the response text as a string if {@link #captureResponse()} was called on this object.
+ *
* <p>
- * Note that while similar to {@link #getResponseAsString()}, this method can be called multiple times
- * to retrieve the response text multiple times.
+ * Note that while similar to {@link #getResponseAsString()}, this method can be called multiple times to retrieve
+ * the response text multiple times.
+ *
* <p>
- * Note that this method returns <jk>null</jk> if you have not called one of the methods that cause
- * the response to be processed. (e.g. {@link #run()}, {@link #getResponse()}, {@link #getResponseAsString()}.
+ * Note that this method returns <jk>null</jk> if you have not called one of the methods that cause the response to
+ * be processed. (e.g. {@link #run()}, {@link #getResponse()}, {@link #getResponseAsString()}.
*
* @return The captured response, or <jk>null</jk> if {@link #captureResponse()} has not been called.
* @throws IllegalStateException If trying to call this method before the response is consumed.
@@ -1594,14 +1693,19 @@ public final class RestCall {
}
/**
- * Connects to the remote resource (if <code>connect()</code> hasn't already been called) and returns the HTTP response message body as an input stream.
+ * Connects to the remote resource (if <code>connect()</code> hasn't already been called) and returns the HTTP
+ * response message body as an input stream.
+ *
* <p>
- * If an {@link Encoder} has been registered with the {@link RestClient}, then the underlying input stream
- * will be wrapped in the encoded stream (e.g. a <code>GZIPInputStream</code>).
+ * If an {@link Encoder} has been registered with the {@link RestClient}, then the underlying input stream will be
+ * wrapped in the encoded stream (e.g. a <code>GZIPInputStream</code>).
+ *
* <p>
* <b>IMPORTANT:</b> It is your responsibility to close this reader once you have finished with it.
*
- * @return The HTTP response message body input stream. <jk>null</jk> if response was successful but didn't contain a body (e.g. HTTP 204).
+ * @return
+ * The HTTP response message body input stream. <jk>null</jk> if response was successful but didn't contain
+ * a body (e.g. HTTP 204).
* @throws IOException If an exception occurred while streaming was already occurring.
* @throws IllegalStateException If an attempt is made to read the response more than once.
*/
@@ -1625,7 +1729,8 @@ public final class RestCall {
}
/**
- * Connects to the remote resource (if {@code connect()} hasn't already been called) and returns the HTTP response message body as plain text.
+ * Connects to the remote resource (if {@code connect()} hasn't already been called) and returns the HTTP response
+ * message body as plain text.
*
* @return The response as a string.
* @throws RestCallException If an exception or non-200 response code occurred during the connection attempt.
@@ -1649,7 +1754,9 @@ public final class RestCall {
*
* @return The response as a string.
* @throws RestCallException If the executor service was not defined.
- * @see RestClientBuilder#executorService(ExecutorService, boolean) for defining the executor service for creating {@link Future Futures}.
+ * @see
+ * RestClientBuilder#executorService(ExecutorService, boolean) for defining the executor service for creating
+ * {@link Future Futures}.
*/
public Future<String> getResponseAsStringFuture() throws RestCallException {
return client.getExecutorService(true).submit(
@@ -1664,8 +1771,10 @@ public final class RestCall {
/**
* Same as {@link #getResponse(Type, Type...)} except optimized for a non-parameterized class.
+ *
* <p>
* This is the preferred parse method for simple types since you don't need to cast the results.
+ *
* <h5 class='section'>Examples:</h5>
* <p class='bcode'>
* <jc>// Parse into a string.</jc>
@@ -1683,10 +1792,11 @@ public final class RestCall {
* <jc>// Parse into a map of object keys/values.</jc>
* Map m = restClient.doGet(url).getResponse(TreeMap.<jk>class</jk>);
* </p>
- * <p>
+ *
* <h5 class='section'>Notes:</h5>
* <ul>
- * <li>You can also specify any of the following types:
+ * <li>
+ * You can also specify any of the following types:
* <ul>
* <li>{@link HttpResponse} - Returns the raw <code>HttpResponse</code> returned by the inner <code>HttpClient</code>.
* <li>{@link Reader} - Returns access to the raw reader of the response.
@@ -1694,11 +1804,13 @@ public final class RestCall {
* </ul>
* </ul>
*
- * @param <T> The class type of the object being created.
- * See {@link #getResponse(Type, Type...)} for details.
+ * @param <T>
+ * The class type of the object being created.
+ * See {@link #getResponse(Type, Type...)} for details.
* @param type The object type to create.
* @return The parsed object.
- * @throws ParseException If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException
+ * If the input contains a syntax error or is malformed, or is not valid for the specified type.
* @throws IOException If a connection error occurred.
*/
public <T> T getResponse(Class<T> type) throws IOException, ParseException {
@@ -1711,12 +1823,15 @@ public final class RestCall {
/**
* Same as {@link #getResponse(Class)} but allows you to run the call asynchronously.
*
- * @param <T> The class type of the object being created.
- * See {@link #getResponse(Type, Type...)} for details.
+ * @param <T>
+ * The class type of the object being created.
+ * See {@link #getResponse(Type, Type...)} for details.
* @param type The object type to create.
* @return The parsed object.
* @throws RestCallException If the executor service was not defined.
- * @see RestClientBuilder#executorService(ExecutorService, boolean) for defining the executor service for creating {@link Future Futures}.
+ * @see
+ * RestClientBuilder#executorService(ExecutorService, boolean) for defining the executor service for creating
+ * {@link Future Futures}.
*/
public <T> Future<T> getResponseFuture(final Class<T> type) throws RestCallException {
return client.getExecutorService(true).submit(
@@ -1731,6 +1846,8 @@ public final class RestCall {
/**
* Parses HTTP body into the specified object type.
+ *
+ * <p>
* The type can be a simple type (e.g. beans, strings, numbers) or parameterized type (collections/maps).
*
* <h5 class='section'>Examples:</h5>
@@ -1750,17 +1867,22 @@ public final class RestCall {
* <jc>// Parse into a map containing string keys and values of lists containing beans.</jc>
* Map m = restClient.doGet(url).getResponse(TreeMap.<jk>class</jk>, String.<jk>class</jk>, List.<jk>class</jk>, MyBean.<jk>class</jk>);
* </p>
+ *
* <p>
* <code>Collection</code> classes are assumed to be followed by zero or one objects indicating the element type.
+ *
* <p>
* <code>Map</code> classes are assumed to be followed by zero or two meta objects indicating the key and value types.
+ *
* <p>
* The array can be arbitrarily long to indicate arbitrarily complex data structures.
- * <p>
+ *
* <h5 class='section'>Notes:</h5>
* <ul>
- * <li>Use the {@link #getResponse(Class)} method instead if you don't need a parameterized map/collection.
- * <li>You can also specify any of the following types:
+ * <li>
+ * Use the {@link #getResponse(Class)} method instead if you don't need a parameterized map/collection.
+ * <li>
+ * You can also specify any of the following types:
* <ul>
* <li>{@link HttpResponse} - Returns the raw <code>HttpResponse</code> returned by the inner <code>HttpClient</code>.
* <li>{@link Reader} - Returns access to the raw reader of the response.
@@ -1769,13 +1891,16 @@ public final class RestCall {
* </ul>
*
* @param <T> The class type of the object to create.
- * @param type The object type to create.
+ * @param type
+ * The object type to create.
* <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
- * @param args The type arguments of the class if it's a collection or map.
+ * @param args
+ * The type arguments of the class if it's a collection or map.
* <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
* <br>Ignored if the main type is not a map or collection.
* @return The parsed object.
- * @throws ParseException If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException
+ * If the input contains a syntax error or is malformed, or is not valid for the specified type.
* @throws IOException If a connection error occurred.
* @see BeanSession#getClassMeta(Class) for argument syntax for maps and collections.
*/
@@ -1789,16 +1914,23 @@ public final class RestCall {
/**
* Same as {@link #getResponse(Class)} but allows you to run the call asynchronously.
*
- * @param <T> The class type of the object being created.
- * See {@link #getResponse(Type, Type...)} for details.
- * @param type The object type to create.
- * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
- * @param args The type arguments of the class if it's a collection or map.
- * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
+ * @param <T>
+ * The class type of the object being created.
+ * See {@link #getResponse(Type, Type...)} for details.
+ * @param type
+ * The object type to create.
+ * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType},
+ * {@link GenericArrayType}
+ * @param args
+ * The type arguments of the class if it's a collection or map.
+ * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType},
+ * {@link GenericArrayType}
* <br>Ignored if the main type is not a map or collection.
* @return The parsed object.
* @throws RestCallException If the executor service was not defined.
- * @see RestClientBuilder#executorService(ExecutorService, boolean) for defining the executor service for creating {@link Future Futures}.
+ * @see
+ * RestClientBuilder#executorService(ExecutorService, boolean) for defining the executor service for creating
+ * {@link Future Futures}.
*/
public <T> Future<T> getResponseFuture(final Type type, final Type...args) throws RestCallException {
return client.getExecutorService(true).submit(
@@ -1813,13 +1945,15 @@ public final class RestCall {
/**
* Parses the output from the connection into the specified type and then wraps that in a {@link PojoRest}.
+ *
* <p>
* Useful if you want to quickly retrieve a single value from inside of a larger JSON document.
*
* @param innerType The class type of the POJO being wrapped.
- * @return The parsed output wapped in a {@link PojoRest}.
+ * @return The parsed output wrapped in a {@link PojoRest}.
* @throws IOException If a connection error occurred.
- * @throws ParseException If the input contains a syntax error or is malformed for the <code>Content-Type</code> header.
+ * @throws ParseException
+ * If the input contains a syntax error or is malformed for the <code>Content-Type</code> header.
*/
public PojoRest getResponsePojoRest(Class<?> innerType) throws IOException, ParseException {
return new PojoRest(getResponse(innerType));
@@ -1827,12 +1961,14 @@ public final class RestCall {
/**
* Converts the output from the connection into an {@link ObjectMap} and then wraps that in a {@link PojoRest}.
+ *
* <p>
* Useful if you want to quickly retrieve a single value from inside of a larger JSON document.
*
- * @return The parsed output wapped in a {@link PojoRest}.
+ * @return The parsed output wrapped in a {@link PojoRest}.
* @throws IOException If a connection error occurred.
- * @throws ParseException If the input contains a syntax error or is malformed for the <code>Content-Type</code> header.
+ * @throws ParseException
+ * If the input contains a syntax error or is malformed for the <code>Content-Type</code> header.
*/
public PojoRest getResponsePojoRest() throws IOException, ParseException {
return getResponsePojoRest(ObjectMap.class);
@@ -1885,6 +2021,8 @@ public final class RestCall {
/**
* Returns access to the {@link HttpResponse} returned by {@link HttpClient#execute(HttpUriRequest)}.
+ *
+ * <p>
* Returns <jk>null</jk> if {@link #connect()} has not yet been called.
*
* @return The HTTP response object.
@@ -1924,20 +2062,20 @@ public final class RestCall {
EntityUtils.consumeQuietly(response.getEntity());
isClosed = true;
if (! isFailed)
- for (RestCallInterceptor r : interceptors)
+ for (RestCallInterceptor r : intercepters)
r.onClose(this);
return this;
}
/**
- * Adds a {@link RestCallLogger} to the list of interceptors on this class.
+ * Adds a {@link RestCallLogger} to the list of intercepters on this class.
*
* @param level The log level to log events at.
* @param log The logger.
* @return This object (for method chaining).
*/
public RestCall logTo(Level level, Logger log) {
- interceptor(new RestCallLogger(level, log));
+ intercepter(new RestCallLogger(level, log));
return this;
}