Package com.ultikits.ultitools.utils
Class HttpRequestUtils
java.lang.Object
com.ultikits.ultitools.utils.HttpRequestUtils
The UltiCloud base URL, plus the three protected protocol v1 REST calls kept so 6.3.0 subclasses
still link.
As of 6.3.1 the base URL (env.yml api-url) is read by the protocol 2.0.0 client,
and the v1 calls (/server/getByUUID, /editor/register, /editor/updateServer)
send nothing: protocol 2.0.0 has no v1 REST cloud. Each returns a failure response with status
-1 (no HTTP exchange happened) and writes one INFO line per run; all three are deprecated
for removal in 6.4.0.
- Since:
- 6.0.0
- Author:
- wisdomme
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static StringBase URL for the API server (lazy initialized).private static StringCustom base URL for testing purposes.private static final AtomicBooleanprivate static final intStatus of the failure response the removed v1 calls return: no HTTP exchange happened.private static final Loggerprivate static final StringBody of that failure response.private static final AtomicBooleanprivate static final AtomicBoolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringGet the base URL for API calls.protected static SimpleHttpClient.ResponsegetServerByUUID(String uuid, TokenEntity token) Deprecated, for removal: This API element is subject to removal in a future version.private static SimpleHttpClient.Responserefused(AtomicBoolean notice, String method) The removed calls' failure response; the first call of each method in a run logs one INFO line.protected static SimpleHttpClient.ResponseregisterServer(String uuid, String name, int port, String domain, boolean ssl, TokenEntity token) Deprecated, for removal: This API element is subject to removal in a future version.There is no replacement:/ulticloud loginlinks a protocol 2.0.0 server through the device authorization.(package private) static voidReset the base URL to force re-initialization.(package private) static voidTest-only: forgets that this run already logged each removed call's INFO line.(package private) static voidSet a custom base URL for testing purposes.protected static SimpleHttpClient.ResponseupdateServer(String uuid, int port, String domain, boolean ssl, TokenEntity token) Deprecated, for removal: This API element is subject to removal in a future version.There is no replacement: a protocol 2.0.0 server reports its own state over its connection.
-
Field Details
-
baseUrl
Base URL for the API server (lazy initialized). -
customBaseUrl
Custom base URL for testing purposes. -
NO_EXCHANGE
private static final int NO_EXCHANGEStatus of the failure response the removed v1 calls return: no HTTP exchange happened.- See Also:
-
REFUSED_BODY
Body of that failure response.- See Also:
-
NOTICE_LOGGER
-
GET_SERVER_NOTICE
-
REGISTER_NOTICE
-
UPDATE_NOTICE
-
-
Constructor Details
-
HttpRequestUtils
public HttpRequestUtils()
-
-
Method Details
-
getBaseUrl
Get the base URL for API calls. Uses lazy initialization to avoid requiring UltiTools at class loading time.- Returns:
- the base URL
-
setBaseUrlForTesting
Set a custom base URL for testing purposes. This should only be used in unit tests.- Parameters:
url- the custom base URL, or null to reset to default
-
resetBaseUrl
static void resetBaseUrl()Reset the base URL to force re-initialization. This should only be used in unit tests. -
getServerByUUID
@Deprecated(since="6.3.1", forRemoval=true) protected static SimpleHttpClient.Response getServerByUUID(String uuid, TokenEntity token) Deprecated, for removal: This API element is subject to removal in a future version.There is no replacement: a protocol 2.0.0 server is linked with/ulticloud loginand identified by its server credential. Removed in 6.4.0.Looked up a server by its installation UUID in the protocol v1 cloud. Sends nothing as of 6.3.1.- Parameters:
uuid- ignored, nothing is senttoken- ignored, nothing is sent- Returns:
- a failure response with status
-1and a body naming the removal - Scheduled removal version:
- 6.4.0
-
registerServer
@Deprecated(since="6.3.1", forRemoval=true) protected static SimpleHttpClient.Response registerServer(String uuid, String name, int port, String domain, boolean ssl, TokenEntity token) Deprecated, for removal: This API element is subject to removal in a future version.There is no replacement:/ulticloud loginlinks a protocol 2.0.0 server through the device authorization. Removed in 6.4.0.Registered a server with the protocol v1 cloud. Sends nothing as of 6.3.1.- Parameters:
uuid- ignored, nothing is sentname- ignored, nothing is sentport- ignored, nothing is sentdomain- ignored, nothing is sentssl- ignored, nothing is senttoken- ignored, nothing is sent- Returns:
- a failure response with status
-1and a body naming the removal - Scheduled removal version:
- 6.4.0
-
updateServer
@Deprecated(since="6.3.1", forRemoval=true) protected static SimpleHttpClient.Response updateServer(String uuid, int port, String domain, boolean ssl, TokenEntity token) Deprecated, for removal: This API element is subject to removal in a future version.There is no replacement: a protocol 2.0.0 server reports its own state over its connection. Removed in 6.4.0.Updated a server's address in the protocol v1 cloud. Sends nothing as of 6.3.1.- Parameters:
uuid- ignored, nothing is sentport- ignored, nothing is sentdomain- ignored, nothing is sentssl- ignored, nothing is senttoken- ignored, nothing is sent- Returns:
- a failure response with status
-1and a body naming the removal - Scheduled removal version:
- 6.4.0
-
refused
The removed calls' failure response; the first call of each method in a run logs one INFO line. -
resetV1NoticeForTesting
static void resetV1NoticeForTesting()Test-only: forgets that this run already logged each removed call's INFO line.
-
/ulticloud loginand identified by its server credential.