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


Java WriterInterceptorContext.getProperty方法代码示例

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


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

示例1: aroundWriteTo

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void aroundWriteTo(final WriterInterceptorContext writerInterceptorContext)
        throws IOException, WebApplicationException {
    final LoggingStream stream = (LoggingStream) writerInterceptorContext.getProperty(ENTITY_LOGGER_PROPERTY);
    writerInterceptorContext.proceed();

    final Object requestId = Requests.getProperty(LOGGING_ID_PROPERTY);
    final long id = requestId != null ? (Long) requestId : _id.incrementAndGet();
    StringBuilder b = (StringBuilder) writerInterceptorContext.getProperty(LOGGER_BUFFER_PROPERTY);
    if (b == null) {
        b = new StringBuilder();
        writerInterceptorContext.setProperty(LOGGER_BUFFER_PROPERTY, b);
    }
    printPrefixedHeaders(b, id, RESPONSE_PREFIX, HeaderUtils.asStringHeaders(writerInterceptorContext.getHeaders()));

    if (stream != null) {
        log(stream.getStringBuilder(MessageUtils.getCharset(writerInterceptorContext.getMediaType())));
    } else {
        log(b);
    }
}
 
开发者ID:icode,项目名称:ameba,代码行数:25,代码来源:LoggingFilter.java

示例2: aroundWriteTo

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
@Override
public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
    final LoggingStream stream = (LoggingStream) context.getProperty("client.LoggingStream");
    context.proceed();
    if (stream != null) {
        System.out.printf("Body: %s\n", stream.getString(StandardCharsets.UTF_8));
    }
    System.out.printf("-----------\n");
}
 
开发者ID:obsidian-toaster-quickstarts,项目名称:redhat-sso,代码行数:10,代码来源:LoggingFilter.java

示例3: logRequestBody

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
private void logRequestBody(WriterInterceptorContext context) {
  LoggingOutputStream loggingOutputStream = (LoggingOutputStream) context.getProperty(LOGGING_OUTPUT_STREAM_PROPERTY);
  if (loggingOutputStream != null) {
    Charset charset = MessageUtils.getCharset(context.getMediaType());
    byte[] bytes = loggingOutputStream.getBytes();
    logger.trace("Message body: " + new String(bytes, charset));
  }
}
 
开发者ID:SK-EID,项目名称:smart-id-java-client,代码行数:9,代码来源:LoggingFilter.java

示例4: aroundWriteTo

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
@Override
public void aroundWriteTo(final WriterInterceptorContext writerInterceptorContext)
        throws IOException, WebApplicationException {
    final LoggingStream stream = (LoggingStream) writerInterceptorContext.getProperty(ENTITY_LOGGER_PROPERTY);
    writerInterceptorContext.proceed();
    if (stream != null) {
        JaxRsExchangeMessage msg = stream.getMsg();
        msg.setPayload(stream.getStringBuilder(MessageUtils.getCharset(writerInterceptorContext.getMediaType())).toString());
        stream.collect();
    }
}
 
开发者ID:kantega,项目名称:respiro,代码行数:12,代码来源:CollectingFilter.java

示例5: aroundWriteTo

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
@Override
public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
    try {
        context.proceed();
    } catch (Throwable e) {
        String path = (String) context.getProperty("metrics.path");
        String name = name("REST", "WRITE", e.getClass().getSimpleName(), path);
        JerseyMetricsPlugin.getMetricRegistry().meter(name).mark();

        throw e;
    }
}
 
开发者ID:kantega,项目名称:respiro,代码行数:13,代码来源:AroundWriteMeter.java

示例6: aroundWriteTo

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
@Override
public void aroundWriteTo(final WriterInterceptorContext writerInterceptorContext) throws IOException, WebApplicationException {
  final LoggingStream stream = (LoggingStream) writerInterceptorContext.getProperty(ENTITY_LOGGER_PROPERTY);
  writerInterceptorContext.proceed();
  if (stream != null) {
    if (log.isDebugEnabled())
      log.debug(stream.getStringBuilder(MessageUtils.getCharset(writerInterceptorContext.getMediaType())).toString());
  }
}
 
开发者ID:effektif,项目名称:effektif,代码行数:10,代码来源:RequestLogger.java

示例7: aroundWriteTo

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
@Override
public void aroundWriteTo(final WriterInterceptorContext writerInterceptorContext) throws IOException,
        WebApplicationException {
    final LoggingStream stream = (LoggingStream) writerInterceptorContext.getProperty(ENTITY_LOGGER_PROPERTY);
    writerInterceptorContext.proceed();
    if (stream != null) {
        log(stream.getStringBuilder());
    }
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:10,代码来源:LoggingFilter.java

示例8: aroundWriteTo

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
@Override
public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
    context.proceed();
    if (BooleanUtils.isTrue((Boolean) context.getProperty(LOGGING_ENABLED_PROPERTY))) {
        Long requestTime = (Long) context.getProperty(REQUEST_TIME);
        RestRequestDetails restRequest = (RestRequestDetails) context.getProperty(REQUEST_DETAILS);
        RestResponseDetails restResponse = (RestResponseDetails) context.getProperty(RESPONSE_DETAILS);
        String responseBody = ((LoggingStream) context.getProperty(LOGGINGSTREAM_PROPERTY)).getStringBuilder(
                MessageUtils.getCharset(context.getMediaType())).toString();
        Map<String, String> restParams = (Map<String, String>) context.getProperty(REST_PARAMS);
        extendRestParamsFromResponse(restParams, responseBody);
        sendStructuredEvent(restRequest, restResponse, restParams, requestTime, responseBody);
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:15,代码来源:StructuredEventFilter.java

示例9: aroundWriteTo

import javax.ws.rs.ext.WriterInterceptorContext; //导入方法依赖的package包/类
@Override
public void aroundWriteTo(WriterInterceptorContext context)
		throws IOException, WebApplicationException {

	Object o = context.getProperty(NdexService.NdexZipFlag);
	if ( o!=null && o == Boolean.TRUE) {
		context.getHeaders().putSingle("Content-Encoding", "gzip");
		context.getHeaders().putSingle("Vary", "Accept-Encoding");
	}
       context.proceed();

}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:13,代码来源:NdexPreZippedInterceptor.java


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