public class RunnerRest extends Runner
Modifier and Type | Field and Description |
---|---|
(package private) RestResponseParser |
parser
Parser for returned response.
|
(package private) RestActionReport |
report
Object representation of returned response.
|
protected ResultString |
result
GlassFish administration command result.
|
auth, command, FALSE_VALUE, HTTP_CONNECTION_TIMEOUT, HTTP_RETRY_DELAY, ITEM_SEPARATOR, PARAM_ASSIGN_VALUE, PARAM_SEPARATOR, path, query, QUERY_SEPARATOR, retry, server, silentFailureAllowed, stateListeners, TRUE_VALUE
Constructor and Description |
---|
RunnerRest(GlassFishServer server,
Command command)
Constructs an instance of administration command executor using
REST interface.
|
RunnerRest(GlassFishServer server,
Command command,
String query)
Constructs an instance of administration command executor using
REST interface.
|
RunnerRest(GlassFishServer server,
Command command,
String path,
String query)
Constructs an instance of administration command executor using
REST interface.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsGzip()
Inform whether this runner implementation accepts gzip format.
|
protected void |
appendIfNotEmpty(StringBuilder sb,
String paramName,
String paramValue) |
protected void |
appendProperties(StringBuilder sb,
Map<String,String> properties,
String paramName,
boolean separator)
Helper methods that appends java.util.Properties into
POST request body.
|
protected String |
constructCommandUrl()
Build Glassfish REST command URL.
|
protected Result |
createResult()
Create
ResultString object corresponding
to String command execution value to be returned. |
boolean |
getDoOutput()
Do not send information to the server via HTTP POST by default.
|
protected String |
getRequestMethod()
Override to change the type of HTTP method used for this command.
|
protected ResponseContentType |
getResponseType()
Method returns content type in which the server is asked to return
the response.
|
protected void |
handleSend(HttpURLConnection hconn)
Override this method to handle sending data to server.
|
protected void |
prepareHttpConnection(HttpURLConnection conn)
Prepare headers for HTTP connection.
|
protected boolean |
processResponse()
Override to parse, validate, and/or format any data read from the server
in readResponse() / readManifest().
|
protected boolean |
readResponse(InputStream in,
HttpURLConnection hconn)
Override this method to read response from provided input stream.
|
call, execute, execute, getCommand, getCommandWithQuery, getContentType, getQuery, getResult, handleReceive, handleSecureConnection, handleStateChange, isSilentFailureAllowed, parallelExecutor, serializedExecutor, setReadyState, setSilentFailureAllowed, setStateListeners, stateChangeArgs, stateChangeArgs, toBoolean, toString
RestResponseParser parser
RestActionReport report
protected ResultString result
ExecutorService
's queue. method call()
is responsible for correct TaskState
and receiveResult value
handling.public RunnerRest(GlassFishServer server, Command command)
server
- GlassFish server entity object.command
- GlassFish server administration command entity.public RunnerRest(GlassFishServer server, Command command, String query)
server
- GlassFish server entity object.command
- GlassFish server administration command entity.query
- Query string for this command.public RunnerRest(GlassFishServer server, Command command, String path, String query)
server
- GlassFish server entity object.command
- GlassFish server administration command entity.path
- path which builds URL we speak to.query
- Query string for this command.protected void appendProperties(StringBuilder sb, Map<String,String> properties, String paramName, boolean separator)
sb
- properties
- paramName
- separator
- protected void appendIfNotEmpty(StringBuilder sb, String paramName, String paramValue)
protected Result createResult()
ResultString
object corresponding
to String
command execution value to be returned.
createResult
in class Runner
String
command execution value to be returned.public boolean getDoOutput()
getDoOutput
in class Runner
true
if using HTTP POST to send to server
or false
otherwisepublic boolean acceptsGzip()
acceptsGzip
in class Runner
true
when gzip format is accepted,
false
otherwise.protected String constructCommandUrl() throws CommandException
constructCommandUrl
in class Runner
String
value containing command URL.CommandException
- if there is a problem with building
command URL.CommandException
protected String getRequestMethod()
getRequestMethod
in class Runner
protected void handleSend(HttpURLConnection hconn) throws IOException
Runner
handleSend
in class Runner
IOException
protected boolean readResponse(InputStream in, HttpURLConnection hconn)
readResponse
in class Runner
in
- Stream to read data from.true
if response was read correctly.IOException
- in case of stream error.protected boolean processResponse()
processResponse
in class Runner
true
if data was processed correctly.protected void prepareHttpConnection(HttpURLConnection conn) throws CommandException
prepareHttpConnection
in class Runner
conn
- Target HTTP connection.CommandException
- if there is a problem with setting
the headers.CommandException
protected ResponseContentType getResponseType()
ContentType
that runner wants to get from server.Copyright © 2013. All Rights Reserved.