public class RunnerRestFetchLogData extends RunnerRest
view-log
Administration Command Execution
using HTTP interface.
Class implements GlassFish server administration functionality trough HTTP
interface.
Modifier and Type | Field and Description |
---|---|
private URL |
headerAppendNext
Content of HTTP header
X-Text-Append-Next . |
private List<String> |
lines
GlassFish log lines.
|
(package private) ResultLog |
result
GlassFish administration command result containing server log.
|
parser, report
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 |
---|
RunnerRestFetchLogData(GlassFishServer server,
Command command)
Constructs an instance of administration command executor using
HTTP interface.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsGzip()
Inform whether this runner implementation accepts gzip format.
|
protected Result |
createResult()
Create
ResultLog object corresponding
to server log 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 boolean |
processResponse()
Extracts result value from internal
Manifest object. |
private static String |
query(Command command)
Extracts query string from passed View Log command entity.
|
boolean |
readResponse(InputStream in,
HttpURLConnection hconn)
Reads response from server and stores it into internal objects.
|
appendIfNotEmpty, appendProperties, constructCommandUrl, handleSend, prepareHttpConnection
call, execute, execute, getCommand, getCommandWithQuery, getContentType, getQuery, getResult, handleReceive, handleSecureConnection, handleStateChange, isSilentFailureAllowed, parallelExecutor, serializedExecutor, setReadyState, setSilentFailureAllowed, setStateListeners, stateChangeArgs, stateChangeArgs, toBoolean, toString
private List<String> lines
List<String> lines
instance is internal server response
holder. Instance life cycle is started in readResponse
method where log returned from server is read and stored internally.private URL headerAppendNext
X-Text-Append-Next
.
This header contains the entire URL to pass to the GET method to return
the changes since the last call. You can use this header in client
applications to get all log entries that were added in particular
interval.ResultLog result
ExecutorService
's queue. method call()
is responsible for correct TaskState
and receiveResult value
handling.public RunnerRestFetchLogData(GlassFishServer server, Command command)
server
- GlassFish server entity object.command
- GlassFish server administration command entity.private static String query(Command command)
command
- View Log command entity.protected Result createResult()
ResultLog
object corresponding
to server log command execution value to be returned.createResult
in class RunnerRest
String
command execution value to be returned.public boolean getDoOutput()
RunnerRest
getDoOutput
in class RunnerRest
true
if using HTTP POST to send to server
or false
otherwiseprotected String getRequestMethod()
RunnerRest
getRequestMethod
in class RunnerRest
public boolean acceptsGzip()
acceptsGzip
in class RunnerRest
true
when gzip format is accepted,
false
otherwise.public boolean readResponse(InputStream in, HttpURLConnection hconn)
lines
List
. Content of HTTP header X-Text-Append-Next
is stored in internal headerAppendNext
variable.
It's not necessary close the stream parameter when finished. Caller
will take care of that. But this method uses additional stream handlers
for gzip
compression and buffered reading so it should
close them.
readResponse
in class RunnerRest
in
- Stream to read data from.true
if response X-Text-Append-Next
HTTP header
contains some parameters (e.g. ?start=<number>) or
false
otherwise.CommandException
- in case of stream error.protected boolean processResponse()
Manifest
object.
Value of message attribute in Manifest
object is
stored as value into ResultString
result object.
processResponse
in class RunnerRest
null
messagevalue is considered as failure.protected ResponseContentType getResponseType()
RunnerRest
getResponseType
in class RunnerRest
ContentType
that runner wants to get from server.Copyright © 2013. All Rights Reserved.