本文整理汇总了Java中org.vertx.java.core.MultiMap类的典型用法代码示例。如果您正苦于以下问题:Java MultiMap类的具体用法?Java MultiMap怎么用?Java MultiMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiMap类属于org.vertx.java.core包,在下文中一共展示了MultiMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handle
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
@Override
public void handle(HttpClientResponse clientResponse) {
delegate.handle(clientResponse);
MultiMap headers = clientResponse.headers();
for (String headerName : rewriteHeaders) {
List<String> headerValues = headers.getAll(headerName);
int size = headerValues.size();
if (size > 0) {
List<String> newHeaders = new ArrayList<String>(size);
for (String headerValue : headerValues) {
String newValue = headerValue;
if (headerValue != null && headerValue.length() > 0) {
newValue = proxyMappingDetails.rewriteBackendUrl(headerValue);
}
}
LOG.info("Rewriting header " + headerName + " from: " + headerValues + " to: " + newHeaders);
headers.set(headerName, newHeaders);
}
}
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:22,代码来源:ReverseUriPolicy.java
示例2: sendFile
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public static void sendFile(Vertx vertx, String uri, int port, String content,
MultiMap headers, String filename,
String contentType, Handler<HttpClientResponse> handler) {
HttpClientRequest req = vertx.createHttpClient().setPort(port).post(uri, handler);
final String boundary = "dLV9Wyq26L_-JQxk6ferf-RT153LhOO";
Buffer buffer = new Buffer();
final String body = "--" + boundary + "\r\n" +
"Content-Disposition: form-data; name=\"file\"; filename=\""+ filename +"\"\r\n" +
"Content-Type: " + contentType + "\r\n" +
"\r\n" +
content + "\r\n" +
"--" + boundary + "--\r\n";
buffer.appendString(body);
req.headers().add(headers);
req.headers().set("content-length", String.valueOf(buffer.length()));
req.headers().set("content-type", "multipart/form-data; boundary=" + boundary);
req.write(buffer).end();
}
开发者ID:web-education,项目名称:web-utils,代码行数:21,代码来源:HttpClientUtils.java
示例3: from
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public static Query from( final HttpServerRequest request )
{
final MultiMap map = new CaseInsensitiveMultiMap();
final String query = request.query();
if ( query != null )
{
final String[] qe = query.split( "&" );
for ( final String entry : qe )
{
final int idx = entry.indexOf( '=' );
if ( idx > 1 )
{
map.add( entry.substring( 0, idx ), entry.substring( idx + 1 ) );
}
else
{
map.add( entry, "true" );
}
}
}
return new Query( map );
}
开发者ID:jdcasey,项目名称:vabr,代码行数:25,代码来源:Query.java
示例4: builtInParams_PrefixedPathWithParamsRightAfterPrefix
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
@Test
public void builtInParams_PrefixedPathWithParamsRightAfterPrefix()
throws Exception
{
final String path = "/:type/:name:path=(/.*)";
final String routePath = path;
final String handlerPath = "";
final MultiMap params = getParams( "/api", path, routePath, handlerPath, "/api/remote/foo/" );
final String basePath = "/api";
final String baseUrl = "http://" + host + ":" + port + basePath;
assertThat( params.get( BuiltInParam._classBase.key() ), equalTo( basePath ) );
assertThat( params.get( BuiltInParam._classContextUrl.key() ), equalTo( baseUrl ) );
assertThat( params.get( BuiltInParam._routeBase.key() ), equalTo( basePath ) );
assertThat( params.get( BuiltInParam._routeContextUrl.key() ), equalTo( baseUrl ) );
assertThat( params.get( "type" ), equalTo( "remote" ) );
assertThat( params.get( "name" ), equalTo( "foo" ) );
assertThat( params.get( "path" ), equalTo( "/" ) );
}
开发者ID:jdcasey,项目名称:vabr,代码行数:20,代码来源:ApplicationRouterTest.java
示例5: getParam
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public static String getParam(MultiMap params, String key, String defaultVal) {
if (params.contains(key)) {
List<String> vals = params.getAll(key);
if (vals != null) {
for (String val : vals) {
if (StringUtil.isNotEmpty(val)) {
return val;
}
}
}
}
return defaultVal;
}
开发者ID:rfxlab,项目名称:analytics-with-rfx,代码行数:14,代码来源:BeaconUtil.java
示例6: getNow
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
@Override
public HttpClient getNow(String s, MultiMap multiMap, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return this;
}
httpClient.getNow(s, multiMap, handler);
return this;
}
开发者ID:web-education,项目名称:vertx-swift-client,代码行数:10,代码来源:ResilientHttpClient.java
示例7: getParameterEntity
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
private Parameter<String> getParameterEntity(final MultiMap params) {
final List<Parameter<String>> parameters = params.
entries().
stream().
map(entry -> new Parameter<>(entry.getKey(), entry.getValue())).
collect(Collectors.toList());
return new Parameter<>(parameters);
}
开发者ID:amoAHCP,项目名称:vert.x-spring-microservice-demo,代码行数:9,代码来源:RestEntryVerticle.java
示例8: safeMultiMap
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public static MultiMap safeMultiMap(MultiMap m) {
for (String name : m.names()) {
List<String> values = m.getAll(name);
List<String> safeValues = new ArrayList<>();
if (values == null) continue;
for (String value: values) {
safeValues.add(stripXSS(value));
}
m.set(name, safeValues);
}
return m;
}
开发者ID:web-education,项目名称:web-utils,代码行数:13,代码来源:XSSUtils.java
示例9: bodyToParams
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
/**
* @deprecated Use request.formAttributes() instead
* @param request http request
* @param handler receive attributes
*/
public void bodyToParams(final HttpServerRequest request, final Handler<MultiMap> handler) {
request.expectMultiPart(true);
request.endHandler(new VoidHandler() {
@Override
protected void handle() {
handler.handle(request.formAttributes());
}
});
}
开发者ID:web-education,项目名称:web-utils,代码行数:15,代码来源:Server.java
示例10: jsonFromMultimap
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public static JsonObject jsonFromMultimap(MultiMap attributes) {
JsonObject json = new JsonObject();
if (attributes != null) {
for (Map.Entry<String, String> e: attributes.entries()) {
json.putString(e.getKey(), e.getValue());
}
}
return json;
}
开发者ID:web-education,项目名称:web-utils,代码行数:10,代码来源:Utils.java
示例11: getParams
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
private MultiMap getParams( final String prefix, final String bindingPath, final String routePath,
final String handlerPath, final String requestPath )
throws Exception
{
access = new ParamAccess();
server =
vertx.createHttpServer()
.requestHandler( new ApplicationRouter(
new ApplicationRouterConfig().withPrefix( prefix )
.withHandler( access )
.withRouteCollection( new ParamCollection(
bindingPath,
routePath,
handlerPath,
access ) ) ) )
.listen( port, host );
final HttpClientRequest req = client.get( requestPath, clientHandler );
req.end();
synchronized ( clientHandler )
{
clientHandler.wait();
}
return access.params();
}
开发者ID:jdcasey,项目名称:vabr,代码行数:30,代码来源:ApplicationRouterTest.java
示例12: setCorsHeaders
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public void setCorsHeaders(MultiMap headers){
headers.set("Access-Control-Allow-Origin","*");
headers.set("Access-Control-Allow-Credentials", "true");
headers.set("Access-Control-Allow-Methods", "POST, GET");
headers.set("Access-Control-Allow-Headers", "Content-Type, *");
}
开发者ID:rfxlab,项目名称:analytics-with-rfx,代码行数:7,代码来源:BaseHttpLogHandler.java
示例13: getRequestInfo
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public static String getRequestInfo(HttpServerRequest request){
StringBuilder reqInfo = new StringBuilder();
String remoteAddress = request.remoteAddress().toString();
MultiMap headers = request.headers();
reqInfo.append(" <br> IP remoteAddress: ").append(remoteAddress);
for (Entry<String, String> header : headers) {
reqInfo.append("<br> ").append(header.getKey()).append(" = ").append(header.getValue());
}
return reqInfo.toString();
}
开发者ID:rfxlab,项目名称:analytics-with-rfx,代码行数:17,代码来源:RequestInfoUtil.java
示例14: headers
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
@Override
public MultiMap headers() {
return headers;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:5,代码来源:StubHttpServletRequest.java
示例15: params
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
@Override
public MultiMap params() {
return params;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:5,代码来源:StubHttpServletRequest.java
示例16: formAttributes
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
@Override
public MultiMap formAttributes() {
return formAttributes;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:5,代码来源:StubHttpServletRequest.java
示例17: getHeaders
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public MultiMap getHeaders() {
return headers;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:4,代码来源:StubHttpServletRequest.java
示例18: setHeaders
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public void setHeaders(MultiMap headers) {
this.headers = headers;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:4,代码来源:StubHttpServletRequest.java
示例19: getParams
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public MultiMap getParams() {
return params;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:4,代码来源:StubHttpServletRequest.java
示例20: setParams
import org.vertx.java.core.MultiMap; //导入依赖的package包/类
public void setParams(MultiMap params) {
this.params = params;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:4,代码来源:StubHttpServletRequest.java
注:本文中的org.vertx.java.core.MultiMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论