public abstract class J4pRequest extends Object
Modifier | Constructor and Description |
---|---|
protected |
J4pRequest(J4pType pType,
J4pTargetConfig pTargetConfig)
Constructor for subclasses
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPath(List<String> pParts,
String pPath) |
static String |
escape(String pInput)
Escape a input (like the part of an path) so that it can be safely used
e.g.
|
String |
getPreferredHttpMethod()
The preferred HTTP method to use (either 'GET' or 'POST')
|
J4pTargetConfig |
getTargetConfig()
Get a target configuration for use with an agent in JSR-160 proxy mode
|
J4pType |
getType()
Get the type of the request
|
protected Object |
serializeArgumentToJson(Object pArg)
Serialize an object to an string or JSON structure for write/exec POST requests.
|
protected String |
serializeArgumentToRequestPart(Object pArg)
Serialize an object to a string which can be uses as URL part in a GET request
when object should be transmitted to the agent.
|
void |
setPreferredHttpMethod(String pPreferredHttpMethod)
Set the preferred HTTP method, either 'GET' or 'POST'.
|
protected List<String> |
splitPath(String pArg)
Split up a path taking into account proper escaping (as descibed in the
reference manual).
|
protected J4pRequest(J4pType pType, J4pTargetConfig pTargetConfig)
pType
- type of this requestpTargetConfig
- a target configuration if used in proxy mode or null
if this is a direct requestpublic static String escape(String pInput)
pInput
- input to escapepublic J4pType getType()
public J4pTargetConfig getTargetConfig()
null
if this is a direct requestpublic String getPreferredHttpMethod()
null
if the method should be automatically selected.public void setPreferredHttpMethod(String pPreferredHttpMethod)
pPreferredHttpMethod
- HTTP method to use.protected String serializeArgumentToRequestPart(Object pArg)
Object.toString()
)
Any null
value is transformed in the special marker [null]
which on the
agent side is converted back into a null
.
You should consider POST requests when you need a more sophisticated JSON serialization.
pArg
- the argument to serialize for an GET requestprotected Object serializeArgumentToJson(Object pArg)
null
null is returned.
JSONAware
, the it is used directly for inclusion
in the POST request.
JSONArray
, where each array member is serialized recursively.
JSONObject
with the keys taken
directly from the map and the values recursively serialized to their JSON representation.
So it is only save fto use or a simple map with string keys.
Collection
, it is transformed into a JSONArray
with
the values recursively serialized to their JSON representation.
pArg
- the object to serializeprotected List<String> splitPath(String pArg)
pArg
- string to split with escaping taken into accountCopyright © 2021. All rights reserved.