本文整理汇总了Java中org.glassfish.grizzly.http.server.Request.getHeaderNames方法的典型用法代码示例。如果您正苦于以下问题:Java Request.getHeaderNames方法的具体用法?Java Request.getHeaderNames怎么用?Java Request.getHeaderNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.glassfish.grizzly.http.server.Request
的用法示例。
在下文中一共展示了Request.getHeaderNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllHeaders
import org.glassfish.grizzly.http.server.Request; //导入方法依赖的package包/类
protected HashMap<String, String> getAllHeaders(Request req) {
HashMap<String, String> headers = new HashMap<String, String>();
for (String s : req.getHeaderNames()){
headers.put(s, req.getHeader(s));
}
return headers;
}
示例2: printRequestHeader
import org.glassfish.grizzly.http.server.Request; //导入方法依赖的package包/类
private void printRequestHeader(Request request){
logger.debug("Request Header:");
for (String header : request.getHeaderNames()){
String headerPart = "> ";
for (String headerValue : request.getHeaders(header)) {
headerPart += headerValue + " ; ";
};
logger.debug(headerPart);
}
}
示例3: service
import org.glassfish.grizzly.http.server.Request; //导入方法依赖的package包/类
@Override
@Suspendable
public void service(final Request request, final Response response) throws CharConversionException {
final ResponseWriter responseWriter = new ResponseWriter(response, configSetStatusOverSendError);
try {
logger.debugLog("GrizzlyHttpContainer.service(...) started");
final URI baseUri = getBaseUri(request);
final URI requestUri = getRequestUri(request);
final ContainerRequest requestContext = new ameba.container.server.Request(baseUri,
requestUri, request.getMethod().getMethodString(),
getSecurityContext(request), new GrizzlyRequestPropertiesDelegate(request)) {
@Override
public String getRemoteAddr() {
return request.getRemoteAddr();
}
@Override
public String getRemoteHost() {
return request.getRemoteHost();
}
@Override
public int getRemotePort() {
return request.getRemotePort();
}
@Override
public String getLocalAddr() {
return request.getLocalAddr();
}
@Override
public String getLocalName() {
return request.getLocalName();
}
@Override
public int getLocalPort() {
return request.getLocalPort();
}
@Override
public URI getRawReqeustUri() {
return UriBuilder.fromUri(requestUri).build();
}
};
requestContext.setEntityStream(request.getInputStream());
for (final String headerName : request.getHeaderNames()) {
requestContext.headers(headerName, request.getHeaders(headerName));
}
requestContext.setWriter(responseWriter);
response.suspend();
HttpFiber.start(() -> {
requestContext.setRequestScopedInitializer(injectionManager -> {
injectionManager.<Ref<Request>>getInstance(RequestType).set(request);
injectionManager.<Ref<Response>>getInstance(ResponseType).set(response);
});
appHandler.handle(requestContext);
});
} finally {
logger.debugLog("GrizzlyHttpContainer.service(...) finished");
}
}