当前位置: 首页>>代码示例>>Java>>正文


Java Request.getHeaderNames方法代码示例

本文整理汇总了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;
}
 
开发者ID:davruet,项目名称:shenanigans.io,代码行数:8,代码来源:CertificateHandler.java

示例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);
	}
}
 
开发者ID:Vidada-Project,项目名称:vidada-desktop,代码行数:11,代码来源:SeekableHttpHandler.java

示例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");
    }
}
 
开发者ID:icode,项目名称:ameba-container-grizzly,代码行数:66,代码来源:GrizzlyHttpContainer.java


注:本文中的org.glassfish.grizzly.http.server.Request.getHeaderNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。