当前位置: 首页>>代码示例>>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;未经允许,请勿转载。