You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Luciano Resende <lu...@gmail.com> on 2009/10/18 08:20:47 UTC

Strange behavior with WebApps service uris

For some reason, I'm finding a strange behavior on the way webAppHost
is registering service uris.

	<component name="Catalog">
		<implementation.java class="services.VegetablesCatalogImpl"/>
		<property name="currencyCode">USD</property>
		<service name="Catalog">
		    <interface.java interface="services.Catalog"/>
			<tuscany:binding.jsonrpc uri="http://localhost:8080/<APP CONTEXT
ROOT>/Catalog"/>
   		</service>
		<reference name="currencyConverter" target="CurrencyConverter"/>	
	</component>

In the scenario above, the service is only being available via the
following uri : http://localhost:8080/context root/context
root/service uri...

This seems to be happening because the context path was not being
set... I'm not sure if this was on purpose or not, but I have added
the code to configure the contextPath back (svn r826364), so please
give it a quick look and let me know if you think this was not the
right approach to fix the issue.


-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Strange behavior with WebApps service uris

Posted by Luciano Resende <lu...@gmail.com>.
On Sun, Oct 18, 2009 at 1:22 AM, ant elder <an...@gmail.com> wrote:
>
>
> On Sun, Oct 18, 2009 at 7:20 AM, Luciano Resende <lu...@gmail.com>
> wrote:
>>
>> For some reason, I'm finding a strange behavior on the way webAppHost
>> is registering service uris.
>>
>>        <component name="Catalog">
>>                <implementation.java
>> class="services.VegetablesCatalogImpl"/>
>>                <property name="currencyCode">USD</property>
>>                <service name="Catalog">
>>                    <interface.java interface="services.Catalog"/>
>>                        <tuscany:binding.jsonrpc
>> uri="http://localhost:8080/<APP CONTEXT
>> ROOT>/Catalog"/>
>>                </service>
>>                <reference name="currencyConverter"
>> target="CurrencyConverter"/>
>>        </component>
>>
>> In the scenario above, the service is only being available via the
>> following uri : http://localhost:8080/context root/context
>> root/service uri...
>>
>> This seems to be happening because the context path was not being
>> set... I'm not sure if this was on purpose or not, but I have added
>> the code to configure the contextPath back (svn r826364), so please
>> give it a quick look and let me know if you think this was not the
>> right approach to fix the issue.
>>
>
> In your scenario with the code you've just added which bit of code is
> actually doing the setting of the context path - the
> "config.getServletContext()", the method invoked by reflection, or the
> setting from the init parameter?
>
>    ...ant
>

I'm not using init parameter for the contextPath, so in my scenario,
the code executed is:

// Try to get the method anyway since some ServletContext impl has
this method even before 2.5
Method m = context.getClass().getMethod("getContextPath", new Class[] {});
contextPath = (String)m.invoke(context, new Object[] {});

-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Strange behavior with WebApps service uris

Posted by ant elder <an...@gmail.com>.
On Sun, Oct 18, 2009 at 7:20 AM, Luciano Resende <lu...@gmail.com>wrote:

> For some reason, I'm finding a strange behavior on the way webAppHost
> is registering service uris.
>
>        <component name="Catalog">
>                <implementation.java
> class="services.VegetablesCatalogImpl"/>
>                <property name="currencyCode">USD</property>
>                <service name="Catalog">
>                    <interface.java interface="services.Catalog"/>
>                        <tuscany:binding.jsonrpc uri="
> http://localhost:8080/<APP CONTEXT
> ROOT>/Catalog"/>
>                </service>
>                <reference name="currencyConverter"
> target="CurrencyConverter"/>
>        </component>
>
> In the scenario above, the service is only being available via the
> following uri : http://localhost:8080/context root/context
> root/service uri...
>
> This seems to be happening because the context path was not being
> set... I'm not sure if this was on purpose or not, but I have added
> the code to configure the contextPath back (svn r826364), so please
> give it a quick look and let me know if you think this was not the
> right approach to fix the issue.
>
>
In your scenario with the code you've just added which bit of code is
actually doing the setting of the context path - the
"config.getServletContext()", the method invoked by reflection, or the
setting from the init parameter?

   ...ant