cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: How to seperate with CXF
Date Fri, 29 Feb 2008 22:29:03 GMT


You can try something like:

        ClassLoader cl = new URLClassLoader(new URL[0], 
Thread.currentThread().getContextClassLoader()) {
            public InputStream getResourceAsStream(String s) {
                if 
("META-INF/services/javax.xml.ws.spi.Provider".equals("s")) {
                    return null;
                }
                return super.getResourceAsStream(s);
            }            
            public URL getResource(String s) {
                if 
("META-INF/services/javax.xml.ws.spi.Provider".equals("s")) {
                    return null;
                }
                return super.getResource(s);
            }            
        };
        Thread.currentThread().setContextClassLoader(cl); 
        ... new Service...
        Thread.currentThread().setContextClassLoader(cl.getParent());

Dan


On Friday 29 February 2008, yulinxp wrote:
> Could you pls give me some code snippets?
> I don't know how to block the call to
> getResource("META-INF/services/javax.xml.ws.spi.Provider")
>
> dkulp wrote:
> > Honestly, I'm not sure there IS a way.   I was hoping for at least a
> > system property, but looking at the code for jaxws-api, the system
> > property is actually checked last.  :-(
> >
> > The only way I can come up with that MIGHT work is to create a
> > special classloader that blocks the call to
> > getResource("META-INF/services/javax.xml.ws.spi.Provider") and just
> > returns null.   Set the thread.contextClassLoader to that
> > classloader just before the call to "new HPRequestWS()".  Probably
> > should reset it back to the original when done.
> >
> > Dan
> >
> > On Friday 29 February 2008, yulinxp wrote:
> >> Those classes generated by wsimport and CXF client are very
> >> similar. For HPRequestWS ss = new HPRequestWS();
> >>
> >> wsimport version:
> >> ss-->delegate: com.sun.xml.ws.client.WSServiceDelegate@16f5261
> >>
> >> CXF version:
> >> ss-->delegate: org.apache.cxf.jaxws.ServiceImpl@a1c582
> >>
> >> How can I force it use WSServiceDelegate not cxf ServiceImpl???
> >> Please help!
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message