本文整理匯總了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));
}
}
示例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)));
}
示例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);
}
}
示例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);
}
}