org.vertx.java.core.MultiMap类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中org.vertx.java.core.MultiMap类的一些代码示例,展示了MultiMap类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap类的具体详情如下:
包路径:org.vertx.java.core.MultiMap
类名称:MultiMap

MultiMap介绍

暂无

代码示例

代码示例来源:origin: org.commonjava.vertx/vabr-api

public String get( final String name )
{
  return map.get( name );
}

代码示例来源:origin: com.github.flowersinthesand/portal-vertx

@Override
  public void handle(HttpServerRequest req) {
    req.response().headers().add(AbstractSocketFactory.noCacheHeader()).add(AbstractSocketFactory.corsHeader(req.headers().get("Origin")));
    String when = req.params().get("when");
    if (when.equals("open") || when.equals("poll")) {
      socketFactory.openHttp(req);
    } else if (when.equals("abort")) {
      socketFactory.abort(req.params().get("id"));
    }
  }
};

代码示例来源:origin: org.commonjava.vertx/vabr-api

public boolean contains( final String name )
{
  return map.contains( name );
}

代码示例来源:origin: boonproject/boon

public static Map<String, String> toMap(MultiMap multiMap) {
    Map<String, String> map = new HashMap<String, String>();
    for (String name : multiMap.names()) {
      List<String> all = multiMap.getAll(name);
      if (all.size() > 0) {
        map.put(name, all.get(0));
      }
    }
    return map;
  }
}

代码示例来源:origin: io.fabric8/gateway-core

@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);
      }
    }
  }
}

代码示例来源:origin: boonproject/boon

response = new RedirectResponse(httpClientResponse.headers().get("Location"));
  return response;
} else {
  die(httpClientResponse.statusCode(), httpClientResponse.headers().entries());
  return null;

代码示例来源:origin: io.fabric8/gateway-apiman

serviceResponse.setAttribute(ApiManService.ATTR_HTTP_CLIENT, httpClient);
Map<String,String> headerMap = new HashMap<String,String>();
for (String key : clientResponse.headers().names()) {
  headerMap.put(key, clientResponse.headers().get(key));

代码示例来源:origin: com.englishtown/vertx-mod-jersey

String contentType = vertxRequest.headers().get(HttpHeaders.CONTENT_TYPE);
    vertxRequest.headers().remove(HttpHeaders.CONTENT_TYPE);
    vertxRequest.headers().add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);

代码示例来源:origin: io.vertx/mod-web-server

public void handle(HttpServerRequest req) {
 String acceptEncoding = req.headers().get(Headers.ACCEPT_ENCODING);
 boolean acceptEncodingGzip = acceptEncoding == null ? false : acceptEncoding.contains("gzip");
   if (req.headers().contains(Headers.IF_MATCH)) {
    String checkEtags = req.headers().get(Headers.IF_MATCH);
    if (checkEtags.indexOf(',') > -1) {
   else if (req.headers().contains(Headers.IF_NONE_MATCH)) {
    String checkEtags = req.headers().get(Headers.IF_NONE_MATCH);
   else if (req.headers().contains(Headers.IF_MODIFIED_SINCE)) {
    try {
     String ifModifiedSince = req.headers().get(Headers.IF_MODIFIED_SINCE);
     long ifModifiedSinceTime = parseDateHeader(ifModifiedSince);
     if (lastModifiedTime == ifModifiedSinceTime) {
   if (req.headers().contains(Headers.IF_UNMODIFIED_SINCE)) {
    try {
     String ifUnmodifiedSince = req.headers().get(Headers.IF_UNMODIFIED_SINCE);
     long ifUnmodifiedSinceTime = parseDateHeader(ifUnmodifiedSince);

代码示例来源:origin: org.commonjava.vertx/vabr-api

public Respond headers( final Map<String, String> headers )
{
  this.headers.add( headers );
  return this;
}

代码示例来源:origin: com.englishtown/vertx-mod-jersey

/**
 * {@inheritDoc}
 */
@Override
public void close() throws IOException {
  // Write any remaining buffer to the vert.x response
  // Set content-length if not set yet
  if (buffer != null && buffer.length() > 0) {
    if (!response.headers().contains(HttpHeaders.CONTENT_LENGTH)) {
      response.headers().add(HttpHeaders.CONTENT_LENGTH, String.valueOf(buffer.length()));
    }
    response.write(buffer);
  }
  buffer = null;
  isClosed = true;
}

代码示例来源:origin: vert-x/mod-lang-php

@Override
public Value offsetSet(Value name, Value value) {
 map.set(name.toString(), value.toString());
 return null;
}

代码示例来源:origin: org.commonjava.vertx/vabr-api

public List<Entry<String, String>> entries()
{
  return map.entries();
}

代码示例来源:origin: org.commonjava.vertx/vabr-api

public List<String> getAll( final String name )
{
  return map.getAll( name );
}

代码示例来源:origin: org.commonjava.vertx/vabr-api

public Set<String> names()
{
  return map.names();
}

代码示例来源:origin: boonproject/boon

response = new RedirectResponse(httpClientResponse.headers().get("Location"));
  return response;
} else {
  die(httpClientResponse.statusCode(), httpClientResponse.headers().entries());
  return null;

代码示例来源:origin: io.fabric8/gateway-apiman

srequest.setDestination(request.path());
Map<String,String> headerMap = new HashMap<String,String>();
for (String key : request.headers().names()) {
  headerMap.put(key, request.headers().get(key));

代码示例来源:origin: org.commonjava.vertx/vabr-api

public Respond header( final String key, final String value )
{
  this.headers.add( key, value );
  return this;
}

代码示例来源:origin: org.commonjava.vertx/vabr-api

for ( final String key : headers.names() )
    logger.debug( "Writing headers: {} = {}", key, headers.getAll( key ) );
    response.putHeader( key, headers.getAll( key ) );

代码示例来源:origin: jboss-fuse/fabric8

@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);
      }
    }
  }
}

相关文章