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


Java Consts.ASCII屬性代碼示例

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


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

示例1: handle

@Override
public void handle(
        final HttpRequest request,
        final HttpResponse response,
        final HttpContext context) throws HttpException, IOException {
    final String creds = (String) context.getAttribute("creds");
    if (creds == null || !creds.equals("test:test")) {
        response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
    } else {
        // Make client re-authenticate on each fourth request
        if (this.count.incrementAndGet() % 4 == 0) {
            response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
        } else {
            response.setStatusCode(HttpStatus.SC_OK);
            final StringEntity entity = new StringEntity("success", Consts.ASCII);
            response.setEntity(entity);
        }
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:19,代碼來源:TestClientReauthentication.java

示例2: testResponseParsingWithTooMuchGarbage

@Test(expected=ProtocolException.class)
public void testResponseParsingWithTooMuchGarbage() throws Exception {
    final String s =
        "garbage\r\n" +
        "garbage\r\n" +
        "more garbage\r\n" +
        "HTTP/1.1 200 OK\r\n" +
        "header1: value1\r\n" +
        "header2: value2\r\n" +
        "\r\n";

    final SessionInputBuffer inbuffer = new SessionInputBufferMock(s, Consts.ASCII);
    final HttpMessageParser<HttpResponse> parser = new DefaultHttpResponseParser(inbuffer) {

        @Override
        protected boolean reject(final CharArrayBuffer line, final int count) {
            return count >= 2;
        }

    };
    parser.parse();
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:22,代碼來源:TestDefaultHttpResponseParser.java

示例3: setMalformedInputAction

public Builder setMalformedInputAction(final CodingErrorAction malformedInputAction) {
    this.malformedInputAction = malformedInputAction;
    if (malformedInputAction != null && this.charset == null) {
        this.charset = Consts.ASCII;
    }
    return this;
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:7,代碼來源:ConnectionConfig.java

示例4: build

public ConnectionConfig build() {
    Charset cs = charset;
    if (cs == null && (malformedInputAction != null || unmappableInputAction != null)) {
        cs = Consts.ASCII;
    }
    final int bufSize = this.bufferSize > 0 ? this.bufferSize : 8 * 1024;
    final int fragmentHintSize  = this.fragmentSizeHint >= 0 ? this.fragmentSizeHint : bufSize;
    return new ConnectionConfig(
            bufSize,
            fragmentHintSize,
            cs,
            malformedInputAction,
            unmappableInputAction,
            messageConstraints);
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:15,代碼來源:ConnectionConfig.java

示例5: handle

@Override
public void handle(
        final HttpRequest request,
        final HttpResponse response,
        final HttpContext context) throws HttpException, IOException {
    final String creds = (String) context.getAttribute("creds");
    if (creds == null || !creds.equals("test:test")) {
        response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
    } else {
        response.setStatusCode(HttpStatus.SC_OK);
        final StringEntity entity = new StringEntity("success", Consts.ASCII);
        response.setEntity(entity);
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:14,代碼來源:TestClientAuthenticationFallBack.java

示例6: testResponseParsingOnlyGarbage

@Test(expected=ProtocolException.class)
public void testResponseParsingOnlyGarbage() throws Exception {
    final String s =
        "garbage\r\n" +
        "garbage\r\n" +
        "more garbage\r\n" +
        "a lot more garbage\r\n";
    final SessionInputBuffer inbuffer = new SessionInputBufferMock(s, Consts.ASCII);
    final HttpMessageParser<HttpResponse> parser = new DefaultHttpResponseParser(inbuffer);
    parser.parse();
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:11,代碼來源:TestDefaultHttpResponseParser.java

示例7: handle

@Override
public void handle(
        final HttpRequest request,
        final HttpResponse response,
        final HttpContext context) throws HttpException, IOException {
    final String creds = (String) context.getAttribute("creds");
    if (creds == null || !creds.equals("test:test")) {
        response.setStatusCode(HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
    } else {
        response.setStatusCode(HttpStatus.SC_OK);
        final StringEntity entity = new StringEntity("success", Consts.ASCII);
        response.setEntity(entity);
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:14,代碼來源:TestClientAuthentication.java

示例8: BasicSchemeHC4

public BasicSchemeHC4() {
    this(Consts.ASCII);
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:3,代碼來源:BasicSchemeHC4.java

示例9: DigestSchemeHC4

public DigestSchemeHC4() {
    this(Consts.ASCII);
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:3,代碼來源:DigestSchemeHC4.java

示例10: RFC2617SchemeHC4

/**
 * @since 4.3
 */
public RFC2617SchemeHC4(final Charset credentialsCharset) {
    super();
    this.params = new HashMap<String, String>();
    this.credentialsCharset = credentialsCharset != null ? credentialsCharset : Consts.ASCII;
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:8,代碼來源:RFC2617SchemeHC4.java

示例11: RFC2617Scheme

/**
 * @since 4.3
 */
public RFC2617Scheme(final Charset credentialsCharset) {
    super();
    this.params = new HashMap<String, String>();
    this.credentialsCharset = credentialsCharset != null ? credentialsCharset : Consts.ASCII;
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:8,代碼來源:RFC2617Scheme.java

示例12: getCredentialsCharset

/**
 * @since 4.3
 */
public Charset getCredentialsCharset() {
    return credentialsCharset != null ? credentialsCharset : Consts.ASCII;
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:6,代碼來源:RFC2617Scheme.java

示例13: testResponseParsingNoResponse

@Test(expected=NoHttpResponseException.class)
public void testResponseParsingNoResponse() throws Exception {
    final SessionInputBuffer inbuffer = new SessionInputBufferMock("", Consts.ASCII);
    final HttpMessageParser<HttpResponse> parser = new DefaultHttpResponseParser(inbuffer);
    parser.parse();
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:6,代碼來源:TestDefaultHttpResponseParser.java

示例14: DigestScheme

public DigestScheme() {
    this(Consts.ASCII);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:3,代碼來源:DigestScheme.java

示例15: BasicScheme

public BasicScheme() {
    this(Consts.ASCII);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:3,代碼來源:BasicScheme.java


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