当前位置: 首页>>代码示例>>Java>>正文


Java Request.getStringData方法代码示例

本文整理汇总了Java中org.asynchttpclient.Request.getStringData方法的典型用法代码示例。如果您正苦于以下问题:Java Request.getStringData方法的具体用法?Java Request.getStringData怎么用?Java Request.getStringData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.asynchttpclient.Request的用法示例。


在下文中一共展示了Request.getStringData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recordNonMultipartData

import org.asynchttpclient.Request; //导入方法依赖的package包/类
/**
 * <pre>
 * Body could be String, byte array, Stream or EntityWriter.
 * We collect String data only.
 * </pre>
 *
 * @param httpRequest
 * @param recorder
 */
protected void recordNonMultipartData(final Request httpRequest, final SpanEventRecorder recorder) {
    final String stringData = httpRequest.getStringData();
    if (stringData != null) {
        recorder.recordAttribute(AnnotationKey.HTTP_PARAM_ENTITY, StringUtils.abbreviate(stringData, config.getEntityDumpSize()));
        return;
    }

    final byte[] byteData = httpRequest.getByteData();
    if (byteData != null) {
        recorder.recordAttribute(AnnotationKey.HTTP_PARAM_ENTITY, "BYTE_DATA");
        return;
    }

    final InputStream streamData = httpRequest.getStreamData();
    if (streamData != null) {
        recorder.recordAttribute(AnnotationKey.HTTP_PARAM_ENTITY, "STREAM_DATA");
        return;
    }
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:29,代码来源:ExecuteInterceptor.java

示例2: submit

import org.asynchttpclient.Request; //导入方法依赖的package包/类
private <T> ListenableFuture<T> submit(Request request, ZendeskAsyncCompletionHandler<T> handler) {
    if (logger.isDebugEnabled()) {
        if (request.getStringData() != null) {
            logger.debug("Request {} {}\n{}", request.getMethod(), request.getUrl(), request.getStringData());
        } else if (request.getByteData() != null) {
            logger.debug("Request {} {} {} {} bytes", request.getMethod(), request.getUrl(),
                    request.getHeaders().get("Content-type"), request.getByteData().length);
        } else {
            logger.debug("Request {} {}", request.getMethod(), request.getUrl());
        }
    }
    return client.executeRequest(request, handler);
}
 
开发者ID:cloudbees,项目名称:zendesk-java-client,代码行数:14,代码来源:Zendesk.java

示例3: body

import org.asynchttpclient.Request; //导入方法依赖的package包/类
private NettyBody body(Request request, boolean connect) {
    NettyBody nettyBody = null;
    if (!connect) {

        Charset bodyCharset = withDefault(request.getCharset(), DEFAULT_CHARSET);

        if (request.getByteData() != null)
            nettyBody = new NettyByteArrayBody(request.getByteData());

        else if (request.getCompositeByteData() != null)
            nettyBody = new NettyCompositeByteArrayBody(request.getCompositeByteData());

        else if (request.getStringData() != null)
            nettyBody = new NettyByteBufferBody(StringUtils.charSequence2ByteBuffer(request.getStringData(), bodyCharset));

        else if (request.getByteBufferData() != null)
            nettyBody = new NettyByteBufferBody(request.getByteBufferData());

        else if (request.getStreamData() != null)
            nettyBody = new NettyInputStreamBody(request.getStreamData());

        else if (isNonEmpty(request.getFormParams())) {

            String contentType = null;
            if (!request.getHeaders().contains(CONTENT_TYPE))
                contentType = HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED;

            nettyBody = new NettyByteBufferBody(urlEncodeFormParams(request.getFormParams(), bodyCharset), contentType);

        } else if (isNonEmpty(request.getBodyParts()))
            nettyBody = new NettyMultipartBody(request.getBodyParts(), request.getHeaders(), config);

        else if (request.getFile() != null)
            nettyBody = new NettyFileBody(request.getFile(), config);

        else if (request.getBodyGenerator() instanceof FileBodyGenerator) {
            FileBodyGenerator fileBodyGenerator = (FileBodyGenerator) request.getBodyGenerator();
            nettyBody = new NettyFileBody(fileBodyGenerator.getFile(), fileBodyGenerator.getRegionSeek(), fileBodyGenerator.getRegionLength(), config);

        } else if (request.getBodyGenerator() instanceof InputStreamBodyGenerator)
            nettyBody = new NettyInputStreamBody(InputStreamBodyGenerator.class.cast(request.getBodyGenerator()).getInputStream());
        else if (request.getBodyGenerator() instanceof ReactiveStreamsBodyGenerator)
            nettyBody = new NettyReactiveStreamsBody(ReactiveStreamsBodyGenerator.class.cast(request.getBodyGenerator()).getPublisher());
        else if (request.getBodyGenerator() != null)
            nettyBody = new NettyBodyBody(request.getBodyGenerator().createBody(), config);
    }

    return nettyBody;
}
 
开发者ID:amaralDaniel,项目名称:megaphone,代码行数:50,代码来源:NettyRequestFactory.java


注:本文中的org.asynchttpclient.Request.getStringData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。