On 8/30/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote:
>
> ant elder wrote:
> > I've not yet been able to find any good way to reliably work out the
> > complete service URL in all environments. What i think maybe the best
> > approach is to add a getBaseURI method to the Tuscany ServletHost
> interface
> > so that can be used by bindings. So then it would be down to each
> > ServletHost impl to set this  correctly rather than the Axis2 binding to
> > work it out. So for example for WebappServletHost it would be the webapp
> url
> > like, http://localhost:8080/helloworld-ws-service-webapp, for the war
> distro
> > http://localhost:8080/tuscany, for Geronimo http://localhost:8080 etc.
> >
> > Does something like this sound ok or does anyone have any better ideas?
> >
> >    ...ant
> >
> >
>
> I'm not sure which scenario you have in mind for this, so here are the
> two use cases I can think of:
>
> (1) A binding was configured with a URI like localhost:8080 but will
> need to tell the world (in generated WSDL, in service endpoint
> references etc.) the actual endpoint address at which it can be reached,
> 192.168.1.1:8080 or myhost:8080 for example
>
> (2) A binding was configured with a URI, but we are not in a position to
> provide the service at that exact same URI, because we are running in a
> Webapp deployed at a different URI for example. I don't really like this
> use case as I think there's issues with this approach and that we should
> configure the Web container from the SCA metadata, not the other way
> around, but I guess we have to live with that for now :)  Anyway, in
> that case as well we need to figure the effective URI of the particular
> service to put it in service endpoint references for example.
>
> For both scenarios, I'd suggest methods like this:
>
> ServletHost.getRequestURI(String mapping) -> giving you the complete URI
> that people will have to send requests to
> or
> ServletHost.getServletPath(String mapping) -> giving you the actual URI
> at which the particular servlet is available
>
> Both methods are modeled after the Servlet API interface, and will give
> you what you need (assuming I correctly guessed the scenarios you're
> after) in a simpler way than a getBaseURI() method which would still
> require the binding to combine that base URI with the rest of the URI
> that it knows about.


There's also a 3rd case where the binding uses a default or relative uri
which the runtime can honour and things like ?wsdl still need to be able to
advertise the actual endpoint. Anyway from those three cases it seems like a
way to get his from the ServletHost is valid thing to have.

>From the perspective of whats the simplest way to code this for the ws
binding as-is now i suspect a method that returns a complete url from a
mapping may not be so easy to use with the current Axis2 code. This area has
changed a lot with Axis2 1.3 though so it may depend on if we move up to
Axis2 1.3. We'd also have to have all the code to work out the actual ip
address or host name for use by the Jetty and Tomcat standalone
ServletHosts.

How about we just have a  ServletHost getContextPath() modeled after the
Servlet APIs getContextPath method?

   ...ant

Reply via email to