public class SimpleRequest
extends java.lang.Object
It is not meant to be robust or even configurable.
Do not use this for large responses, as the entire response body is always assumed to fit in a single String
object.
Modifier and Type | Field and Description |
---|---|
private java.net.URI |
baseUri |
Constructor and Description |
---|
SimpleRequest(java.net.URI serverURI)
Setup a SimpleRequest initiator against serverURI
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
getPotentialBody(java.net.HttpURLConnection connection)
Attempt to obtain the body text if available.
|
java.util.Properties |
getProperties(java.lang.String relativePath)
Initiate a simple GET request on the path specified, returning the response contents as a
Properties
object. |
java.lang.String |
getString(java.lang.String relativePath)
Initiate a simple GET request on the path specified.
|
public SimpleRequest(java.net.URI serverURI)
serverURI
- the server URI to base all requests off ofpublic java.lang.String getString(java.lang.String relativePath) throws java.io.IOException
relativePath
- the relative path of the serverURI to resource for this GET requestjava.io.IOException
- if unable to communicate with serverpublic java.util.Properties getProperties(java.lang.String relativePath) throws java.io.IOException
Properties
object.
This expects that the GET response will be in the form of a Properties text file, in a format that is suitable
for Properties.load(InputStream)
use.
relativePath
- the relative path of the serverURI to resource for this GET requestProperties
object.java.io.IOException
- if unable to communicate with serverprivate java.lang.String getPotentialBody(java.net.HttpURLConnection connection)
connection
- the connection to fetch the body content from.