本文整理匯總了Java中javax.ws.rs.core.UriBuilder.queryParam方法的典型用法代碼示例。如果您正苦於以下問題:Java UriBuilder.queryParam方法的具體用法?Java UriBuilder.queryParam怎麽用?Java UriBuilder.queryParam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.ws.rs.core.UriBuilder
的用法示例。
在下文中一共展示了UriBuilder.queryParam方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildAuthenticationRequestUri
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
public URI buildAuthenticationRequestUri(final URI redirectUri,
final String state,
final String nonce) {
openIdConfiguration.getAuthorizationEndpoint();
final UriBuilder b = UriBuilder.fromUri(openIdConfiguration.getAuthorizationEndpoint())
.queryParam("response_type", "code")
.queryParam("scope", scope)
.queryParam("client_id", clientId)
.queryParam("redirect_uri", redirectUri)
.queryParam("nonce", nonce);
if (state != null) {
b.queryParam("state", state);
}
if (display != null) {
b.queryParam("display", display);
}
if (prompt != null) {
b.queryParam("prompt", prompt);
}
return b
.build();
}
示例2: validateOpenShiftProjectExists
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
/**
* Validates if the OpenShift project exists
*
* @param authHeader
* @param project
* @return a validation message, returns {@link #VALIDATION_MESSAGE_OK} if the project does not exist
*/
public String validateOpenShiftProjectExists(String authHeader, String project, String cluster) {
String validationMessage;
try {
UriBuilder builder = UriBuilder.fromUri(missionControlValidationURI).path("/project/" + project);
if (cluster != null) {
builder.queryParam("cluster", cluster);
}
URI targetURI = builder.build();
if (head(targetURI, authHeader) == Response.Status.OK.getStatusCode()) {
validationMessage = "OpenShift Project '" + project + "' already exists";
} else {
validationMessage = VALIDATION_MESSAGE_OK;
}
} catch (Exception e) {
String message = e.getMessage();
Throwable root = rootException(e);
if (root instanceof UnknownHostException || root instanceof ConnectException) {
validationMessage = "Mission Control is offline and cannot validate the OpenShift Project Name";
} else {
if (root.getMessage() != null) {
message = root.getMessage();
}
validationMessage = "Error while validating OpenShift Project Name: " + message;
}
}
return validationMessage;
}
示例3: validateOpenShiftTokenExists
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
public String validateOpenShiftTokenExists(String authHeader, String cluster) {
String validationMessage;
try {
UriBuilder builder = UriBuilder.fromUri(missionControlValidationURI).path("/token/openshift");
if (cluster != null) {
builder.queryParam("cluster", cluster);
}
URI targetURI = builder.build();
if (head(targetURI, authHeader) == Response.Status.OK.getStatusCode()) {
validationMessage = VALIDATION_MESSAGE_OK;
} else {
validationMessage = "OpenShift Token does not exist";
}
} catch (Exception e) {
String message = e.getMessage();
Throwable root = rootException(e);
if (root instanceof UnknownHostException || root instanceof ConnectException) {
validationMessage = "Mission Control is offline and cannot validate if the OpenShift token exists";
} else {
if (root.getMessage() != null) {
message = root.getMessage();
}
validationMessage = "Error while validating if the OpenShift Token exists: " + message;
}
}
return validationMessage;
}
示例4: getEnabledIdentityProviders
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
@Timed
public List<String> getEnabledIdentityProviders(Optional<String> transactionEntityId) {
final UriBuilder uriBuilder = UriBuilder
.fromUri(configUri)
.path(Urls.ConfigUrls.ENABLED_IDENTITY_PROVIDERS_RESOURCE);
if (transactionEntityId.isPresent()) {
uriBuilder.queryParam(Urls.ConfigUrls.TRANSACTION_ENTITY_ID_PARAM, transactionEntityId.get());
}
URI uri = uriBuilder.build();
return jsonClient.get(uri, new GenericType<List<String>>() {
});
}
示例5: getEncodedUri
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
private URI getEncodedUri(final String path, final Map<String, String> queryParams, final String entityId) {
final UriBuilder uriBuilder = UriBuilder
.fromUri(configUri)
.path(path);
for (Map.Entry<String, String> entry : queryParams.entrySet()) {
uriBuilder.queryParam(entry.getKey(), entry.getValue());
}
return uriBuilder.buildFromEncoded(StringEncoding.urlEncode(entityId).replace("+", "%20"));
}
示例6: setUpStubForAssertionConsumerServiceUri
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
public void setUpStubForAssertionConsumerServiceUri(String entityId, Optional<Integer> assertionConsumerServiceIndex) throws JsonProcessingException {
UriBuilder uriBuilder = UriBuilder.fromPath(Urls.ConfigUrls.TRANSACTIONS_ASSERTION_CONSUMER_SERVICE_URI_RESOURCE);
if (assertionConsumerServiceIndex.isPresent()) {
uriBuilder.queryParam(Urls.ConfigUrls.ASSERTION_CONSUMER_SERVICE_INDEX_PARAM, assertionConsumerServiceIndex.get().toString());
}
URI uri = uriBuilder.buildFromEncoded(StringEncoding.urlEncode(entityId).replace("+", "%20"));
register(uri.toString(), OK, new ResourceLocation(URI.create("thisIsAnRpPostEndpointUri")));
}
示例7: getShouldHubSignResponseMessages
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
public Boolean getShouldHubSignResponseMessages(String entityId) {
final UriBuilder uriBuilder = UriBuilder
.fromUri(configUri)
.path(Urls.ConfigUrls.SHOULD_HUB_SIGN_RESPONSE_MESSAGES_RESOURCE);
for (Map.Entry<String, String> entry : ImmutableMap.<String, String>of().entrySet()) {
uriBuilder.queryParam(entry.getKey(), entry.getValue());
}
URI uri = uriBuilder.buildFromEncoded(StringEncoding.urlEncode(entityId).replace("+", "%20"));
try {
return booleanCache.getUnchecked(uri);
} catch (UncheckedExecutionException e) {
Throwables.throwIfUnchecked(e.getCause());
throw new RuntimeException(e.getCause());
}
}
示例8: getShouldHubUseLegacySamlStandard
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
public Boolean getShouldHubUseLegacySamlStandard(String entityId) {
final UriBuilder uriBuilder = UriBuilder
.fromUri(configUri)
.path(Urls.ConfigUrls.SHOULD_HUB_USE_LEGACY_SAML_STANDARD_RESOURCE);
for (Map.Entry<String, String> entry : ImmutableMap.<String, String>of().entrySet()) {
uriBuilder.queryParam(entry.getKey(), entry.getValue());
}
URI uri = uriBuilder.buildFromEncoded(StringEncoding.urlEncode(entityId).replace("+", "%20"));
try {
return booleanCache.getUnchecked(uri);
} catch (UncheckedExecutionException e) {
Throwables.throwIfUnchecked(e.getCause());
throw new RuntimeException(e.getCause());
}
}
示例9: createLink
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
private Link createLink(String rel, int pageNum, int perPage) {
UriBuilder uriBuilder = uriBuilderSupplier.get().clone()
.queryParam(RouterObjectService.PAGE_NUMBER_PARAM, String.valueOf(pageNum));
if (perPage != 10) {
uriBuilder.queryParam(RouterObjectService.ITEMS_PER_PAGE_PARAM, String.valueOf(perPage));
}
return linkCreator.apply(Link.fromUriBuilder(uriBuilder).rel(rel));
}
示例10: rebuildQuery
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
/** Rebuild the URI query with lower case parameter names. */
private static URI rebuildQuery(final URI uri,
final MultivaluedMap<String, String> parameters) {
UriBuilder b = UriBuilder.fromUri(uri).replaceQuery("");
for(Map.Entry<String, List<String>> e : parameters.entrySet()) {
final String key = StringUtils.toLowerCase(e.getKey());
for(String v : e.getValue()) {
b = b.queryParam(key, v);
}
}
return b.build();
}
示例11: addResponseSocketOpenTimeUrlParameter
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
private void addResponseSocketOpenTimeUrlParameter(SessionStatusRequest request, UriBuilder uriBuilder) {
if (request.isResponseSocketOpenTimeSet()) {
TimeUnit timeUnit = request.getResponseSocketOpenTimeUnit();
long timeValue = request.getResponseSocketOpenTimeValue();
long queryTimeoutInMilliseconds = timeUnit.toMillis(timeValue);
uriBuilder.queryParam("timeoutMs", queryTimeoutInMilliseconds);
}
}