Hi Oli On Wed, Jun 22, 2011 at 8:18 AM, Oliver Wulff <[email protected]> wrote: > Thanks for clarification. Is this different when deploying to OSGi/Karaf? I > think you can use either Jetty or the OSGi http service. Are we able to get > this information at startup in this case? >
I guess it can be more predictable when bundles are not deployed as web-bundles, that is, when HTTP Service is used to assign a default context such as /services as configured at startup, so knowing this context, preconfigured port number and the endpoint address can give an absolute URI; however what Dan said would apply again when web-bundle containing web.xml are deployed. Probably only in case of CXFJAXRsNonSpringServlet, with root resources having constructors accepting ServletContext, one can get servlet specific info at the init time; similarly with CXFNonSpringServlet overriding init(), etc... Cheers, Sergey > Thanks > Oli > > ________________________________________ > Von: Daniel Kulp [[email protected]] > Gesendet: Mittwoch, 22. Juni 2011 05:18 > An: [email protected] > Cc: Oliver Wulff > Betreff: Re: AW: Fully qualified endpoint address at startup time > > Oliver, > > On Tuesday, June 21, 2011 7:51:43 PM Oliver Wulff wrote: >> I was thinking that it must be possible to figure this out at startup time. >> I remember that I read that there was some refactoring regarding the >> different http transports which would simplify the way to get this >> information. > > No, Willem is right. There isn't anything in the Servlet context or config > that would allow you to get that information. It's partially because a > single servlet can be bound to multiple locations and different ports and > such. Thus, it's only during the invoke that you can determine how the > client contacted the servlet. > > > Dan > > > >> I think it's error prone to configure it in the spring config if everything >> is already configured in tomcat server.xml and the web app name (servlet >> context name). >> >> Thanks >> Oli >> >> ________________________________________ >> Von: Willem Jiang [[email protected]] >> Gesendet: Montag, 20. Juni 2011 12:03 >> An: [email protected] >> Betreff: Re: Fully qualified endpoint address at startup time >> >> It's hard to know what the exactly the services address is when you >> start the the endpoint in the servlet or osgi container. >> The address will be changed if your war or servlet configure is changed. >> >> If you already know the physical address, you may consider to use >> publishedEndpointUrl property to set the address which will be used in >> the WSDL that is generate dynamically from CXF. >> >> <jaxws:endpoint id="myEndpoint" address="MyServicePort" >> serviceClass="org.apache.hello_world_soap_http.GreeterImpl" > >> <jaxws:properties> >> <!-- Set the publishedEndpointUrl which could override the service >> address from generated WSDL as you want --> >> <entry key="publishedEndpointUrl" >> value="http://www.simple.com/services/test" /> >> </jaxws:properties> >> </jaxws:cxfEndpoint> >> >> On 6/18/11 2:42 PM, Oliver Wulff wrote: >> > Hi there >> > >> > Does there exist a way to figure out the fully qualified endpoint >> > address for an http based endpoint at startup time independent of the >> > underlying container (servlet, osgi, jetty)? >> > >> > The following way works for an incoming request but I'm looking for a >> > way during startup: >> > >> > HttpServletRequest req = (HttpServletRequest)msg.get("HTTP.REQUEST") >> > if (req != null) { >> > ... = req.getRequestUrl(); >> > } >> > >> > >> > Thanks >> > Oli >> >> -- >> Willem >> ---------------------------------- >> FuseSource >> Web: http://www.fusesource.com >> Blog: http://willemjiang.blogspot.com (English) >> http://jnn.javaeye.com (Chinese) >> Twitter: willemjiang >> Weibo: willemjiang > -- > Daniel Kulp > [email protected] > http://dankulp.com/blog > Talend - http://www.talend.com -- Sergey Beryozkin Application Integration Division of Talend http://sberyozkin.blogspot.com
