Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 31651 invoked from network); 30 Aug 2006 10:47:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Aug 2006 10:47:46 -0000 Received: (qmail 70531 invoked by uid 500); 30 Aug 2006 10:47:46 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 70444 invoked by uid 500); 30 Aug 2006 10:47:46 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 70430 invoked by uid 99); 30 Aug 2006 10:47:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Aug 2006 03:47:45 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Aug 2006 03:47:45 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id EBF5A1A981A; Wed, 30 Aug 2006 03:47:24 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r438454 - in /incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport: AbstractCachedOutputStream.java ChainInitiationObserver.java Date: Wed, 30 Aug 2006 10:47:24 -0000 To: cxf-commits@incubator.apache.org From: tli@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060830104724.EBF5A1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: tli Date: Wed Aug 30 03:47:23 2006 New Revision: 438454 URL: http://svn.apache.org/viewvc?rev=438454&view=rev Log: Fix bug by add Chain into message, fix bug of getInputStream() of AbstractCachedOutputStream Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractCachedOutputStream.java incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractCachedOutputStream.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractCachedOutputStream.java?rev=438454&r1=438453&r2=438454&view=diff ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractCachedOutputStream.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractCachedOutputStream.java Wed Aug 30 03:47:23 2006 @@ -32,25 +32,28 @@ import java.io.PipedInputStream; import java.io.PipedOutputStream; - public abstract class AbstractCachedOutputStream extends OutputStream { - protected OutputStream currentStream; + protected OutputStream currentStream; + private long threshold = 8 * 1024; + private int totalLength; + private boolean inmem; + private File tempFile; + private File outputDir; - public AbstractCachedOutputStream(PipedInputStream stream) throws IOException { - currentStream = new PipedOutputStream(stream); - inmem = true; + currentStream = new PipedOutputStream(stream); + inmem = true; } public AbstractCachedOutputStream() { - currentStream = new ByteArrayOutputStream(); - inmem = true; + currentStream = new ByteArrayOutputStream(); + inmem = true; } /** @@ -69,7 +72,7 @@ */ protected abstract void doClose() throws IOException; - public void close() throws IOException { + public void close() throws IOException { currentStream.close(); doClose(); } @@ -84,11 +87,12 @@ * AttachmentSerializer Or Copy the cached output stream to the "real" * output stream, i.e. onto the wire. * - * @param realOS the real output stream + * @param realOS + * the real output stream * @throws IOException */ public void resetOut(OutputStream out, boolean copyOldContent) throws IOException { - ByteArrayOutputStream bout = (ByteArrayOutputStream)currentStream; + ByteArrayOutputStream bout = (ByteArrayOutputStream) currentStream; if (copyOldContent && bout.size() > 0) { bout.writeTo(out); } @@ -108,11 +112,10 @@ public String toString() { return currentStream.toString(); - } - + } + protected abstract void onWrite() throws IOException; - - + public void write(byte[] b, int off, int len) throws IOException { onWrite(); this.totalLength += len; @@ -140,9 +143,8 @@ currentStream.write(b); } - private void createFileOutputStream() throws IOException { - byte[] bytes = ((ByteArrayOutputStream)currentStream).toByteArray(); + byte[] bytes = ((ByteArrayOutputStream) currentStream).toByteArray(); if (outputDir == null) { tempFile = File.createTempFile("att", "tmp"); } else { @@ -159,7 +161,13 @@ public InputStream getInputStream() throws IOException { if (inmem) { - return new ByteArrayInputStream(((ByteArrayOutputStream)currentStream).toByteArray()); + if (currentStream instanceof ByteArrayOutputStream) { + return new ByteArrayInputStream(((ByteArrayOutputStream)currentStream).toByteArray()); + } else if (currentStream instanceof PipedOutputStream) { + return new PipedInputStream((PipedOutputStream)currentStream); + } else { + return null; + } } else { try { return new FileInputStream(tempFile); Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?rev=438454&r1=438453&r2=438454&view=diff ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java Wed Aug 30 03:47:23 2006 @@ -54,11 +54,13 @@ // setup chain PhaseInterceptorChain chain = new PhaseInterceptorChain(bus.getExtension(PhaseManager.class) .getInPhases()); + + message.setInterceptorChain(chain); chain.add(bus.getInInterceptors()); chain.add(endpoint.getInInterceptors()); chain.add(endpoint.getBinding().getInInterceptors()); chain.add(endpoint.getService().getInInterceptors()); - chain.setFaultInterceptor(endpoint.getFaultInterceptor()); + chain.setFaultInterceptor(endpoint.getFaultInterceptor()); chain.doIntercept(message); }