當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpString.equals方法代碼示例

本文整理匯總了Java中io.undertow.util.HttpString.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpString.equals方法的具體用法?Java HttpString.equals怎麽用?Java HttpString.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.undertow.util.HttpString的用法示例。


在下文中一共展示了HttpString.equals方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleExplicitTransferEncoding

import io.undertow.util.HttpString; //導入方法依賴的package包/類
private static StreamSinkConduit handleExplicitTransferEncoding(HttpServerExchange exchange, StreamSinkConduit channel, ConduitListener<StreamSinkConduit> finishListener, HeaderMap responseHeaders, String transferEncodingHeader, boolean headRequest) {
    HttpString transferEncoding = new HttpString(transferEncodingHeader);
    if (transferEncoding.equals(Headers.CHUNKED)) {
        if (headRequest) {
            return channel;
        }
        Boolean preChunked = exchange.getAttachment(HttpAttachments.PRE_CHUNKED_RESPONSE);
        if(preChunked != null && preChunked) {
            return new PreChunkedStreamSinkConduit(channel, finishListener, exchange);
        } else {
            return new ChunkedStreamSinkConduit(channel, exchange.getConnection().getBufferPool(), true, !exchange.isPersistent(), responseHeaders, finishListener, exchange);
        }
    } else {

        if (headRequest) {
            return channel;
        }
        log.trace("Cancelling persistence because response is identity with no content length");
        // make it not persistent - very unfortunate for the next request handler really...
        exchange.setPersistent(false);
        responseHeaders.put(Headers.CONNECTION, Headers.CLOSE.toString());
        return new FinishableStreamSinkConduit(channel, terminateResponseListener(exchange));
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:HttpTransferEncoding.java

示例2: invokePathTemplateHandler

import io.undertow.util.HttpString; //導入方法依賴的package包/類
private void invokePathTemplateHandler(SpurOptions options, Map<HttpString, Endpoint> methodEndpointsMap, HttpServerExchange exchange) {

        HttpString requestMethod = exchange.getRequestMethod();
        String requestAccessControlRequestMethod = getRequestHeader(exchange, ACCESS_CONTROL_REQUEST_METHOD);
        String requestOrigin = getRequestHeader(exchange, Headers.ORIGIN);
        if (requestMethod.equals(HEAD)) {
            requestMethod = GET;
        } else if (requestMethod.equals(OPTIONS) && requestAccessControlRequestMethod != null && methodEndpointsMap.containsKey(
                new HttpString(requestAccessControlRequestMethod)) && isValidCorsOrigin(options, requestOrigin)) {
            setCorsMethodHeader(options, methodEndpointsMap, exchange);
            exchange.endExchange();
            return;
        }

        Endpoint endpoint = methodEndpointsMap.get(requestMethod);
        if (endpoint == null) {
            exchange.setStatusCode(StatusCodes.METHOD_NOT_ALLOWED);
            exchange.getResponseHeaders()
                    .put(Headers.ALLOW, getAllowedMethods(methodEndpointsMap, options));
            exchange.endExchange();
            return;
        }

        Req req = new Req(exchange, endpoint.getBodyClassType());
        req.parseBody((newExchange, body) -> endpoint.getReqResBiConsumer()
                .accept(req, new Res(newExchange)));
    }
 
開發者ID:icha024,項目名稱:spur,代碼行數:28,代碼來源:SpurServer.java

示例3: setHeader

import io.undertow.util.HttpString; //導入方法依賴的package包/類
public void setHeader(final HttpString name, final String value) {
    if(name == null) {
        throw UndertowServletMessages.MESSAGES.headerNameWasNull();
    }
    if (insideInclude || ignoredFlushPerformed) {
        return;
    }
    if(name.equals(Headers.CONTENT_TYPE)) {
        setContentType(value);
    } else {
        exchange.getResponseHeaders().put(name, value);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:HttpServletResponseImpl.java

示例4: addHeader

import io.undertow.util.HttpString; //導入方法依賴的package包/類
public void addHeader(final HttpString name, final String value) {
    if(name == null) {
        throw UndertowServletMessages.MESSAGES.headerNameWasNull();
    }
    if (insideInclude || ignoredFlushPerformed || treatAsCommitted) {
        return;
    }
    if(name.equals(Headers.CONTENT_TYPE) && !exchange.getResponseHeaders().contains(Headers.CONTENT_TYPE)) {
        setContentType(value);
    } else {
        exchange.getResponseHeaders().add(name, value);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:HttpServletResponseImpl.java


注:本文中的io.undertow.util.HttpString.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。