org.simpleframework.http.Request.getNames()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(145)

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

Request.getNames介绍

暂无

代码示例

代码示例来源:origin: jersey/jersey

@Override
public void handle(final Request request, final Response response) {
  final ResponseWriter responseWriter = new ResponseWriter(response, scheduler);
  final URI baseUri = getBaseUri(request);
  final URI requestUri = getRequestUri(request, baseUri);
  try {
    final ContainerRequest requestContext = new ContainerRequest(baseUri, requestUri,
        request.getMethod(), getSecurityContext(request), new MapPropertiesDelegate());
    requestContext.setEntityStream(request.getInputStream());
    for (final String headerName : request.getNames()) {
      requestContext.headers(headerName, request.getValue(headerName));
    }
    requestContext.setWriter(responseWriter);
    requestContext.setRequestScopedInitializer(injectionManager -> {
      injectionManager.<Ref<Request>>getInstance(RequestTYPE).set(request);
      injectionManager.<Ref<Response>>getInstance(ResponseTYPE).set(response);
    });
    appHandler.handle(requestContext);
  } catch (final Exception ex) {
    throw new RuntimeException(ex);
  } finally {
    if (!responseWriter.isSuspended()) {
      close(response);
    }
  }
}

代码示例来源:origin: ngallagher/simpleframework

/**
* This method is used to get a <code>List</code> of the names
* for the headers. This will provide the original names for the
* HTTP headers for the message. Modifications to the provided
* list will not affect the header, the list is a simple copy.
*
* @return this returns a list of the names within the header
*/
public List<String> getNames() {
 return request.getNames();
}

代码示例来源:origin: org.simpleframework/simple-http

/**
* This method is used to get a <code>List</code> of the names
* for the headers. This will provide the original names for the
* HTTP headers for the message. Modifications to the provided
* list will not affect the header, the list is a simple copy.
*
* @return this returns a list of the names within the header
*/
public List<String> getNames() {
 return request.getNames();
}

代码示例来源:origin: org.simpleframework/simple

/**
* This method is used to get a <code>List</code> of the names
* for the headers. This will provide the original names for the
* HTTP headers for the message. Modifications to the provided
* list will not affect the header, the list is a simple copy.
*
* @return this returns a list of the names within the header
*/
public List<String> getNames() {
 return request.getNames();
}

代码示例来源:origin: CodeStory/fluent-http

@Override
public List<String> headerNames() {
 return request.getNames();
}

代码示例来源:origin: lantunes/fixd

public List<String> getHeaderNames() {
  
  return request.getNames();
}

代码示例来源:origin: miltonio/milton2

public Map<String, String> getHeaders() {
  Map<String, String> headers = new HashMap<String, String>();
  for (String s : baseRequest.getNames()) {
    String val = baseRequest.getValue(s);
    headers.put(s, val);
  }
  return headers;
}

代码示例来源:origin: com.sun.jersey.contribs/jersey-simple-server

private InBoundHeaders getHeaders(Request request) {
  InBoundHeaders header = new InBoundHeaders();
  List<String> names = request.getNames();
  for (String name : names) {
    String value = request.getValue(name);
    header.add(name, value);
  }
  return header;
}

代码示例来源:origin: org.restlet/org.restlet.ext.simple

/**
 * Returns the list of request headers.
 * 
 * @return The list of request headers.
 */
@Override
public Series<Parameter> getRequestHeaders() {
  final Series<Parameter> result = super.getRequestHeaders();
  if (!this.requestHeadersAdded) {
    final List<String> names = this.request.getNames();
    for (String name : names) {
      result.add(new Parameter(name, this.request.getValue(name)));
    }
    this.requestHeadersAdded = true;
  }
  return result;
}

代码示例来源:origin: kristofa/mock-http-server

public static FullHttpRequest convert(final Request request) {
  byte[] data = null;
  try {
    final InputStream inputStream = request.getInputStream();
    try {
      data = IOUtils.toByteArray(inputStream);
    } finally {
      inputStream.close();
    }
  } catch (final IOException e) {
    LOGGER.error("IOException when getting request content.", e);
  }
  final FullHttpRequestImpl httpRequest = new FullHttpRequestImpl();
  httpRequest.domain(request.getAddress().getDomain());
  httpRequest.port(request.getAddress().getPort());
  httpRequest.method(Method.valueOf(request.getMethod()));
  httpRequest.path(request.getPath().getPath());
  if (data.length > 0) {
    httpRequest.content(data);
  }
  for (final String headerField : request.getNames()) {
    for (final String headerFieldValue : request.getValues(headerField)) {
      httpRequest.httpMessageHeader(headerField, headerFieldValue);
    }
  }
  for (final Entry<String, String> entry : request.getQuery().entrySet()) {
    httpRequest.queryParameter(entry.getKey(), entry.getValue());
  }
  return httpRequest;
}

代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-simple-http

@Override
public void handle(final Request request, final Response response) {
  final ResponseWriter responseWriter = new ResponseWriter(response, scheduler);
  final URI baseUri = getBaseUri(request);
  final URI requestUri = getRequestUri(request, baseUri);
  try {
    final ContainerRequest requestContext = new ContainerRequest(baseUri, requestUri,
        request.getMethod(), getSecurityContext(request), new MapPropertiesDelegate());
    requestContext.setEntityStream(request.getInputStream());
    for (final String headerName : request.getNames()) {
      requestContext.headers(headerName, request.getValue(headerName));
    }
    requestContext.setWriter(responseWriter);
    requestContext.setRequestScopedInitializer(injectionManager -> {
      injectionManager.<Ref<Request>>getInstance(RequestTYPE).set(request);
      injectionManager.<Ref<Response>>getInstance(ResponseTYPE).set(response);
    });
    appHandler.handle(requestContext);
  } catch (final Exception ex) {
    throw new RuntimeException(ex);
  } finally {
    if (!responseWriter.isSuspended()) {
      close(response);
    }
  }
}

相关文章