public final class HTTPURLBuilder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.String,java.lang.Object> |
EMPTY_PARAMETERS
Empty map with parameters.
|
private UESEntityType |
etSvc
Reference to UES entity type.
|
private UESLogger |
logger
Reference to UES logger used in this class.
|
private static java.lang.String |
PARAM_ACTION
This parameter is dependent to code in
cz.unicorn.afu_v1.af_v1.appc_v1.ucm_v3.action.UESExpectedActionImpl#toString() . |
private static java.lang.String |
PARAM_SESSION_FREE_LINK
Parameter name for session free link.
|
static java.lang.String |
UC_DEFAULT
Code for default Use Case.
|
private static java.lang.String |
UC_PREFIX
This prefix specifies that a string contains use case.
|
private UESUseCaseProvider |
ucProvider
Reference to Use Case provider.
|
private static java.lang.String |
URL_PARAMETERS_PART_SEPARATOR
Separator in URL which determines URL part containing parameters.
|
private static java.lang.String |
URL_PARAMETERS_SEPARATOR
Separator used for separate parameters in URL.
|
private static java.lang.String |
URL_VALUE_SEPARATOR
Separator for separate parameter name from parameter value.
|
Modifier | Constructor and Description |
---|---|
private |
HTTPURLBuilder()
Creates a new instance of HTTPURLBuilder.
|
Modifier and Type | Method and Description |
---|---|
private UESURI |
addParameters(UESURI uri,
Creates UESURI from specified UESURI and passed map of parameters.
|
private java.lang.String |
createUrl(java.lang.String urlPrefix,
Creates URL from URL prefix and part for Use Case.
|
private java.lang.String |
encodeForHttp(java.lang.String value)
Encodes string to form suitable for passing into web link.
|
private java.lang.String |
formatUCQueryPart(UESURI useCaseUri)
Converts UESURI of Use Case to String form.
|
private UESURIPart |
getDefaultUseCase()
Returns Use Case UESURIPart for default Use Case.
|
java.lang.String |
getHref(java.lang.String urlPrefix,
Creates string convenient to be used in attribute
href of HTML link. |
java.lang.String |
getHref(java.lang.String urlPrefix,
Creates string convenient to be used in attribute
href of HTML link. |
java.lang.String |
getHref(java.lang.String urlPrefix,
Creates string convenient to be used in attribute
href of HTML link. |
java.lang.String |
getHref(java.lang.String urlPrefix,
Creates string convenient to be used in attribute
href of HTML link. |
java.lang.String |
getHref(java.lang.String urlPrefix,
Creates string convenient to be used in attribute
href of HTML link. |
static HTTPURLBuilder |
getInstance()
Returns instance of HTTPURLBuilder.
|
private UESURIPart |
getUseCase(java.lang.String useCase)
Extracts Use Case from string.
|
java.lang.String |
getUseCaseQueryPart(java.lang.String useCase,
Creates query part (convenient to be used within attribute
href of HTML link)
according to passed Use Case UESURI, UESURI of main entity and additional parameters
for the main entity UESURI. |
java.lang.String |
getUseCaseQueryPart(UESURI useCaseUri)
Creates query part (convenient to be used within attribute
href of HTML link)
according to Use Case specified by UESURI. |
java.lang.String |
getUseCaseQueryPart(UESURI useCaseUri,
Creates query part (convenient to be used within attribute
href of HTML link)
for Use Case specified by UESURI and supplemented with passed additional parameters. |
java.lang.String |
getUseCaseQueryPart(UESURI useCaseUri,
Creates query part (convenient to be used within attribute
href of HTML link)
according to passed Use Case UESURI and UESURI of main entity. |
java.lang.String |
getUseCaseQueryPart(UESURI useCaseUri,
Creates query part (convenient to be used within attribute
href of HTML link)
according to passed Use Case UESURI (supplemented with passed additional parameters)
and UESURI of main entity. |
private UESURI |
getUseCaseUri(UESURI useCaseUri,
Creates Use Case UESURI in form
ues:terr:entity? |
private boolean |
checkMainEntityType(UESURI useCaseUri,
Checks entity type of specified main entity according to entity type of Use Case.
|
private boolean |
isDefined(java.lang.String id)
Tests whether is passed id not null and not empty.
|
private UESURI |
updateUseCaseUri(UESURI useCaseUri)
Sets default Use Case part if there is no Use Case part in passed UESURI.
|
cz.unicorn.afu_v1.af_v1.appc_v1.ucm_v3.action.UESExpectedActionImpl#toString()
.Creates query part (convenient to be used within attribute href
of HTML link)
according to Use Case specified by UESURI.
The resulting string will have following form: "action=encoded_UESURI&SessFree=encoded_UESURI"
where the encoded_UESURI
is the Use Case UESURI converted into string and
encoded to the application/x-www-form-urlencoded
MIME format.
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); UESURI ucUri = ...; String queryPart = httpUrlBuilder.getUseCaseQueryPart(ucUri); String href = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&" + queryPart; ...
useCaseUri
- UESURI of use case in one of following forms:
UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the Use
Case doesn't exist in Use Case Registry.Creates query part (convenient to be used within attribute href
of HTML link)
for Use Case specified by UESURI and supplemented with passed additional parameters.
The resulting string will have following form: "action=encoded_UESURI&SessFree=encoded_UESURI"
where the encoded_UESURI
is the Use Case UESURI (supplemented with passed
additional parameters) converted into string and encoded to the
application/x-www-form-urlencoded
MIME format.
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); UESURI ucUri = ...; Map<String, Object> parameters = ...; String queryPart = httpUrlBuilder.getUseCaseQueryPart(ucUri, parameters); String href = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&" + queryPart; ...
useCaseUri
- UESURI of use case in one of following forms:
parameters
- Additional parameters. The additional parameters will be added to
the Use Case UESURI. These parameter may override parameters in the Use Case UESURI.UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the Use
Case doesn't exist in Use Case Registry.Creates query part (convenient to be used within attribute href
of HTML link)
according to passed Use Case UESURI and UESURI of main entity.
The resulting string will have following form: "action=encoded_UESURI&SessFree=encoded_UESURI"
where the encoded_UESURI
is the Use Case UESURI converted into string and
encoded to the application/x-www-form-urlencoded
MIME format.
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); UESURI ucUri = UESURI.parseURI("ues:terr:entity_type:use_case"); UESURI mainEntityUri = UESURI.parseURI("ues:terr:entity"); String queryPart = httpUrlBuilder.getUseCaseQueryPart(ucUri, mainEntityUri); String href = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&" + queryPart; ...
useCaseUri
- UESURI of use case in form ues:territory:entity_type:use_case
.mainEntityUri
- UESURI of main entity. This UESURI should not contain Use Case part.UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the UESURI
of main entity is null or no Use Case can be obtained from Use Case Registry.Creates query part (convenient to be used within attribute href
of HTML link)
according to passed Use Case UESURI (supplemented with passed additional parameters)
and UESURI of main entity.
The resulting string will have following form: "action=encoded_UESURI&SessFree=encoded_UESURI"
where the encoded_UESURI
is the Use Case UESURI (supplemented with passed
additional parameters) converted into string and encoded to the
application/x-www-form-urlencoded
MIME format.
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); Map<String, Object> parameters = ...; UESURI ucUri = UESURI.parseURI("ues:terr:entity_type:use_case"); UESURI mainEntityUri = UESURI.parseURI("ues:terr:entity"); String queryPart = httpUrlBuilder.getUseCaseQueryPart(ucUri, mainEntityUri, parameters); String href = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&" + queryPart; ...
useCaseUri
- UESURI of use case in form ues:territory:entity_type:use_case
.mainEntityUri
- UESURI of main entity. This UESURI should not contain Use Case part.parameters
- Additional parameters. The additional parameters will be added to
the Use Case UESURI. These parameter may override parameters in the Use Case UESURI.UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the UESURI
of main entity is null or no Use Case can be obtained from Use Case Registry.Creates query part (convenient to be used within attribute href
of HTML link)
according to passed Use Case UESURI, UESURI of main entity and additional parameters
for the main entity UESURI.
The resulting string will have following form: "action=encoded_UESURI&SessFree=encoded_UESURI"
where the encoded_UESURI
is the Use Case UESURI (supplemented with passed
additional parameters) converted into string and encoded to the
application/x-www-form-urlencoded
MIME format.
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); Map<String, Object> parameters = ...; UESURI ucUri = UESURI.parseURI("ues:terr:entity_type:use_case"); UESURI mainEntityUri = UESURI.parseURI("ues:terr:entity"); String queryPart = httpUrlBuilder.getUseCaseQueryPart(ucUri, mainEntityUri, parameters); String href = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&" + queryPart; ...
useCase
- Use Case specified by prefix uesuc:
.mainEntityUri
- UESURI of main entity. This UESURI should not contain Use Case part.parameters
- Additional parameters. The additional parameters will be added to
the Use Case UESURI. These parameter may override parameters in the Use Case UESURI.UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the Use
Case doesn't exist in Use Case Registry or the useCase parameter doesn't identify any Use Case.Creates string convenient to be used in attribute href
of HTML link. This
link will execute the use case (if it is used for navigation).
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); UESURI ucUri = UESURI.parseURI("ues:terr:entity?use_case"); String urlPrefix = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&"; String href = httpUrlBuilder.getHref(urlPrefix, ucUri); ...
urlPrefix
- Prefix of the final string.useCaseUri
- UESURI of use case in one of following forms:
UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the Use
Case doesn't exist in Use Case Registry.Creates string convenient to be used in attribute href
of HTML link. This
link will execute the Use Case (if it is used for navigation).
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); Map<String,Object> parameters = ...; UESURI ucUri = UESURI.parseURI("ues:terr:entity?use_case"); String urlPrefix = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&"; String href = httpUrlBuilder.getHref(urlPrefix, ucUri, parameters); ...
urlPrefix
- Prefix of the final string.useCaseUri
- UESURI of use case in one of following forms:
parameters
- Additional parameters. The additional parameters will be added to
the Use Case UESURI. These parameter may override parameters in the Use Case UESURI.UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the Use
Case doesn't exist in Use Case Registry.Creates string convenient to be used in attribute href
of HTML link. This
link will execute the Use Case (if it is used for navigation).
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); UESURI ucUri = UESURI.parseURI("ues:territory:entity_type:use_case"); UESURI mainEntityUri = UESURI.parseURI("ues:terr:entity"); String urlPrefix = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&"; String href = httpUrlBuilder.getHref(urlPrefix, ucUri, mainEntityUri); ...
urlPrefix
- Prefix of the final string.useCaseUri
- UESURI of use case in form ues:territory:entity_type:use_case
.mainEntityUri
- UESURI of main entity. This UESURI should not contain Use Case part.UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the UESURI
of main entity is null or no Use Case can be obtained from Use Case Registry.Creates string convenient to be used in attribute href
of HTML link. This
link will execute the Use Case (if it is used for navigation).
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); Map<String,Object> parameters = ...; UESURI ucUri = UESURI.parseURI("ues:territory:entity_type:use_case"); UESURI mainEntityUri = UESURI.parseURI("ues:terr:entity"); String urlPrefix = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&"; String href = httpUrlBuilder.getHref(urlPrefix, ucUri, mainEntityUri, parameters); ...
urlPrefix
- Prefix of the final string.useCaseUri
- UESURI of use case in form ues:territory:entity_type:use_case
.mainEntityUri
- UESURI of main entity. This UESURI should not contain Use Case part.parameters
- Additional parameters. The additional parameters will be added to
the Use Case UESURI. These parameter may override parameters in the Use Case UESURI.UESHTTPURLBuilderRTException
- If either the Use Case UESURI is null or the UESURI
of main entity is null or no Use Case can be obtained from Use Case Registry.Creates string convenient to be used in attribute href
of HTML link. This
link will execute the Use Case (if it is used for navigation).
Usage example:
... HTTPURLBuilder httpUrlBuilder = HTTPURLBuilder.getInstance(); Map<String,Object> parameters = ...; UESURI useCase = "uesuc:use_case"; UESURI mainEntityUri = UESURI.parseURI("ues:terr:entity"); String urlPrefix = "https://plus4u.net/ues/sesm;jsessionid=...?REQID=...&WINID=...&ref=...&"; String href = httpUrlBuilder.getHref(urlPrefix, useCase, mainEntityUri, parameters); ...
urlPrefix
- Prefix of the final string.useCase
- Use Case specified by prefix uesuc:
.mainEntityUri
- UESURI of main entity. This UESURI should not contain Use Case part.parameters
- Additional parameters. The additional parameters will be added to
the Use Case UESURI. These parameter may override parameters in the Use Case UESURI.UESHTTPURLBuilderRTException
- If either the Use Case doesn't identify any Use Case
or the UESURI of main entity is null or no Use Case can be obtained from Use Case Registry.ues:terr:entity?useCase
.useCaseUri
- Use Case UESURI. This UESURI must be in form ues:#{system}:entityType:useCase
.mainEntity
- UESURI of main entity.ues:terr:entity?useCase
.useCaseUri
- Use Case UESURI.mainEntity
- Main entity UESURI.true
if the entity type of main entity is the same as entity type of
the Use Case or it is the child ofurlPrefix
- URL prefix. This parameter cannot be null or empty.actionPart
- Use Case part.useCaseUri
- Use Case UESURI.value
- String to convert.uri
- UESURI.parameters
- Parameters to be merged into the UESURI.useCaseUri
- Use Case UESURI.id
- Tested Id.true
if the passed Id is not null and not
empty; otherwise the value false
.uesuc:UseCase
.useCase
- String with Use Case.null
if the Use Case
UESURI part cannot be parsed (e.g. it is null or it has unexpected format).