• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CacheAndWriteOutputStream类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.cxf.io.CacheAndWriteOutputStream的典型用法代码示例。如果您正苦于以下问题:Java CacheAndWriteOutputStream类的具体用法?Java CacheAndWriteOutputStream怎么用?Java CacheAndWriteOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

CacheAndWriteOutputStream类属于org.apache.cxf.io包,在下文中一共展示了CacheAndWriteOutputStream类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleMessage

点赞 3

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
    final OutputStream os = message.getContent(OutputStream.class);
    if (os == null)
    {
        return;
    }
    Logger logger = getMessageLogger(message);

    if (logger.isLoggable(Level.INFO) || writer != null)
    {
        // Write the output while caching it for the log message
        boolean hasLogged = message.containsKey(LOG_SETUP);
        if (!hasLogged)
        {
            message.put(LOG_SETUP, Boolean.TRUE);
            final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(
                    os);
            message.setContent(OutputStream.class, newOut);
            newOut.registerCallback(new LoggingCallback(logger, message, os));
        }
    }
}
 

开发者ID:Huawei,
项目名称:eSDK_EC_SDK_Java,
代码行数:25,
代码来源:UCLoggingOutInterceptor.java

示例2: handleMessage

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
    String messageId = (String) message.getExchange().get(
            LoggingMessage.ID_KEY);
    LogBean bean = new LogBean();
    bean.setResponseTime(new Date());

    OutputStream stream = message.getContent(OutputStream.class);
    final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(
            stream);
    message.setContent(OutputStream.class, newOut);
    newOut.registerCallback(new LoggingCallback(messageId, bean));

}
 

开发者ID:Huawei,
项目名称:eSDK_EC_SDK_Java,
代码行数:16,
代码来源:UCOutLogInterceptor.java

示例3: setupWrappedStream

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
protected void setupWrappedStream() throws IOException {
    // If we need to cache for retransmission, store data in a
    // CacheAndWriteOutputStream. Otherwise write directly to the output stream.
    OutputStream cout = null;
    try {
        try {
            cout = connection.getOutputStream();
        } catch (ProtocolException pe) {
            Boolean b =  (Boolean)outMessage.get(HTTPURL_CONNECTION_METHOD_REFLECTION);
            cout = connectAndGetOutputStream(b); 
        }
    } catch (SocketException e) {
        if ("Socket Closed".equals(e.getMessage())) {
            connection.connect();
            cout = connectAndGetOutputStream((Boolean)outMessage.get(HTTPURL_CONNECTION_METHOD_REFLECTION)); 
        } else {
            throw e;
        }
    }
    if (cachingForRetransmission) {
        cachedStream =
            new CacheAndWriteOutputStream(cout);
        wrappedStream = cachedStream;
    } else {
        wrappedStream = cout;
    }
}
 

开发者ID:Huawei,
项目名称:eSDK_EC_SDK_Java,
代码行数:28,
代码来源:URLConnectionHTTPConduit.java

示例4: handleMessage

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
    String messageId = (String) message.getExchange().get(
            LoggingMessage.ID_KEY);
    LogBean bean = new LogBean();
    bean.setResponseTime(new Date());

    OutputStream stream = message.getContent(OutputStream.class);
    final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(
            stream);
    message.setContent(OutputStream.class, newOut);
    newOut.registerCallback(new LoggingCallback(messageId,bean));

}
 

开发者ID:Huawei,
项目名称:eSDK_IVS_Java,
代码行数:16,
代码来源:IVSOutLogInterceptor.java

示例5: onCloseInternal

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
protected void onCloseInternal(CacheAndWriteOutputStream cachedStream) throws Exception {
    try {
        this.feature.processEvent(this.exchange, this.msg, this.event, this.msgType, cachedStream.getBytes());
    } finally {
        OutputStream outStream = cachedStream.getFlowThroughStream();

        cachedStream.lockOutputStream();
        cachedStream.resetOut(null, false);

        this.msg.setContent(OutputStream.class, outStream);
    }
}
 

开发者ID:esacinc,
项目名称:sdcct,
代码行数:13,
代码来源:AbstractLoggingOutCallback.java

示例6: handleMessageInternal

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
@Override
protected void handleMessageInternal(Exchange exchange, Message msg, T event) throws Exception {
    CacheAndWriteOutputStream cachedStream = new CacheAndWriteOutputStream(msg.getContent(OutputStream.class));
    cachedStream.registerCallback(this.buildCallback(exchange, msg, event, msgType));

    msg.setContent(OutputStream.class, cachedStream);
}
 

开发者ID:esacinc,
项目名称:sdcct,
代码行数:8,
代码来源:AbstractLoggingOutInterceptor.java

示例7: onCloseInternal

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
@Override
protected void onCloseInternal(CacheAndWriteOutputStream cachedStream) throws Exception {
    super.onCloseInternal(cachedStream);

    HttpRequestEvent httpEvent = SdcctRestEventUtils.createHttpRequestEvent(msg, SdcctPropertyNames.HTTP_CLIENT_TX_ID, RestEndpointType.CLIENT);

    this.feature.logEvent(httpEvent);
}
 

开发者ID:esacinc,
项目名称:sdcct,
代码行数:9,
代码来源:ClientLoggingOutCallback.java

示例8: handleMessageInternal

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
@Override
protected void handleMessageInternal(SoapMessage message) throws Exception {
    CacheAndWriteOutputStream cachedStream = new CacheAndWriteOutputStream(message.getContent(OutputStream.class));
    cachedStream.close();

    cachedStream.registerCallback(this.buildCallback(message));
    message.setContent(OutputStream.class, cachedStream);
}
 

开发者ID:esacinc,
项目名称:sdcct,
代码行数:9,
代码来源:AbstractServerIheTestcaseOutInterceptor.java

示例9: handleMessage

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
public void handleMessage(Message message) throws Fault {
    final OutputStream os = message.getContent(OutputStream.class);
    if (os == null) { return; }

    if (getLogger().isLoggable(Level.INFO) || (writer != null)) {
        // Write the output while caching it for the log message
        final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(os);
        message.setContent(OutputStream.class, newOut);
        newOut.registerCallback(new LoggingCallback(message, os));
    }
}
 

开发者ID:blackducksoftware,
项目名称:blackduck-cxf-utilities,
代码行数:12,
代码来源:AbstractPayloadFilteredLoggingOutInterceptor.java

示例10: logMessage

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
private void logMessage(Message message) {
   	final OutputStream os = message.getContent(OutputStream.class);
       final Writer iowriter = message.getContent(Writer.class);
       if (os == null && iowriter == null) {
           return;
       }
       Logger logger = LOG;
       if (logger.isLoggable(Level.INFO) || writer != null) {
           // Write the output while caching it for the log message
           boolean hasLogged = message.containsKey(LOG_SETUP);
           if (!hasLogged) {
               message.put(LOG_SETUP, Boolean.TRUE);
               if (os != null) {
                   final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(os);
                   if (threshold > 0) {
                       newOut.setThreshold(threshold);
                   }
                   if (limit > 0) {
                       newOut.setCacheLimit(limit);
                   }
                   message.setContent(OutputStream.class, newOut);
                   newOut.registerCallback(new LoggingCallback(logger, message, os));
               } else {
                   message.setContent(Writer.class, new LogWriter(logger, message, iowriter));
               }
           }
       }
}
 

开发者ID:GeeQuery,
项目名称:cxf-plus,
代码行数:29,
代码来源:LoggingOutInterceptor.java

示例11: onCloseInternal

点赞 2

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
protected void onCloseInternal(CacheAndWriteOutputStream cachedStream) throws Exception {
    try {
        Message inMsg = this.msg.getExchange().getInMessage();
        Object resultPropValue = inMsg.getContextualProperty(this.resultPropName);

        if (resultPropValue != null) {
            V result = SdcctTestcaseUtils.addWsResponseEvent(inMsg, this.resultPropName, this.resultClass, this.msg);
            U submission = result.getSubmission();
            T testcase = submission.getTestcase();

            Fault fault = ((Fault) this.msg.getContent(Exception.class));
            result.setFault(fault);

            if (result.hasFault()) {
                if ((testcase != null) && testcase.isNegative()) {
                    result.getMessages(SdcctIssueSeverity.INFORMATION)
                        .add(String.format(
                            "Please check that the web service response event payload contains a SOAP fault (message=%s) that corresponds to the associated testcase (id=%s) description.",
                            fault.getMessage(), testcase.getId()));
                } else {
                    result.getMessages(SdcctIssueSeverity.INFORMATION)
                        .add(String.format(
                            "Please check that the web service response event payload (msg=%s) corresponds to what is expected in the associated testcase (id=%s) description.",
                            fault.getMessage(), ((testcase != null) ? testcase.getId() : "None")));
                }
            }

            TomcatRequest servletReq =
                SdcctTomcatUtils.unwrapRequest(SdcctWsPropertyUtils.getProperty(inMsg, AbstractHTTPDestination.HTTP_REQUEST, HttpServletRequest.class));
            TomcatResponse servletResp = SdcctTomcatUtils
                .unwrapResponse(SdcctWsPropertyUtils.getProperty(this.msg, AbstractHTTPDestination.HTTP_RESPONSE, HttpServletResponse.class));

            result.setHttpResponseEvent(SdcctHttpEventUtils.createHttpResponseEvent(servletReq, servletResp));

            // noinspection ConstantConditions
            if (!result.hasMessages(SdcctIssueSeverity.FATAL) && !result.hasMessages(SdcctIssueSeverity.ERROR) && submission.hasTestcase() &&
                (!testcase.isNegative() && (fault == null))) {
                result.setSuccess(true);
            }

            this.resultHandler.addResult(result);
        }
    } finally {
        OutputStream outStream = cachedStream.getFlowThroughStream();

        cachedStream.lockOutputStream();
        cachedStream.resetOut(null, false);

        this.msg.setContent(OutputStream.class, outStream);
    }
}
 

开发者ID:esacinc,
项目名称:sdcct,
代码行数:52,
代码来源:AbstractServerIheTestcaseOutCallback.java

示例12: onCloseInternal

点赞 1

import org.apache.cxf.io.CacheAndWriteOutputStream; //导入依赖的package包/类
protected abstract void onCloseInternal(CacheAndWriteOutputStream cachedStream) throws Exception; 

开发者ID:esacinc,
项目名称:sdcct,
代码行数:2,
代码来源:AbstractIheTestcaseOutCallback.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)