The file is on the classpath. More precisely is in a folder which is specified in xbootclasspath option with append option. This usually works well with wss4j configuration files, so I thought it could work also for jetty.
Matteo Rulli Begin forwarded message: > From: Sergey Beryozkin <sberyoz...@gmail.com> > Date: February 8, 2012 22:25:14 GMT+01:00 > To: users@cxf.apache.org > Subject: Re: serve static content through jetty > Reply-To: users@cxf.apache.org > > Hi > > On 08/02/12 17:10, matteo rulli wrote: >> Dear all, >> >> I publish some soap-WS through CXF (v. 2.5.0 - bundled into OSGi equinox) on >> the following URI: >> >> >> >> http://10.0.2.243:8160/Persistence >> >> >> >> The problem is that when a Silverlight client tries to consume my WS, a >> "get" request for a resource called clientaccesspolicy.xml is generated, >> namely >> >> http:// 10.0.2.243:8160/clientaccesspolicy.xml >> <http://%2010.0.2.243:8160/clientaccesspolicy.xml> > > where exactly is this file located/created ? Is it available before the > bundle is even started for the very first time ? > > Cheers, Sergey > > >> >> >> >> Is there a way to configure Jetty to serve this file? I should perform this >> programmatically. I tried with something like (sorry for that, I know it is >> a very awkward attempt of mine to reproduce the >> <http://cxf.apache.org/docs/standalone-http-transport.html> >> http://cxf.apache.org/docs/standalone-http-transport.html example): >> >> >> >> String address = "http:// 10.0.2.243:8160"; >> >> Bus _defaultBUS = BusFactory.getDefaultBus(); >> >> JettyHTTPServerEngineFactory jettyFactory = >> >> >> _defaultBUS.getExtension(JettyHTTPServerEngineFactory.class); >> >> // get the jetty server form the destination >> >> EndpointInfo ei = new EndpointInfo(); >> >> ei.setAddress(address); >> >> DestinationFactoryManager dfm = >> >> _defaultBUS.getExtension(DestinationFactoryManager.class); >> >> DestinationFactory df = dfm.getDestinationFactoryForUri(address); >> >> JettyHTTPDestination destination = >> >> (JettyHTTPDestination) df.getDestination(ei); >> >> >> >> JettyHTTPDestination jettyDestination = (JettyHTTPDestination) destination; >> >> ServerEngine engine = jettyDestination.getEngine(); >> >> Handler handler = engine.getServant(new URL(address)); >> >> org.eclipse.jetty.server.Server server = handler.getServer(); // The Server >> >> >> >> // We have to create a HandlerList structure that includes both a >> ResourceHandler for the static >> >> // content as well as the ContextHandlerCollection created by CXF (which we >> retrieve as serverHandler). >> >> Handler serverHandler = server.getHandler(); >> >> HandlerList handlerList = new HandlerList(); >> >> ResourceHandler resourceHandler = new ResourceHandler(); >> >> handlerList.addHandler(resourceHandler); >> >> handlerList.addHandler(serverHandler); >> >> >> >> // replace the CXF servlet connect collection with the list. >> >> server.setHandler(handlerList); >> >> // and tell the handler list that it is alive. >> >> handlerList.start(); >> >> >> >> // setup the resource handler >> >> File staticContentFile = new File(staticContentPath); // ordinary pathname. >> >> URL targetURL = new URL("file://" + staticContentFile.getCanonicalPath()); >> >> FileResource fileResource = new FileResource(targetURL); >> >> resourceHandler.setBaseResource(fileResource); >> >> >> >> But unfortunately it does not work and it spoils my endpoint. >> >> >> >> Could you suggest an alternative java-based approach to serve the >> clientaccesspolicy.xml file? >> >> >> >> Thank you very much. >> >> >> >> Matteo Rulli >> >> >> >> > > > -- > Sergey Beryozkin > > Talend Community Coders > http://coders.talend.com/ > > Blog: http://sberyozkin.blogspot.com >