cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <cschnei...@talend.com>
Subject AW: svn commit: r1086052 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ rt/transp
Date Mon, 28 Mar 2011 11:52:25 GMT
Hi Sergey,

of course I was not deleting it because it does not follow a best practice.  The reason was that there is no ClientOnlyHttpTransportFactory anymore.
So I found the catch clause and thought about if it was needed.  As Dan completely redesigned the wiring of extendsions I think the catch case  can not happen anymore.
The spring xml is meaningless after Dan´s changes. The HttpTransport is always initialized if the http jar is there. It works with the bus-extensions.txt. So spring should not be needed.

Christian


-----Ursprüngliche Nachricht-----
Von: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
Gesendet: Montag, 28. März 2011 13:38
An: dev@cxf.apache.org
Betreff: Re: svn commit: r1086052 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ rt/transp

Hi

On Mon, Mar 28, 2011 at 12:20 PM, Christian Schneider <cschneider@talend.com
> wrote:

> Hi Sergey,
>
> I remvoed the code as the jaxrs frontend should not know about the http
> transport. Especially it should not directly instantiate implementation
> classes.
>

So you just removed the code because it was not following the best practice
? Or were you seeing even more test failures? Besides, the JAX-RS client
runtime is all about HTTP. Though I might let JAX-RS proxies invoke via JMS
but lets not worry about the transport independence for now. It has a
dependency on HTTPUrlConnection which will go but I've no problems at the
moment with the dep on the ClientOnlyHttpTransportFactory.


> Of course we have to make sure the functionalitly is still there. Can you
> explain uinder what ciscumstances the catch block will be executed?
>
>
The Jetty transport provides a conduit initiator. Without the http-jetty
dependency the *client* code won't work, especially without Spring deps


> I thought that it should not be necessary with Dan´s wiring changes. So I
> think if the http transport jars are present then the HttptransportFactory
> should be initialized as soon as the bus is instantiated.
>
>
Well may be it will work with the Spring deps being on the classpath as I
can see the cxf-extension-http.xml initializing it.  I need to support the
case with no spring deps being on the classpath

Sergey


> Christian
>
>
> -----Ursprüngliche Nachricht-----
> Von: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Gesendet: Montag, 28. März 2011 12:55
> An: dev@cxf.apache.org
> Betreff: Re: svn commit: r1086052 - in /cxf/trunk:
> rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/
> rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/
> rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/
> rt/transp
>
> By the way, I can see you removed the code in the CXF JAXRS client code to
> do with handling exceptions to do with the missing ConduitInitiator and
> replaced them with a warning - I'd like to be restored please.
> Unfortunately
> it's not easy to test those catch blocks in the systests/jaxrs because we
> always have the http-jetty on the classpath. The reasons those catch blocks
> are there is that they let CXF JAX-RS client users to avoid adding an
> explicit http-jetty dependency. Awhile back, the user has also reported a
> similar issue in the ServiceMix/JBI case
>
> Thanks, Sergey
>
> On Mon, Mar 28, 2011 at 9:44 AM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
>
> > Hi Christian
> >
> > On Sun, Mar 27, 2011 at 11:00 PM, <cschneider@apache.org> wrote:
> >
> >> Author: cschneider
> >> Date: Sun Mar 27 22:00:23 2011
> >> New Revision: 1086052
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1086052&view=rev
> >> Log:
> >> CXF-3419 Created new HttpTransportFactory that replaces http client
> only,
> >> http jetty, http osgi and http servlet transport. Some broken jaxrs
> tests
> >> remain and the destinationRegistry is not yet correctly pulled in osgi
> >>
> >>
> > I'm getting nervous about your commits with messages saying "Some broken
> > jaxrs tests" and similar. I'm sorry but I don't think it is acceptable. I
> > don't want to see JAX-RS tests broken all the time. Please treat as the
> > critical failures.
> >
> > Which tests are broken ? Why can't you fix them before merging ? When
> will
> > you fix them ?
> >
> > thanks, Sergey
> >
> >
> >
> >
> >> Added:
> >>
> >>
>  cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyDestinationFactory.java
> >>      - copied, changed from r1085147,
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
> >>      - copied, changed from r1085147,
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpDestinationFactory.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestinationFactory.java
> >>    cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml
> >>      - copied, changed from r1085147,
> >>
> cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml
> >> Removed:
> >>
> >>
>  cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
> >>
> >>
>  cxf/trunk/rt/transports/http-osgi/src/main/java/org/apache/cxf/transport/http_osgi/OsgiServlet.java
> >>
> >>
>  cxf/trunk/rt/transports/http-osgi/src/main/java/org/apache/cxf/transport/http_osgi/SpringOsgiServlet.java
> >>
> >>
>  cxf/trunk/rt/transports/http-osgi/src/test/java/org/apache/cxf/transport/http_osgi/OsgiServletTest.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ClientOnlyHTTPTransportFactory.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFSpringServlet.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/AbstractCXFServletTest.java
> >> Modified:
> >>
> >>
>  cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
> >>
> >>
>  cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
> >>
> >>
>  cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
> >>
> >>
>  cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
> >>
> >>
>  cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/cxf/bus-extensions.txt
> >>
> >>
>  cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
> >>
> >>
>  cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactoryTest.java
> >>
> >>
>  cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/cxf/osgi/cxf-extension-osgi.xml
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistry.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt
> >>
> >>
>  cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml
> >>
> >>
>  cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
> >>
> >> Modified:
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -48,7 +48,6 @@ import javax.ws.rs.ext.MessageBodyReader
> >>  import javax.ws.rs.ext.MessageBodyWriter;
> >>
> >>  import org.apache.cxf.Bus;
> >> -import org.apache.cxf.BusException;
> >>  import org.apache.cxf.common.i18n.BundleUtils;
> >>  import org.apache.cxf.common.logging.LogUtils;
> >>  import org.apache.cxf.endpoint.ConduitSelector;
> >> @@ -70,9 +69,7 @@ import org.apache.cxf.phase.PhaseChainCa
> >>  import org.apache.cxf.phase.PhaseInterceptorChain;
> >>  import org.apache.cxf.phase.PhaseManager;
> >>  import org.apache.cxf.service.Service;
> >> -import org.apache.cxf.transport.ConduitInitiatorManager;
> >>  import org.apache.cxf.transport.MessageObserver;
> >> -import org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory;
> >>
> >>  /**
> >>  * Common proxy and http-centric client implementation
> >> @@ -540,20 +537,7 @@ public class AbstractClient implements C
> >>         try {
> >>             cfg.prepareConduitSelector(message);
> >>         } catch (Fault ex) {
> >> -            LOG.fine("Failure to prepare a message from conduit
> >> selector");
> >> -            if (ex.getCause() instanceof BusException) {
> >> -                String code = ((BusException)ex.getCause()).getCode();
> >> -                if ("NO_CONDUIT_INITIATOR".equals(code)) {
> >> -                    ConduitInitiatorManager cim =
> >> cfg.getBus().getExtension(ConduitInitiatorManager.class);
> >> -                    ClientOnlyHTTPTransportFactory factory = new
> >> ClientOnlyHTTPTransportFactory();
> >> -                    factory.setBus(cfg.getBus());
> >> -                    cim.registerConduitInitiator(
> >> -
> >>
>  cfg.getConduitSelector().getEndpoint().getEndpointInfo().getTransportId(),
> >> factory);
> >> -                    cfg.prepareConduitSelector(message);
> >> -                } else {
> >> -                    throw ex;
> >> -                }
> >> -            }
> >> +            LOG.warning("Failure to prepare a message from conduit
> >> selector");
> >>         }
> >>         message.getExchange().put(ConduitSelector.class,
> >> cfg.getConduitSelector());
> >>     }
> >>
> >> Modified:
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -24,7 +24,6 @@ import java.util.Map;
> >>  import java.util.logging.Logger;
> >>
> >>  import org.apache.cxf.Bus;
> >> -import org.apache.cxf.BusException;
> >>  import org.apache.cxf.common.logging.LogUtils;
> >>  import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList;
> >>  import org.apache.cxf.endpoint.ConduitSelector;
> >> @@ -36,9 +35,7 @@ import org.apache.cxf.message.ExchangeIm
> >>  import org.apache.cxf.message.Message;
> >>  import org.apache.cxf.message.MessageImpl;
> >>  import org.apache.cxf.transport.Conduit;
> >> -import org.apache.cxf.transport.ConduitInitiatorManager;
> >>  import org.apache.cxf.transport.MessageObserver;
> >> -import org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory;
> >>  import org.apache.cxf.transport.http.HTTPConduit;
> >>
> >>  /**
> >> @@ -83,19 +80,6 @@ public class ClientConfiguration impleme
> >>             getConduitSelector().prepare(message);
> >>         } catch (Fault ex) {
> >>             LOG.fine("Failure to prepare a message from conduit
> >> selector");
> >> -            if (ex.getCause() instanceof BusException) {
> >> -                String code = ((BusException)ex.getCause()).getCode();
> >> -                if ("NO_CONDUIT_INITIATOR".equals(code)) {
> >> -                    ConduitInitiatorManager cim =
> >> getBus().getExtension(ConduitInitiatorManager.class);
> >> -                    ClientOnlyHTTPTransportFactory factory = new
> >> ClientOnlyHTTPTransportFactory();
> >> -                    factory.setBus(getBus());
> >> -                    cim.registerConduitInitiator(
> >> -
> >>  getConduitSelector().getEndpoint().getEndpointInfo().getTransportId(),
> >> factory);
> >> -                    getConduitSelector().prepare(message);
> >> -                } else {
> >> -                    throw ex;
> >> -                }
> >> -            }
> >>         }
> >>     }
> >>
> >>
> >> Modified:
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -42,9 +42,9 @@ import org.apache.cxf.jaxrs.lifecycle.Si
> >>  import org.apache.cxf.jaxrs.utils.ResourceUtils;
> >>  import org.apache.cxf.message.Message;
> >>  import org.apache.cxf.message.MessageUtils;
> >> -import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
> >> +import org.apache.cxf.transport.servlet.CXFServlet;
> >>
> >> -public class CXFNonSpringJaxrsServlet extends CXFNonSpringServlet {
> >> +public class CXFNonSpringJaxrsServlet extends CXFServlet {
> >>
> >>     private static final Logger LOG =
> >> LogUtils.getL7dLogger(CXFNonSpringJaxrsServlet.class);
> >>
> >> @@ -62,10 +62,10 @@ public class CXFNonSpringJaxrsServlet ex
> >>
> >>     private static final String JAXRS_APPLICATION_PARAM =
> >> "javax.ws.rs.Application";
> >>
> >> +
> >>     @Override
> >> -    public void loadBus(ServletConfig servletConfig) throws
> >> ServletException {
> >> -        super.loadBus(servletConfig);
> >> -
> >> +    public void init(ServletConfig servletConfig) throws
> ServletException
> >> {
> >> +        super.init(servletConfig);
> >>         String applicationClass =
> >> servletConfig.getInitParameter(JAXRS_APPLICATION_PARAM);
> >>         if (applicationClass != null) {
> >>             createServerFromApplication(applicationClass,
> servletConfig);
> >> @@ -73,6 +73,7 @@ public class CXFNonSpringJaxrsServlet ex
> >>         }
> >>
> >>         JAXRSServerFactoryBean bean = new JAXRSServerFactoryBean();
> >> +        bean.setBus(getBus());
> >>
> >>         String address =
> >> servletConfig.getInitParameter(SERVICE_ADDRESS_PARAM);
> >>         if (address == null) {
> >>
> >> Copied:
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyDestinationFactory.java
> >> (from r1085147,
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java)
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyDestinationFactory.java?p2=cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyDestinationFactory.java&p1=cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java&r1=1085147&r2=1086052&rev=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyDestinationFactory.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -20,94 +20,21 @@ package org.apache.cxf.transport.http_je
> >>
> >>  import java.io.IOException;
> >>
> >> -import java.security.GeneralSecurityException;
> >> -
> >> -import javax.annotation.PostConstruct;
> >> -import javax.annotation.Resource;
> >> -import javax.imageio.IIOException;
> >> -
> >>  import org.apache.cxf.Bus;
> >>  import org.apache.cxf.common.injection.NoJSR250Annotations;
> >>  import org.apache.cxf.service.model.EndpointInfo;
> >> -import org.apache.cxf.transport.Destination;
> >> -import org.apache.cxf.transport.DestinationFactory;
> >>  import org.apache.cxf.transport.http.AbstractHTTPDestination;
> >> -import org.apache.cxf.transport.http.AbstractHTTPTransportFactory;
> >> -
> >> -@NoJSR250Annotations(unlessNull = { "bus" })
> >> -public class JettyHTTPTransportFactory extends
> >> AbstractHTTPTransportFactory
> >> -    implements DestinationFactory {
> >> +import org.apache.cxf.transport.http.DestinationRegistry;
> >> +import org.apache.cxf.transport.http.HttpDestinationFactory;
> >>
> >> -    public JettyHTTPTransportFactory() {
> >> -        super();
> >> -    }
> >> -    public JettyHTTPTransportFactory(Bus b) {
> >> -        super(b);
> >> -    }
> >> -
> >> -    @Resource
> >> -    public void setBus(Bus b) {
> >> -        super.setBus(b);
> >> -    }
> >> -
> >> -    @PostConstruct
> >> -    public final void finalizeConfig() {
> >> -        if (null == bus) {
> >> -            return;
> >> -        }
> >> -        // This call will register the server engine factory
> >> -        // with the Bus.
> >> -        getJettyHTTPServerEngineFactory();
> >> -    }
> >> -
> >> -    /**
> >> -     * This method returns the Jetty HTTP Server Engine Factory.
> >> -     */
> >> -    protected JettyHTTPServerEngineFactory
> >> getJettyHTTPServerEngineFactory() {
> >> -        // We have got to *always* get this off the bus, because it may
> >> have
> >> -        // been overridden by Spring Configuration initially.
> >> -        // Spring Configuration puts it on the correct bus.
> >> -        JettyHTTPServerEngineFactory serverEngineFactory =
> >> -
> >>  getBus().getExtension(JettyHTTPServerEngineFactory.class);
> >> -        // If it's not there, then create it and register it.
> >> -        // Spring may override it later, but we need it here for
> default
> >> -        // with no spring configuration.
> >> -        if (serverEngineFactory == null) {
> >> -            serverEngineFactory = new JettyHTTPServerEngineFactory();
> >> -            serverEngineFactory.setBus(getBus());
> >> -        }
> >> -        return serverEngineFactory;
> >> -    }
> >> -
> >> -    public synchronized Destination getDestination(EndpointInfo
> >> endpointInfo)
> >> -        throws IOException {
> >> -
> >> -        String addr = endpointInfo.getAddress();
> >> -        AbstractHTTPDestination destination =
> >> registry.getDestinationForPath(addr);
> >> -        if (destination == null) {
> >> -            destination = createDestination(endpointInfo);
> >> -        }
> >> -
> >> -        return destination;
> >> -    }
> >> -
> >> -    private synchronized AbstractHTTPDestination createDestination(
> >> -        EndpointInfo endpointInfo
> >> -    ) throws IOException {
> >> -        JettyHTTPDestination destination =
> >> -            new JettyHTTPDestination(getBus(),
> >> -                                     registry,
> >> -                                     endpointInfo,
> >> -
> >> this.getJettyHTTPServerEngineFactory());
> >> +@NoJSR250Annotations()
> >> +public class JettyDestinationFactory implements HttpDestinationFactory
> {
> >>
> >> -        registry.addDestination(endpointInfo.getAddress(),
> destination);
> >> -        configure(destination);
> >> -        try {
> >> -            destination.finalizeConfig();
> >> -        } catch (GeneralSecurityException ex) {
> >> -            throw new IIOException("JSSE Security Exception ", ex);
> >> -        }
> >> -        return destination;
> >> +    public AbstractHTTPDestination createDestination(EndpointInfo
> >> endpointInfo, Bus bus,
> >> +
> DestinationRegistry
> >> registry) throws IOException {
> >> +        JettyHTTPServerEngineFactory serverEngineFactory = bus
> >> +            .getExtension(JettyHTTPServerEngineFactory.class);
> >> +        return new JettyHTTPDestination(bus, registry, endpointInfo,
> >> serverEngineFactory);
> >>     }
> >>
> >>  }
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -139,13 +139,14 @@ public class JettyHTTPDestination extend
> >>      * after the configuration items have been set.
> >>      *
> >>      */
> >> -    public void finalizeConfig()
> >> -        throws GeneralSecurityException,
> >> -               IOException {
> >> -
> >> +    public void finalizeConfig() {
> >>         assert !configFinalized;
> >>
> >> -        retrieveEngine();
> >> +        try {
> >> +            retrieveEngine();
> >> +        } catch (Exception e) {
> >> +            throw new RuntimeException(e.getMessage(), e);
> >> +        }
> >>         configFinalized = true;
> >>     }
> >>
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/cxf/bus-extensions.txt
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/cxf/bus-extensions.txt
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/cxf/bus-extensions.txt
> >> Sun Mar 27 22:00:23 2011
> >> @@ -1,3 +1,3 @@
> >> -org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory::true
> >> +org.apache.cxf.transport.http_jetty.JettyDestinationFactory::true
> >>  org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory::true
> >>
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -61,6 +61,7 @@ import org.apache.cxf.transport.Destinat
> >>  import org.apache.cxf.transport.MessageObserver;
> >>  import org.apache.cxf.transport.http.AbstractHTTPDestination;
> >>  import org.apache.cxf.transport.http.DestinationRegistry;
> >> +import org.apache.cxf.transport.http.HTTPTransportFactory;
> >>  import org.apache.cxf.transports.http.QueryHandler;
> >>  import org.apache.cxf.transports.http.QueryHandlerRegistry;
> >>  import org.apache.cxf.transports.http.StemMatchingQueryHandler;
> >> @@ -110,7 +111,7 @@ public class JettyHTTPDestinationTest ex
> >>     private QueryHandler wsdlQueryHandler;
> >>     private QueryHandlerRegistry  queryHandlerRegistry;
> >>     private List<QueryHandler> queryHandlerList;
> >> -    private JettyHTTPTransportFactory transportFactory;
> >> +    private HTTPTransportFactory transportFactory;
> >>
> >>     /**
> >>      * This class replaces the engine in the Jetty Destination.
> >> @@ -169,8 +170,8 @@ public class JettyHTTPDestinationTest ex
> >>
> >>     @Test
> >>     public void testRandomPortAllocation() throws Exception {
> >> -        transportFactory = new JettyHTTPTransportFactory();
> >> -        transportFactory.setBus(new CXFBusImpl());
> >> +        transportFactory = new HTTPTransportFactory();
> >> +        transportFactory.setBus(BusFactory.getDefaultBus());
> >>         ServiceInfo serviceInfo = new ServiceInfo();
> >>         serviceInfo.setName(new QName("bla", "Service"));
> >>         EndpointInfo ei = new EndpointInfo(serviceInfo, "");
> >> @@ -221,17 +222,16 @@ public class JettyHTTPDestinationTest ex
> >>                 return httpEngine;
> >>             }
> >>         };
> >> -        transportFactory = new JettyHTTPTransportFactory();
> >> +        transportFactory = new HTTPTransportFactory();
> >>         transportFactory.setBus(new CXFBusImpl());
> >>         transportFactory.getBus().setExtension(
> >>             factory, JettyHTTPServerEngineFactory.class);
> >>
> >> -
> >>         TestJettyDestination testDestination =
> >>             new TestJettyDestination(transportFactory.getBus(),
> >>                                      transportFactory.getRegistry(),
> >> -                                     ei,
> >> -
> >> transportFactory.getJettyHTTPServerEngineFactory());
> >> +                                     ei,
> >> +                                     factory);
> >>         testDestination.finalizeConfig();
> >>         Message mi =
> >> testDestination.retrieveFromContinuation(httpRequest);
> >>         assertNull("Continuations must be ignored", mi);
> >> @@ -239,8 +239,8 @@ public class JettyHTTPDestinationTest ex
> >>
> >>     @Test
> >>     public void testGetMultiple() throws Exception {
> >> -        transportFactory = new JettyHTTPTransportFactory();
> >> -        transportFactory.setBus(new CXFBusImpl());
> >> +        transportFactory = new HTTPTransportFactory();
> >> +        transportFactory.setBus(BusFactory.getDefaultBus(true));
> >>
> >>         ServiceInfo serviceInfo = new ServiceInfo();
> >>         serviceInfo.setName(new QName("bla", "Service"));
> >> @@ -432,7 +432,7 @@ public class JettyHTTPDestinationTest ex
> >>         address = getEPR("bar/foo");
> >>         bus = new CXFBusImpl();
> >>
> >> -        transportFactory = new JettyHTTPTransportFactory();
> >> +        transportFactory = new HTTPTransportFactory();
> >>         transportFactory.setBus(bus);
> >>
> >>         ServiceInfo serviceInfo = new ServiceInfo();
> >> @@ -527,16 +527,7 @@ public class JettyHTTPDestinationTest ex
> >>         address = getEPR("bar/foo");
> >>
> >>
> >> -        transportFactory = new JettyHTTPTransportFactory() {
> >> -            JettyHTTPServerEngineFactory serverEngineFactory;
> >> -            @Override
> >> -            public JettyHTTPServerEngineFactory
> >> getJettyHTTPServerEngineFactory() {
> >> -                if (serverEngineFactory == null) {
> >> -                    serverEngineFactory = new
> >> JettyHTTPServerEngineFactory();
> >> -                }
> >> -                return serverEngineFactory;
> >> -            }
> >> -        };
> >> +        transportFactory = new HTTPTransportFactory();
> >>
> >>         final ConduitInitiator ci = new ConduitInitiator() {
> >>             public Conduit getConduit(EndpointInfo targetInfo) throws
> >> IOException {
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactoryTest.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactoryTest.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactoryTest.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactoryTest.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -27,6 +27,8 @@ import org.apache.cxf.BusFactory;
> >>  import org.apache.cxf.bus.spring.SpringBusFactory;
> >>  import org.apache.cxf.transport.DestinationFactory;
> >>  import org.apache.cxf.transport.DestinationFactoryManager;
> >> +import org.apache.cxf.transport.http.HTTPTransportFactory;
> >> +
> >>  import org.junit.After;
> >>  import org.junit.AfterClass;
> >>  import org.junit.BeforeClass;
> >> @@ -78,7 +80,7 @@ public class JettyHTTPServerEngineFactor
> >>             destFM.getDestinationFactory(
> >>                     "http://cxf.apache.org/transports/http");
> >>         assertNotNull("No DestinationFactory", destF);
> >> -        assertTrue(JettyHTTPTransportFactory.class.isInstance(destF));
> >> +        assertTrue(HTTPTransportFactory.class.isInstance(destF));
> >>
> >>         // And the JettyHTTPServerEngineFactory should be there.
> >>         JettyHTTPServerEngineFactory factory =
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/cxf/osgi/cxf-extension-osgi.xml
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/cxf/osgi/cxf-extension-osgi.xml?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/cxf/osgi/cxf-extension-osgi.xml
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/cxf/osgi/cxf-extension-osgi.xml
> >> Sun Mar 27 22:00:23 2011
> >> @@ -24,13 +24,6 @@
> >>  http://www.springframework.org/schema/beans
> >> http://www.springframework.org/schema/beans/spring-beans.xsd
> >>  http://www.springframework.org/schema/osgi
> >> http://www.springframework.org/schema/osgi/spring-osgi.xsd">
> >>
> >> -    <bean id="ServletTransportFactory"
> >> -
> >>  class="org.apache.cxf.transport.servlet.ServletTransportFactory"
> >> -          lazy-init="true">
> >> -        <constructor-arg ref="osgiDestinationRegistry"/>
> >> -        <property name="bus" ref="cxf"/>
> >> -    </bean>
> >> -
> >>     <osgi:reference id="osgiDestinationRegistry"
> >>
> >> interface="org.apache.cxf.transport.http.DestinationRegistry" />
> >>
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -632,6 +632,9 @@ public abstract class AbstractHTTPDestin
> >>     protected boolean contextMatchOnExact() {
> >>         return "exact".equals(contextMatchStrategy);
> >>     }
> >> +
> >> +    public void finalizeConfig() {
> >> +    }
> >>
> >>     public String getBeanName() {
> >>         String beanName = null;
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistry.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistry.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistry.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistry.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -25,7 +25,7 @@ import org.apache.cxf.transport.Abstract
> >>
> >>
> >>  public interface DestinationRegistry {
> >> -    void addDestination(String path, AbstractHTTPDestination
> >> destination);
> >> +    void addDestination(AbstractHTTPDestination destination);
> >>
> >>     void removeDestination(String path);
> >>
> >> @@ -41,5 +41,4 @@ public interface DestinationRegistry {
> >>
> >>     Set<String> getDestinationsPaths();
> >>
> >> -    String getTrimmedPath(String path);
> >>  }
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -42,11 +42,11 @@ public class DestinationRegistryImpl imp
> >>     public DestinationRegistryImpl() {
> >>     }
> >>
> >> -    public void addDestination(String path, AbstractHTTPDestination
> >> destination) {
> >> -        String p = getTrimmedPath(path);
> >> -        destinations.putIfAbsent(p, destination);
> >> +    public void addDestination(AbstractHTTPDestination destination) {
> >> +        String path =
> >> getTrimmedPath(destination.getEndpointInfo().getAddress());
> >> +        destinations.putIfAbsent(path, destination);
> >>         try {
> >> -            decodedDestinations.put(URLDecoder.decode(p, "ISO-8859-1"),
> >> destination);
> >> +            decodedDestinations.put(URLDecoder.decode(path,
> >> "ISO-8859-1"), destination);
> >>         } catch (UnsupportedEncodingException e) {
> >>             throw new RuntimeException("Unsupported Encoding", e);
> >>         }
> >> @@ -127,7 +127,7 @@ public class DestinationRegistryImpl imp
> >>      * @param path
> >>      * @return trimmed path
> >>      */
> >> -    public String getTrimmedPath(String path) {
> >> +    public static String getTrimmedPath(String path) {
> >>         if (path == null) {
> >>             return "/";
> >>         }
> >>
> >> Copied:
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
> >> (from r1085147,
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java)
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java?p2=cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java&p1=cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java&r1=1085147&r2=1086052&rev=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -19,6 +19,7 @@
> >>
> >>  package org.apache.cxf.transport.http;
> >>
> >> +import java.io.IOException;
> >>  import java.util.ArrayList;
> >>  import java.util.Arrays;
> >>  import java.util.Collection;
> >> @@ -27,17 +28,25 @@ import java.util.Iterator;
> >>  import java.util.List;
> >>  import java.util.Set;
> >>
> >> +import javax.annotation.Resource;
> >>  import javax.wsdl.extensions.http.HTTPAddress;
> >>  import javax.wsdl.extensions.soap.SOAPAddress;
> >>  import javax.xml.namespace.QName;
> >>
> >>  import org.apache.cxf.Bus;
> >> +import org.apache.cxf.common.injection.NoJSR250Annotations;
> >>  import org.apache.cxf.configuration.Configurer;
> >>  import org.apache.cxf.service.Service;
> >>  import org.apache.cxf.service.model.BindingInfo;
> >>  import org.apache.cxf.service.model.EndpointInfo;
> >>  import org.apache.cxf.service.model.ServiceInfo;
> >>  import org.apache.cxf.transport.AbstractTransportFactory;
> >> +import org.apache.cxf.transport.Conduit;
> >> +import org.apache.cxf.transport.ConduitInitiator;
> >> +import org.apache.cxf.transport.Destination;
> >> +import org.apache.cxf.transport.DestinationFactory;
> >> +import org.apache.cxf.transport.servlet.ServletDestinationFactory;
> >> +import org.apache.cxf.ws.addressing.EndpointReferenceType;
> >>  import org.apache.cxf.wsdl.http.AddressType;
> >>  import org.apache.cxf.wsdl11.WSDLEndpointFactory;
> >>
> >> @@ -45,9 +54,10 @@ import org.apache.cxf.wsdl11.WSDLEndpoin
> >>  /**
> >>  *
> >>  */
> >> -public abstract class AbstractHTTPTransportFactory
> >> +@NoJSR250Annotations(unlessNull = "bus")
> >> +public class HTTPTransportFactory
> >>     extends AbstractTransportFactory
> >> -    implements WSDLEndpointFactory {
> >> +    implements WSDLEndpointFactory, ConduitInitiator,
> DestinationFactory
> >> {
> >>
> >>     public static final List<String> DEFAULT_NAMESPACES
> >>         = Arrays.asList(
> >> @@ -69,21 +79,26 @@ public abstract class AbstractHTTPTransp
> >>
> >>     protected final DestinationRegistry registry;
> >>
> >> -    public AbstractHTTPTransportFactory() {
> >> +    public HTTPTransportFactory() {
> >>         this(new DestinationRegistryImpl());
> >>     }
> >> -    public AbstractHTTPTransportFactory(Bus b) {
> >> +    public HTTPTransportFactory(Bus b) {
> >>         this(b, new DestinationRegistryImpl());
> >>     }
> >> -    public AbstractHTTPTransportFactory(Bus b, DestinationRegistry
> >> registry) {
> >> +    public HTTPTransportFactory(Bus b, DestinationRegistry registry) {
> >>         super(DEFAULT_NAMESPACES, b);
> >>         this.registry = registry;
> >>     }
> >>
> >> -    public AbstractHTTPTransportFactory(DestinationRegistry registry) {
> >> +    public HTTPTransportFactory(DestinationRegistry registry) {
> >>         super(DEFAULT_NAMESPACES);
> >>         this.registry = registry;
> >>     }
> >> +
> >> +    @Resource
> >> +    public void setBus(Bus b) {
> >> +        super.setBus(b);
> >> +    }
> >>
> >>     public DestinationRegistry getRegistry() {
> >>         return registry;
> >> @@ -199,5 +214,52 @@ public abstract class AbstractHTTPTransp
> >>         }
> >>
> >>     }
> >> +
> >> +    /**
> >> +     * This call creates a new HTTPConduit for the endpoint. It is
> >> equivalent
> >> +     * to calling getConduit without an EndpointReferenceType.
> >> +     */
> >> +    public Conduit getConduit(EndpointInfo endpointInfo) throws
> >> IOException {
> >> +        return getConduit(endpointInfo, endpointInfo.getTarget());
> >> +    }
> >> +
> >> +    /**
> >> +     * This call creates a new HTTP Conduit based on the EndpointInfo
> and
> >> +     * EndpointReferenceType.
> >> +     * TODO: What are the formal constraints on EndpointInfo and
> >> +     * EndpointReferenceType values?
> >> +     */
> >> +    public Conduit getConduit(
> >> +            EndpointInfo endpointInfo,
> >> +            EndpointReferenceType target
> >> +    ) throws IOException {
> >> +        HTTPConduit conduit = new HTTPConduit(bus, endpointInfo,
> target);
> >> +        // Spring configure the conduit.
> >> +        String address = conduit.getAddress();
> >> +        if (address != null && address.indexOf('?') != -1) {
> >> +            address = address.substring(0, address.indexOf('?'));
> >> +        }
> >> +        configure(conduit, conduit.getBeanName(), address);
> >> +        conduit.finalizeConfig();
> >> +        return conduit;
> >> +    }
> >> +
> >> +    public Destination getDestination(EndpointInfo endpointInfo) throws
> >> IOException {
> >> +        AbstractHTTPDestination d =
> >> registry.getDestinationForPath(endpointInfo.getAddress());
> >> +        if (d == null) {
> >> +            HttpDestinationFactory jettyFactory =
> >> bus.getExtension(HttpDestinationFactory.class);
> >> +            HttpDestinationFactory servletFactory = new
> >> ServletDestinationFactory();
> >> +            String addr = endpointInfo.getAddress();
> >> +            HttpDestinationFactory factory = servletFactory;
> >> +            if (jettyFactory != null && (addr == null ||
> >> addr.startsWith("http"))) {
> >> +                factory = jettyFactory;
> >> +            }
> >> +            d = factory.createDestination(endpointInfo, getBus(),
> >> registry);
> >> +            registry.addDestination(d);
> >> +            configure(d);
> >> +            d.finalizeConfig();
> >> +        }
> >> +        return d;
> >> +    }
> >>
> >>  }
> >>
> >> Added:
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpDestinationFactory.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpDestinationFactory.java?rev=1086052&view=auto
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpDestinationFactory.java
> >> (added)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpDestinationFactory.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -0,0 +1,30 @@
> >> +/**
> >> + * 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.transport.http;
> >> +
> >> +import java.io.IOException;
> >> +
> >> +import org.apache.cxf.Bus;
> >> +import org.apache.cxf.service.model.EndpointInfo;
> >> +
> >> +public interface HttpDestinationFactory {
> >> +    AbstractHTTPDestination createDestination(EndpointInfo
> endpointInfo,
> >> +                                              Bus bus,
> >> +                                              DestinationRegistry
> >> registry) throws IOException;
> >> +}
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -16,200 +16,98 @@
> >>  * specific language governing permissions and limitations
> >>  * under the License.
> >>  */
> >> -
> >>  package org.apache.cxf.transport.servlet;
> >>
> >> -import java.io.IOException;
> >> -import java.io.InputStream;
> >> -
> >> -import java.util.Collection;
> >> -import java.util.logging.Level;
> >> -import java.util.logging.Logger;
> >> -
> >>  import javax.servlet.ServletConfig;
> >> -import javax.servlet.ServletContext;
> >>  import javax.servlet.ServletException;
> >> -
> >> -
> >> -import org.apache.cxf.bus.spring.BusApplicationContext;
> >> -import org.apache.cxf.bus.spring.SpringBusFactory;
> >> -import org.apache.cxf.common.classloader.ClassLoaderUtils;
> >> -import org.apache.cxf.common.logging.LogUtils;
> >> -import org.apache.cxf.helpers.CastUtils;
> >> +import javax.servlet.http.HttpServlet;
> >> +import javax.servlet.http.HttpServletRequest;
> >> +import javax.servlet.http.HttpServletResponse;
> >> +
> >> +import org.apache.cxf.Bus;
> >> +import org.apache.cxf.BusException;
> >> +import org.apache.cxf.BusFactory;
> >>  import org.apache.cxf.resource.ResourceManager;
> >> -import org.apache.cxf.resource.URIResolver;
> >> -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
> >> +import org.apache.cxf.transport.DestinationFactory;
> >> +import org.apache.cxf.transport.DestinationFactoryManager;
> >> +import org.apache.cxf.transport.http.HTTPTransportFactory;
> >> +import
> >>
> org.apache.cxf.transport.servlet.servicelist.ServiceListGeneratorServlet;
> >>  import org.springframework.context.ApplicationContext;
> >> -import org.springframework.context.ApplicationEvent;
> >> -import org.springframework.context.ApplicationListener;
> >> -import org.springframework.context.ConfigurableApplicationContext;
> >> -import org.springframework.context.event.ContextRefreshedEvent;
> >> -import org.springframework.context.support.AbstractApplicationContext;
> >> -import org.springframework.context.support.GenericApplicationContext;
> >> -import org.springframework.core.io.InputStreamResource;
> >> +import
> >> org.springframework.context.support.ClassPathXmlApplicationContext;
> >> +import
> >> org.springframework.web.context.support.WebApplicationContextUtils;
> >>
> >> +public class CXFServlet extends AbstractHTTPServlet {
> >>
> >> -/**
> >> - * A Servlet which supports loading of JAX-WS endpoints from an
> >> - * XML file and handling requests for endpoints created via other means
> >> - * such as Spring beans, or the Java API. All requests are passed on
> >> - * to the {@link ServletController}.
> >> - *
> >> - */
> >> -public class CXFServlet extends AbstractCXFServlet implements
> >> ApplicationListener {
> >> -
> >> -    private GenericApplicationContext childCtx;
> >> -    private boolean inRefresh;
> >> -
> >> -
> >> -    public static Logger getLogger() {
> >> -        return LogUtils.getL7dLogger(CXFServlet.class);
> >> -    }
> >> +    private HTTPTransportFactory transportFactory;
> >> +    private Bus bus;
> >> +
> >> +    private ServletController controller;
> >>
> >> -    public void loadBus(ServletConfig servletConfig) throws
> >> ServletException {
> >> -        String springCls =
> >> "org.springframework.context.ApplicationContext";
> >> -        try {
> >> -            ClassLoaderUtils.loadClass(springCls, getClass());
> >> -            loadSpringBus(servletConfig);
> >> -        } catch (ClassNotFoundException e) {
> >> -            LOG.log(Level.SEVERE, "FAILED_TO_LOAD_SPRING_BUS", new
> >> Object[]{e});
> >> -            throw new ServletException("Can't load bus with Spring
> >> context class", e);
> >> -        }
> >> +    public CXFServlet() {
> >>     }
> >> -
> >> -
> >> -    private void loadSpringBus(ServletConfig servletConfig) throws
> >> ServletException {
> >> -
> >> -        // try to pull an existing ApplicationContext out of the
> >> -        // ServletContext
> >> -        ServletContext svCtx = getServletContext();
> >> -
> >> -        // Spring 1.x
> >> -        ApplicationContext ctx = (ApplicationContext)svCtx
> >> -            .getAttribute("interface
> >> org.springframework.web.context.WebApplicationContext.ROOT");
> >> -
> >> -        // Spring 2.0
> >> -        if (ctx == null) {
> >> -            Object ctxObject = svCtx
> >> -
> >>
>  .getAttribute("org.springframework.web.context.WebApplicationContext.ROOT");
> >> -            if (ctxObject instanceof ApplicationContext) {
> >> -                ctx = (ApplicationContext) ctxObject;
> >> -            } else if (ctxObject != null) {
> >> -                // it should be a runtime exception
> >> -                Exception ex = (Exception) ctxObject;
> >> -                throw new ServletException(ex);
> >> -            }
> >> -        }
> >> -
> >> -        updateContext(servletConfig, ctx);
> >>
> >> -        if (ctx instanceof ConfigurableApplicationContext) {
> >> -
> >>  ((ConfigurableApplicationContext)ctx).addApplicationListener(this);
> >> -        }
> >> -        if (ctx instanceof AbstractApplicationContext) {
> >> -            Collection<ApplicationListener> lst = getListeners(ctx);
> >> -            if (lst != null && !lst.contains(this)) {
> >> -                lst.add(this);
> >> +    @Override
> >> +    public void init(ServletConfig sc) throws ServletException {
> >> +        super.init(sc);
> >> +        if (this.bus == null) {
> >> +            ApplicationContext wac = WebApplicationContextUtils.
> >> +                getWebApplicationContext(sc.getServletContext());
> >> +            String configLocation =
> >> sc.getInitParameter("config-location");
> >> +            if (wac == null && (configLocation != null)) {
> >> +                wac = new
> ClassPathXmlApplicationContext(configLocation);
> >>             }
> >> -        }
> >> -    }
> >> -    private Collection<ApplicationListener>
> >> getListeners(ApplicationContext ctx) {
> >> -        try {
> >> -            Object o =
> >> ctx.getClass().getMethod("getApplicationListeners").invoke(ctx);
> >> -            return CastUtils.cast((Collection<?>)o);
> >> -        } catch (Exception e) {
> >> -            //ignore
> >> -        }
> >> -        return null;
> >> -    }
> >> -
> >> -    private void updateContext(ServletConfig servletConfig,
> >> ApplicationContext ctx) {
> >> -        /* If ctx is null, normally no ContextLoaderListener
> >> -         * was defined in web.xml.  Default bus with all extensions
> >> -         * will be created in this case.
> >> -         *
> >> -         * If ctx not null, was already created by
> ContextLoaderListener.
> >> -         * Bus with only those extensions defined in the ctx will be
> >> created.
> >> -         */
> >> -        if (ctx == null) {
> >> -            LOG.info("LOAD_BUS_WITHOUT_APPLICATION_CONTEXT");
> >> -            bus = new SpringBusFactory().createBus(new String[0]);
> >> -            ctx = bus.getExtension(BusApplicationContext.class);
> >> -        } else {
> >> -            LOG.info("LOAD_BUS_WITH_APPLICATION_CONTEXT");
> >> -            inRefresh = true;
> >> -            try {
> >> -                bus = new SpringBusFactory(ctx).createBus();
> >> -            } finally {
> >> -                inRefresh = false;
> >> +            if (wac != null) {
> >> +                this.bus = wac.getBean("cxf", Bus.class);
> >> +            } else {
> >> +                this.bus = BusFactory.newInstance().createBus();
> >>             }
> >> -        }
> >> -
> >> +        }
> >> +
> >>         ResourceManager resourceManager =
> >> bus.getExtension(ResourceManager.class);
> >>         resourceManager.addResourceResolver(new
> >> ServletContextResourceResolver(
> >> -
> >> servletConfig.getServletContext()));
> >> -
> >> -        replaceDestinationFactory();
> >> -
> >> -        // Set up the ServletController
> >> -        controller = createServletController(servletConfig);
> >> -
> >> -        // build endpoints from the web.xml or a config file
> >> -        loadAdditionalConfig(ctx, servletConfig);
> >> -    }
> >> -
> >> -    private void loadAdditionalConfig(ApplicationContext ctx,
> >> -                                        ServletConfig servletConfig) {
> >> -        String location =
> >> servletConfig.getInitParameter("config-location");
> >> -        if (location == null) {
> >> -            location = "/WEB-INF/cxf-servlet.xml";
> >> -        }
> >> -        InputStream is = null;
> >> -        try {
> >> -            is =
> >> servletConfig.getServletContext().getResourceAsStream(location);
> >> -
> >> -            if (is == null || is.available() == -1) {
> >> -                URIResolver resolver = new URIResolver(location);
> >> +
> sc.getServletContext()));
> >>
> >> -                if (resolver.isResolved()) {
> >> -                    is = resolver.getInputStream();
> >> +        if (transportFactory == null) {
> >> +            DestinationFactoryManager dfm =
> >> bus.getExtension(DestinationFactoryManager.class);
> >> +            try {
> >> +                DestinationFactory df = dfm
> >> +                    .getDestinationFactory("
> >> http://cxf.apache.org/transports/http/configuration");
> >> +                if (df instanceof HTTPTransportFactory) {
> >> +                    transportFactory = (HTTPTransportFactory)df;
> >>                 }
> >> +            } catch (BusException e) {
> >> +                // why are we throwing a busexception if the DF isn't
> >> found?
> >>             }
> >> -        } catch (IOException e) {
> >> -            //throw new ServletException(e);
> >> -        }
> >> -
> >> -        if (is != null) {
> >> -            LOG.log(Level.INFO, "BUILD_ENDPOINTS_FROM_CONFIG_LOCATION",
> >> new Object[]{location});
> >> -            childCtx = new GenericApplicationContext(ctx);
> >> -
> >> -            XmlBeanDefinitionReader reader = new
> >> XmlBeanDefinitionReader(childCtx);
> >> -
> >>  reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
> >> -            reader.loadBeanDefinitions(new InputStreamResource(is,
> >> location));
> >> -
> >> -            childCtx.refresh();
> >> -        }
> >> -    }
> >> -
> >> -    public void destroy() {
> >> -        if (childCtx != null) {
> >> -            childCtx.destroy();
> >>         }
> >> -        super.destroy();
> >> +        this.controller = createServletController(sc);
> >>     }
> >>
> >> -    public void onApplicationEvent(ApplicationEvent event) {
> >> -        if (!inRefresh && event instanceof ContextRefreshedEvent &&
> >> getServletConfig() != null) {
> >> -            //need to re-do the bus/controller stuff
> >> -            try {
> >> -                inRefresh = true;
> >> -                updateContext(this.getServletConfig(),
> >> -
> >>  ((ContextRefreshedEvent)event).getApplicationContext());
> >> -            } finally {
> >> -                inRefresh = false;
> >> -            }
> >> +    private ServletController createServletController(ServletConfig
> >> servletConfig) {
> >> +        HttpServlet serviceListGeneratorServlet =
> >> +            new
> >> ServiceListGeneratorServlet(transportFactory.getRegistry(), bus);
> >> +        ServletController newController =
> >> +            new ServletController(transportFactory.getRegistry(),
> >> +                                  servletConfig,
> >> +                                  serviceListGeneratorServlet);
> >> +        return newController;
> >> +    }
> >> +
> >> +    public Bus getBus() {
> >> +        return bus;
> >> +    }
> >> +
> >> +    public void setBus(Bus bus) {
> >> +        this.bus = bus;
> >> +    }
> >> +
> >> +    @Override
> >> +    protected void invoke(HttpServletRequest request,
> HttpServletResponse
> >> response) throws ServletException {
> >> +        try {
> >> +            BusFactory.setThreadDefaultBus(bus);
> >> +            controller.invoke(request, response);
> >> +        } finally {
> >> +            BusFactory.setThreadDefaultBus(null);
> >>         }
> >>     }
> >>
> >> -
> >>  }
> >>
> >> Added:
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestinationFactory.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestinationFactory.java?rev=1086052&view=auto
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestinationFactory.java
> >> (added)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestinationFactory.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -0,0 +1,35 @@
> >> +/**
> >> + * 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.transport.servlet;
> >> +
> >> +import java.io.IOException;
> >> +
> >> +import org.apache.cxf.Bus;
> >> +import org.apache.cxf.service.model.EndpointInfo;
> >> +import org.apache.cxf.transport.http.AbstractHTTPDestination;
> >> +import org.apache.cxf.transport.http.DestinationRegistry;
> >> +import org.apache.cxf.transport.http.HttpDestinationFactory;
> >> +
> >> +public class ServletDestinationFactory implements
> HttpDestinationFactory
> >> {
> >> +    public AbstractHTTPDestination createDestination(EndpointInfo
> >> endpointInfo,
> >> +                                                     Bus bus,
> >> +
> DestinationRegistry
> >> registry) throws IOException {
> >> +        return new ServletDestination(bus, registry, endpointInfo,
> >> endpointInfo.getAddress());
> >> +    }
> >> +}
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/bus-extensions.txt
> >> Sun Mar 27 22:00:23 2011
> >> @@ -1,4 +1,4 @@
> >> -org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory::true
> >> +org.apache.cxf.transport.http.HTTPTransportFactory::true
> >>  org.apache.cxf.transport.http.HTTPWSDLExtensionLoader::true
> >>  org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder::true
> >>  org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder::true
> >>
> >> Modified:
> >>
> cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml
> >> Sun Mar 27 22:00:23 2011
> >> @@ -23,8 +23,5 @@
> >>        xsi:schemaLocation="
> >>  http://www.springframework.org/schema/beans
> >> http://www.springframework.org/schema/beans/spring-beans.xsd">
> >>
> >> -    <bean
> >> class="org.apache.cxf.transport.servlet.ServletTransportFactory"
> >> -         id="org.apache.cxf.transport.servlet.ServletTransportFactory">
> >> -        <property name="bus" ref="cxf"/>
> >> -    </bean>
> >> +
> >>  </beans>
> >>
> >> Copied:
> >>
> cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml
> >> (from r1085147,
> >>
> cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml)
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml?p2=cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml&p1=cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml&r1=1085147&r2=1086052&rev=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml
> >> (original)
> >> +++
> >>
> cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml
> >> Sun Mar 27 22:00:23 2011
> >> @@ -45,7 +45,7 @@ http://www.springframework.org/schema/co
> >>
> >>     <bean id="destinationRegistry"
> >> class="org.apache.cxf.transport.http.DestinationRegistryImpl" />
> >>
> >> -    <bean id="osgiServlet"
> >> class="org.apache.cxf.transport.http_osgi.SpringOsgiServlet">
> >> +    <bean id="osgiServlet"
> >> class="org.apache.cxf.transport.servlet.CXFServlet">
> >>         <constructor-arg ref="destinationRegistry"/>
> >>     </bean>
> >>
> >> @@ -68,4 +68,4 @@ http://www.springframework.org/schema/co
> >>     </osgi:service>
> >>
> >>  </beans>
> >> -
> >> +
> >>
> >> Modified:
> >>
> cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java?rev=1086052&r1=1086051&r2=1086052&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
> >> (original)
> >> +++
> >>
> cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
> >> Sun Mar 27 22:00:23 2011
> >> @@ -24,7 +24,7 @@ import org.apache.cxf.Bus;
> >>  import org.apache.cxf.BusFactory;
> >>  import org.apache.cxf.jaxws.EndpointImpl;
> >>  import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
> >> -import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
> >> +import org.apache.cxf.transport.servlet.CXFServlet;
> >>  import org.apache.hello_world_soap_http.GreeterImpl;
> >>  import org.eclipse.jetty.server.Server;
> >>  import org.eclipse.jetty.server.handler.ContextHandlerCollection;
> >> @@ -48,16 +48,15 @@ public class NoSpringServletServer exten
> >>
> >>             ServletContextHandler root = new
> >> ServletContextHandler(contexts, "/",
> >>
> >>  ServletContextHandler.SESSIONS);
> >> -
> >> -            CXFNonSpringServlet cxf = new CXFNonSpringServlet();
> >> +            Bus bus = BusFactory.getDefaultBus(true);
> >> +            CXFServlet cxf = new CXFServlet();
> >> +            cxf.setBus(bus);
> >>             ServletHolder servlet = new ServletHolder(cxf);
> >>             servlet.setName("soap");
> >>             servlet.setForcedPath("soap");
> >>             root.addServlet(servlet, "/soap/*");
> >>
> >>             httpServer.start();
> >> -
> >> -            Bus bus = cxf.getBus();
> >>             setBus(bus);
> >>             BusFactory.setDefaultBus(bus);
> >>             GreeterImpl impl = new GreeterImpl();
> >> @@ -65,7 +64,7 @@ public class NoSpringServletServer exten
> >>             HelloImpl helloImpl = new HelloImpl();
> >>             Endpoint.publish("/Hello", helloImpl);
> >>
> >> -            ((EndpointImpl)Endpoint.create(helloImpl)).publish();
> >> +            ((EndpointImpl)Endpoint.create(helloImpl)).publish("/");
> >>
> >>         } catch (Exception e) {
> >>             throw new RuntimeException(e);
> >>
> >>
> >>
> >
> >
> > --
> > Sergey Beryozkin
> >
> > Application Integration Division of Talend <http://www.talend.com>
> > http://sberyozkin.blogspot.com
> >
>
>
>
> --
> Sergey Beryozkin
>
> Application Integration Division of Talend <http://www.talend.com>
> http://sberyozkin.blogspot.com
>



--
Sergey Beryozkin

Application Integration Division of Talend <http://www.talend.com>
http://sberyozkin.blogspot.com

Mime
View raw message