public class RestSource extends InputStreamDataSource
Type | Property and Description |
---|---|
javafx.beans.property.ReadOnlyIntegerProperty |
responseCode
Gets the status code from an HTTP response message.
|
javafx.beans.property.ReadOnlyStringProperty |
responseMessage
Gets the HTTP response message, if any, returned along with the response
code from a server.
|
Modifier and Type | Class and Description |
---|---|
static class |
RestSource.Method |
Constructor and Description |
---|
RestSource()
Create a new RestSource.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
createInputStream()
Create the InputStream for this request.
|
java.lang.String |
getConsumerKey()
Return the consumer key (used with oauth) for this request
|
java.lang.String |
getConsumerSecret()
Return the consumer secret (if used with oauth) for this request
|
java.lang.String |
getContentType() |
java.lang.String |
getDataString()
Return the datastring that will be send with this request
|
MultiValuedMap<java.lang.String,java.lang.String> |
getFormParams()
Return a MultiValuedMap for the form parameters in this request.
|
MultiValuedMap<java.lang.String,java.lang.String> |
getQueryParams()
Return the query parameters as a
Map |
RestSource.Method |
getRequestMethod()
Return the request method for this request.
|
java.util.Map<java.lang.String,java.lang.String> |
getRequestProperties()
Return the request properties as a
Map |
int |
getResponseCode()
Gets the value of the property responseCode.
|
java.lang.String |
getResponseMessage()
Gets the value of the property responseMessage.
|
java.io.InputStream |
getSource() |
int |
getTimeout()
Get the timeout value specified for this instance
|
javafx.beans.property.ReadOnlyIntegerProperty |
responseCodeProperty()
Gets the status code from an HTTP response message.
|
javafx.beans.property.ReadOnlyStringProperty |
responseMessageProperty()
Gets the HTTP response message, if any, returned along with the response
code from a server.
|
void |
setConsumerKey(java.lang.String consumerKey)
Set the consumer key for this request.
|
void |
setConsumerSecret(java.lang.String consumerSecret)
Set the consumer secret
|
void |
setContentType(java.lang.String contentType)
Set the contentType for this request.
|
void |
setDataString(java.lang.String dataString)
Explicitly set the datastring for this request.
|
void |
setFormParams(java.util.Map<java.lang.String,java.lang.String> formParams)
Set the form parameters as a
Map . |
void |
setFormParams(MultiValuedMap<java.lang.String,java.lang.String> formParams)
Set the form parameters as a MultiValuedMap
|
void |
setHost(java.lang.String host)
Set the host parameter for this endpoint.
|
void |
setPath(java.lang.String path)
Explicitly sets the path for this resource.
|
void |
setQueryParams(MultiValuedMap<java.lang.String,java.lang.String> queryParams)
Set the query parameters as a
Map |
void |
setRequestMethod(RestSource.Method requestMethod)
Set the request method for this request as a
String
(e.g. |
void |
setRequestProperties(java.util.Map<java.lang.String,java.lang.String> requestProperties)
Set the request properties as a
Map |
void |
setTimeout(int timeout)
Set the timeout value for this instance.
|
public javafx.beans.property.ReadOnlyIntegerProperty responseCodeProperty
getResponseCode()
public javafx.beans.property.ReadOnlyStringProperty responseMessageProperty
getResponseMessage()
public void setHost(java.lang.String host)
host
- the host parameter for this endpoint.public void setPath(java.lang.String path)
path
- the path. If null, the path will be the empty Stringpublic java.io.InputStream getSource() throws java.io.IOException
java.io.IOException
public java.io.InputStream createInputStream() throws java.io.IOException
errorStream of the URL
connection
instead and no IOException will be thrown. This allows the
coupled Converter to continue parsing the response from the server.
In case no requestMethod is specified via setRequestMethod(com.gluonhq.charm.connect.data.source.RestSource.Method)
,
a POST request will be created in case form parameters or a dataString
are supplied; a GET request will be created in the other cases.InputStream
java.io.IOException
- in case the InputStream cannot be created
successfully.public java.lang.String getConsumerKey()
public void setConsumerKey(java.lang.String consumerKey)
consumerKey
- the consumerKey to setpublic java.lang.String getConsumerSecret()
public void setConsumerSecret(java.lang.String consumerSecret)
consumerSecret
- the consumerSecret to setpublic java.util.Map<java.lang.String,java.lang.String> getRequestProperties()
Map
public void setRequestProperties(java.util.Map<java.lang.String,java.lang.String> requestProperties)
Map
requestProperties
- the requestProperties to setpublic MultiValuedMap<java.lang.String,java.lang.String> getQueryParams()
Map
public void setQueryParams(MultiValuedMap<java.lang.String,java.lang.String> queryParams)
Map
queryParams
- the queryParams to set. If null, this call is ignoredpublic MultiValuedMap<java.lang.String,java.lang.String> getFormParams()
public void setFormParams(java.util.Map<java.lang.String,java.lang.String> formParams)
Map
. This is a convenience method,
as form parameters can also be passed as a MultiValuedMapformParams
- the formParams to setpublic void setFormParams(MultiValuedMap<java.lang.String,java.lang.String> formParams)
formParams
- the formParams to setpublic java.lang.String getDataString()
public void setDataString(java.lang.String dataString)
dataString
- the dataString to setpublic RestSource.Method getRequestMethod()
public void setRequestMethod(RestSource.Method requestMethod)
String
(e.g. "POST", "GET")requestMethod
- the requestMethod to setpublic int getTimeout()
public void setTimeout(int timeout)
timeout
- the timeout valuepublic java.lang.String getContentType()
public void setContentType(java.lang.String contentType)
contentType
- the contentType to setpublic int getResponseCode()
public javafx.beans.property.ReadOnlyIntegerProperty responseCodeProperty()
getResponseCode()
public java.lang.String getResponseMessage()
public javafx.beans.property.ReadOnlyStringProperty responseMessageProperty()
getResponseMessage()