cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Bosschaert <david.bosscha...@gmail.com>
Subject Re: svn commit: r736332 - in /cxf/trunk/rt/core: pom.xml src/main/java/org/apache/cxf/interceptor/PrettyLoggingOutInterceptor.java
Date Thu, 22 Jan 2009 20:13:33 GMT
Well, JDom isn't a problem for Eclipse. Jaxen is the problem. Jaxen is
explicitly disapproved by the Eclipse legal guys.
When doing XPaths with JDom it uses Jaxen and that's where the problem
was before. Fortunately Benson fixed this up.
JDom on its own is not an issue for Eclipse.

Cheers,

David

2009/1/22 Daniel Kulp <dkulp@apache.org>:
> On Thursday 22 January 2009 4:54:53 am Sean O'Callaghan wrote:
>> Probably is, was taking the patch submitted by the user.
>> I didn't realize there was an issue with using jdom, what is it?
>
> David knows the details.   Something about one of the JDOM dependencies being
> problematic for Eclipse or something.    In anycase, if there is stuff in the
> JDK that will do it, let's use it.
>
> Note: we also have a PrettyPrintXMLStreamWriter in org.apache.cxf.wsdl.  Could
> possibly be made more generic and put in staxutils someplace.
>
> Dan
>
>
>>
>> Seán.
>>
>> -----Original Message-----
>> From: Daniel Kulp [mailto:dkulp@apache.org]
>> Sent: 21 January 2009 18:55
>> To: dev@cxf.apache.org; seanoc@apache.org
>> Subject: Re: svn commit: r736332 - in /cxf/trunk/rt/core: pom.xml
>> src/main/java/org/apache/cxf/interceptor/PrettyLoggingOutInterceptor.java
>>
>>
>>
>> Is there a way to get this done without introducing the JDOM dependency?
>> Benson just spent a lot of work to remove the jdom dependency throughout
>> the code and this just adds it back in.
>>
>> Dan
>>
>> On Wednesday 21 January 2009 11:34:18 am seanoc@apache.org wrote:
>> > Author: seanoc
>> > Date: Wed Jan 21 08:34:17 2009
>> > New Revision: 736332
>> >
>> > URL: http://svn.apache.org/viewvc?rev=736332&view=rev
>> > Log:
>> > CXF-1327 Logging Interceptor with pretty formatting
>> >
>> > Added:
>> >
>> > cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/PrettyLoggingO
>> >ut Interceptor.java Modified:
>> >     cxf/trunk/rt/core/pom.xml
>> >
>> > Modified: cxf/trunk/rt/core/pom.xml
>> > URL:
>> > http://svn.apache.org/viewvc/cxf/trunk/rt/core/pom.xml?rev=736332&r1=7363
>> >31 &r2=736332&view=diff
>> > =========================================================================
>> >== === --- cxf/trunk/rt/core/pom.xml (original)
>> > +++ cxf/trunk/rt/core/pom.xml Wed Jan 21 08:34:17 2009
>> > @@ -77,6 +77,12 @@
>> >           <artifactId>FastInfoset</artifactId>
>> >           <version>1.2.2</version>
>> >          </dependency>
>> > +
>> > +       <dependency>
>> > +         <groupId>jdom</groupId>
>> > +         <artifactId>jdom</artifactId>
>> > +         <version>1.0</version>
>> > +        </dependency>
>> >
>> >      </dependencies>
>> >
>> >
>> > Added:
>> > cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/PrettyLoggingO
>> >ut Interceptor.java URL:
>> > http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/c
>> >xf /interceptor/PrettyLoggingOutInterceptor.java?rev=736332&view=auto
>> > =========================================================================
>> >== === ---
>> > cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/PrettyLoggingO
>> >ut Interceptor.java (added) +++
>> > cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/PrettyLoggingO
>> >ut Interceptor.java Wed Jan 21 08:34:17 2009 @@ -0,0 +1,88 @@
>> > +/**
>> > + * Licensed to the Apache Software Foundation (ASF) under one
>> > + * or more contributor license agreements. See the NOTICE file
>> > + * distributed with this work for additional information
>> > + * regarding copyright ownership. The ASF licenses this file
>> > + * to you under the Apache License, Version 2.0 (the
>> > + * "License"); you may not use this file except in compliance
>> > + * with the License. You may obtain a copy of the License at
>> > + *
>> > + * http://www.apache.org/licenses/LICENSE-2.0
>> > + *
>> > + * Unless required by applicable law or agreed to in writing,
>> > + * software distributed under the License is distributed on an
>> > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> > + * KIND, either express or implied. See the License for the
>> > + * specific language governing permissions and limitations
>> > + * under the License.
>> > + */
>> > +
>> > +package org.apache.cxf.interceptor;
>> > +
>> > +import java.io.OutputStream;
>> > +import java.io.StringWriter;
>> > +import java.util.logging.Level;
>> > +import java.util.logging.Logger;
>> > +
>> > +import org.apache.cxf.common.logging.LogUtils;
>> > +import org.apache.cxf.io.CacheAndWriteOutputStream;
>> > +import org.apache.cxf.io.CachedOutputStream;
>> > +import org.apache.cxf.io.CachedOutputStreamCallback;
>> > +import org.apache.cxf.message.Message;
>> > +import org.apache.cxf.phase.AbstractPhaseInterceptor;
>> > +import org.apache.cxf.phase.Phase;
>> > +import org.jdom.Document;
>> > +import org.jdom.input.SAXBuilder;
>> > +import org.jdom.output.Format;
>> > +import org.jdom.output.XMLOutputter;
>> > +
>> > +/**
>> > + *
>> > + */
>> > +public class PrettyLoggingOutInterceptor extends
>> > AbstractPhaseInterceptor { +
>> > +    private static final Logger LOG =
>> > LogUtils.getL7dLogger(PrettyLoggingOutInterceptor.class); +
>> > +    private SAXBuilder saxBuilder = new SAXBuilder();
>> > +    private XMLOutputter xmlOutputter = new XMLOutputter();
>> > +
>> > +    public PrettyLoggingOutInterceptor() {
>> > +        super(Phase.PRE_STREAM);
>> > +        addBefore(StaxOutInterceptor.class.getName());
>> > +    }
>> > +
>> > +    public void handleMessage(Message message) throws Fault {
>> > +        final OutputStream os = message.getContent(OutputStream.class);
>> > +        if (os == null) {
>> > +            return;
>> > +        }
>> > +        if (!LOG.isLoggable(Level.ALL)) {
>> > +            return;
>> > +        }
>> > +
>> > +//     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());
>> > +    }
>> > +
>> > +    class LoggingCallback implements CachedOutputStreamCallback {
>> > +
>> > +        public void onFlush(CachedOutputStream cos) {
>> > +
>> > +        }
>> > +
>> > +        public void onClose(CachedOutputStream cos) {
>> > +
>> > +            try {
>> > +                Document jdoCument =
>> > saxBuilder.build(cos.getInputStream()); +
>> > xmlOutputter.setFormat(Format.getPrettyFormat()); +
>> > StringWriter writer = new StringWriter();
>> > +                xmlOutputter.output(jdoCument, writer);
>> > +                LOG.info(writer.getBuffer().toString());
>> > +            } catch (Exception e) {
>> > +                LOG.severe("fatal parsing the SOAP message " +
>> > e.getMessage()); +            }
>> > +        }
>> > +    }
>> > +}
>> > \ No newline at end of file
>
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Mime
View raw message