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


Java HttpString.tryFromString方法代碼示例

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


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

示例1: MethodPredicate

import io.undertow.util.HttpString; //導入方法依賴的package包/類
MethodPredicate(String[] methods) {
    HttpString[] values = new HttpString[methods.length];
    for(int i = 0; i < methods.length; ++i) {
        values[i] = HttpString.tryFromString(methods[i]);
    }
    this.methods = values;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:8,代碼來源:MethodPredicate.java

示例2: build

import io.undertow.util.HttpString; //導入方法依賴的package包/類
@Override
public ExchangeAttribute build(final String token) {
    if (token.startsWith("%{o,") && token.endsWith("}")) {
        final HttpString headerName = HttpString.tryFromString(token.substring(4, token.length() - 1));
        return new ResponseHeaderAttribute(headerName);
    }
    return null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:ResponseHeaderAttribute.java

示例3: build

import io.undertow.util.HttpString; //導入方法依賴的package包/類
@Override
public ExchangeAttribute build(final String token) {
    if (token.startsWith("%{i,") && token.endsWith("}")) {
        final HttpString headerName = HttpString.tryFromString(token.substring(4, token.length() - 1));
        return new RequestHeaderAttribute(headerName);
    }
    return null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:RequestHeaderAttribute.java

示例4: handle

import io.undertow.util.HttpString; //導入方法依賴的package包/類
public int handle(ByteBuffer buf) throws IOException {
    while (buf.hasRemaining()) {
        final byte b = buf.get();
        if (state == STATE_TRAILER_NAME) {
            if (b == '\r') {
                if (builder.length() == 0) {
                    state = STATE_ENDING;
                } else {
                    throw UndertowMessages.MESSAGES.couldNotDecodeTrailers();
                }
            } else if (b == '\n') {
                if (builder.length() == 0) {
                    attachable.putAttachment(trailerAttachmentKey, headerMap);
                    return -1;
                } else {
                    throw UndertowMessages.MESSAGES.couldNotDecodeTrailers();
                }
            } else if (b == ':') {
                httpString = HttpString.tryFromString(builder.toString().trim());
                state = STATE_TRAILER_VALUE;
                builder.setLength(0);
            } else {
                builder.append((char) b);
            }
        } else if (state == STATE_TRAILER_VALUE) {
            if (b == '\n') {
                headerMap.put(httpString, builder.toString().trim());
                httpString = null;
                builder.setLength(0);
                state = STATE_TRAILER_NAME;
            } else if (b != '\r') {
                builder.append((char) b);
            }
        } else if (state == STATE_ENDING) {
            if (b == '\n') {
                if (attachable != null) {
                    attachable.putAttachment(trailerAttachmentKey, headerMap);
                }
                return -1;
            } else {
                throw UndertowMessages.MESSAGES.couldNotDecodeTrailers();
            }
        } else {
            throw new IllegalStateException();
        }
    }
    return 0;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:49,代碼來源:ChunkReader.java


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