本文整理匯總了Java中io.vertx.core.MultiMap.get方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiMap.get方法的具體用法?Java MultiMap.get怎麽用?Java MultiMap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.MultiMap
的用法示例。
在下文中一共展示了MultiMap.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFormattedElement
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public String getFormattedElement(AccessLogParam accessLogParam) {
HttpServerResponse response = accessLogParam.getRoutingContext().response();
if (null == response) {
return RESULT_NOT_FOUND;
}
MultiMap headers = response.headers();
if (null == headers) {
return RESULT_NOT_FOUND;
}
String result = headers.get(identifier);
if (null == result) {
return RESULT_NOT_FOUND;
}
return result;
}
示例2: TileCtx
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
/**
* Default constructor.
* @param params {@link io.vertx.core.http.HttpServerRequest} parameters
* required for rendering an image region.
* @param omeroSessionKey OMERO session key.
*/
TileCtx(MultiMap params, String omeroSessionKey) {
this.omeroSessionKey = omeroSessionKey;
imageId = Long.parseLong(params.get("imageId"));
z = Integer.parseInt(params.get("z"));
c = Integer.parseInt(params.get("c"));
t = Integer.parseInt(params.get("t"));
Integer x = Optional.ofNullable(params.get("x"))
.map(Integer::parseInt)
.orElse(0);
Integer y = Optional.ofNullable(params.get("y"))
.map(Integer::parseInt)
.orElse(0);
Integer width = Optional.ofNullable(params.get("w"))
.map(Integer::parseInt)
.orElse(0);
Integer height = Optional.ofNullable(params.get("h"))
.map(Integer::parseInt)
.orElse(0);
region = new RegionDef(x, y, width, height);
resolution = Optional.ofNullable(params.get("resolution"))
.map(Integer::parseInt)
.orElse(null);
format = params.get("format");
}
示例3: call
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
MultiMap headers = httpServerRequest.headers();
String value = headers.get(headerName);
if (value != null) {
boolean failed = false;
BaseEncoding baseEncoding = base64();
try {
byte[] decoded = baseEncoding.decode(value);
if (decoded == null || !value.equals(baseEncoding.encode(decoded))) {
failed = true;
}
} catch (Throwable e) {
// do nothing
}
if (failed) {
JsonObject jsonObject = new JsonObject()
.put("message", format("%s must be Base64 encoded", headerName));
throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
}
}
return httpServerRequest;
}
示例4: call
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
MultiMap headers = httpServerRequest.headers();
String value = headers.get(headerName);
if (value != null) {
Long parsed = tryParse(value);
if (parsed == null || parsed < min || parsed > max) {
JsonObject jsonObject = new JsonObject()
.put("message", format("%s must be between %d and %d", headerName, min, max));
throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
}
}
return httpServerRequest;
}
示例5: call
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
MultiMap params = httpServerRequest.params();
String value = params.get(paramName);
if (value != null) {
boolean failed = false;
BaseEncoding baseEncoding = base64();
try {
byte[] decoded = baseEncoding.decode(value);
if (decoded == null || value.equals(baseEncoding.encode(decoded))) {
failed = true;
}
} catch (Throwable e) {
// do nothing
}
if (failed) {
JsonObject jsonObject = new JsonObject()
.put("message", format("%s must be Base64 encoded", paramName));
throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
}
}
return httpServerRequest;
}
示例6: call
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
MultiMap param = httpServerRequest.params();
String value = param.get(paramName);
if (value != null) {
Long parsed = tryParse(value);
if (parsed == null || parsed < min || parsed > max) {
JsonObject jsonObject = new JsonObject()
.put("message", format("%s must be between %d and %d", paramName, min, max));
throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
}
}
return httpServerRequest;
}
示例7: getRemoteServiceUrl
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
public static String getRemoteServiceUrl(HttpServerRequest httpServerRequest) {
try {
URI absoluteRequestURI = new URI(httpServerRequest.absoluteURI());
MultiMap headers = httpServerRequest.headers();
String host = getFirstHeader(httpServerRequest, "X-Forwarded-Host");
String contextRoot = getFirstHeader(httpServerRequest, SfsHttpHeaders.X_CONTEXT_ROOT);
if (host == null) host = getFirstHeader(httpServerRequest, HttpHeaders.HOST);
if (host == null) host = absoluteRequestURI.getHost();
String proto = headers.get(HttpHeaders.X_FORWARDED_PROTO);
if (proto == null) proto = absoluteRequestURI.getScheme();
String serviceUrl;
if (contextRoot != null) {
serviceUrl = String.format("%s://%s/%s", proto, host, contextRoot);
} else {
serviceUrl = String.format("%s://%s", proto, host);
}
return serviceUrl;
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
示例8: getFormattedElement
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public String getFormattedElement(AccessLogParam accessLogParam) {
MultiMap headers = accessLogParam.getRoutingContext().request().headers();
if (null == headers) {
return "-";
}
String result = headers.get(identifier);
if (null == result) {
return RESULT_NOT_FOUND;
}
return result;
}
示例9: userId
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
private String userId(MultiMap headers) {
if (headers == null || headers.get(UserModel.userId) == null) {
throw new MessageBusException("UserId must be present in message headers or in userId field");
}
return headers.get(UserModel.userId);
}
示例10: convert
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
private SimpleEventBus.Params convert(Params params) {
final MultiMap headers = params.getOptions().getHeaders();
if (headers == null) {
params.getOptions().setHeaders(new VertxMultiMap(
ImmutableListMultimap.of(UserModel.userId, params.getUserId())
));
} else if (headers.get(UserModel.userId) == null) {
params.getOptions().setHeaders(new VertxMultiMap(
ImmutableListMultimap.<String, String>builder()
.putAll(headers.entries())
.put(UserModel.userId, params.getUserId())
.build()
));
}
return SimpleEventBus.Params.builder()
.address(params.getAddress())
.message(params.getMessage())
.options(params.getOptions())
.build();
}
示例11: WebSession
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
private WebSession(SockJSSocket sockJSSocket, MultiMap sessionData,
AsyncCallback<WebSession> readyCallback,
ErrorCallback errorCallback) {
this.sessionData = new SessionData(sessionData.get("name"),
sessionData.get("email"), sessionData.get("topic"));
this.sockJSSocket = sockJSSocket;
initWebSocket(sockJSSocket);
CompletableFuture.runAsync(
() -> createRoom(readyCallback, errorCallback), executor);
}
示例12: extract
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public String extract(String name, boolean required, HttpServerRequest request) {
MultiMap params = request.params();
if (!params.contains(name) && required) {
throw new IllegalArgumentException("Missing required parameter: " + name);
}
return params.get(name);
}
示例13: manageHeaders
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
private static void manageHeaders(HttpServerResponse httpServerResponse, MultiMap messageHeaders) {
if(messageHeaders.contains(CUSTOM_STATUS_CODE_HEADER_KEY)) {
Integer customStatusCode = Integer.valueOf(messageHeaders.get(CUSTOM_STATUS_CODE_HEADER_KEY));
httpServerResponse.setStatusCode(customStatusCode);
messageHeaders.remove(CUSTOM_STATUS_CODE_HEADER_KEY);
}
if(messageHeaders.contains(CUSTOM_STATUS_MESSAGE_HEADER_KEY)) {
String customStatusMessage = messageHeaders.get(CUSTOM_STATUS_MESSAGE_HEADER_KEY);
httpServerResponse.setStatusMessage(customStatusMessage);
messageHeaders.remove(CUSTOM_STATUS_MESSAGE_HEADER_KEY);
}
httpServerResponse.headers().addAll(messageHeaders);
}
示例14: extract
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
public Object extract(String name, Parameter parameter, MultiMap params) {
AbstractSerializableParameter abstractSerializableParameter = (AbstractSerializableParameter) parameter;
if (!params.contains(name)) {
if (abstractSerializableParameter.getRequired()) {
throw new IllegalArgumentException("Missing required parameter: " + name);
} else if (abstractSerializableParameter.getDefaultValue()!=null){
return abstractSerializableParameter.getDefaultValue();
} else {
return null;
}
}
if ((abstractSerializableParameter.getAllowEmptyValue() == null
|| !abstractSerializableParameter.getAllowEmptyValue())
&& StringUtils.isEmpty(params.get(name))) {
throw new IllegalArgumentException(
"Empty value is not authorized for parameter: " + name);
}
if ("array".equals(abstractSerializableParameter.getType())) {
if ("multi".equals(abstractSerializableParameter.getCollectionFormat())) {
return params.getAll(name);
} else {
List<String> resultParams = this.splitArrayParam(abstractSerializableParameter,
params.get(name));
if (resultParams != null) {
return resultParams;
}
}
}
return params.get(name);
}
示例15: call
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
MultiMap headers = httpServerRequest.headers();
String value = headers.get(headerName);
if (value != null) {
JsonObject jsonObject = new JsonObject()
.put("message", format("%s is not supported", headerName));
throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
}
return httpServerRequest;
}