You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Lin Sun <li...@gmail.com> on 2007/01/30 06:33:43 UTC

url-pattern issue during Axis2 integration

Hi there,

I have been working on one particular issue related to Axis2 integration
into Geronimo.  Basically the problem is that in the jaxws test, we had to
use /services/* as the url-pattern for the servlet:

<servlet-mapping>
        <servlet-name>cxfPojoServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
</servlet-mapping>

This is invalid per JSR 109 spec.  There are two problems here:

First, a user will have to use /services as part of the url-pattern.  After
digging into this prob, I found out that the axis2 configurationcontext
default the servicePath to 'services'.   One fix that I can think of
(without a lot of work) is to use the configurationContext.setServicePath
method to override the default 'services' value.  This looks okay to me as
we are building one configurationcontext and one axisservice per
endpointClass.

To do this, I will have to either set url-pattern for the user when none is
specified for the servlet/Implclass, or grab the url-pattern from web.xml.
So I have been studying on how to get the url-pattern for a particular
servlet from Geronimo.  One approach I can think of is:
1) inside Axis2Builder, the module object is passed in when configurePOJO is
called.
2) then I can get the getOriginalSpecDD from webmodule, then use
webModuleBuilder.convertToServletSchema to get the webAppType object.  
3) I can then get the url-pattern from webApp.getServletMappingArray() with
some processing.   

This seems rather complicated to me so please let me know if there is a
better way to do it.  

Second, the url-pattern of the servlet-mapping must be an exact match
pattern (* is not permitted).   I tried to remove the * but I would get 404
when I issue ?wsdl from the browser.  I think this is something we may have
to write code to work around the spec requirement, as a user needs to be
able to run ?wsdl calls using different syntax (like GreeterImpl?wsdl or
test?wsdl...).   For example, a user can only specify 1 (or 0)
servlet-mapping and url-pattern for one servlet in web.xml, but the Axis2
integration code can add other url-patterns to the web deployment plan
(web.xml). I am wondering if there is anyway to overwrite the in- memory
version of servlet-mapping or url-pattern for Geronimo to use (of course,
don't overwrite the original web.xml)?  

Reference doc:
JSR 109 rev 1.2 Page 61 (sec 7.1.2) where it says:
--//--
Servlet Mapping. A developer may optionally specify a servlet-mapping,
In the web.xml deployment descriptor, for a JAX-RPC or JAX-WS Service
Endpoint.
No more than one servlet-mapping may be specified for a servlet that is
linked to by a port-component.
The url-pattern of the servlet-mapping must be an exact match pattern
 (i.e. it must not contain an asterisk ("*")).
--//--

Thanks for any input in advance!

Lin


Re: url-pattern issue during Axis2 integration

Posted by Jarek Gawor <jg...@gmail.com>.
Lin Sun,

When WebServicesBuilder.findWebServices() is called, the 3rd argument
(Map servletLocations) contains the mapping between the servlet-name
and its context location. For example, there would be a mapping of
'cxfPojoServlet' to '/<war name>/services' or something similar.

Jarek

On 1/30/07, Lin Sun <li...@gmail.com> wrote:
> Hi there,
>
> I have been working on one particular issue related to Axis2 integration
> into Geronimo.  Basically the problem is that in the jaxws test, we had to
> use /services/* as the url-pattern for the servlet:
>
> <servlet-mapping>
>         <servlet-name>cxfPojoServlet</servlet-name>
>         <url-pattern>/services/*</url-pattern>
> </servlet-mapping>
>
> This is invalid per JSR 109 spec.  There are two problems here:
>
> First, a user will have to use /services as part of the url-pattern.  After
> digging into this prob, I found out that the axis2 configurationcontext
> default the servicePath to 'services'.   One fix that I can think of
> (without a lot of work) is to use the configurationContext.setServicePath
> method to override the default 'services' value.  This looks okay to me as
> we are building one configurationcontext and one axisservice per
> endpointClass.
>
> To do this, I will have to either set url-pattern for the user when none is
> specified for the servlet/Implclass, or grab the url-pattern from web.xml.
> So I have been studying on how to get the url-pattern for a particular
> servlet from Geronimo.  One approach I can think of is:
> 1) inside Axis2Builder, the module object is passed in when configurePOJO is
> called.
> 2) then I can get the getOriginalSpecDD from webmodule, then use
> webModuleBuilder.convertToServletSchema to get the webAppType object.
> 3) I can then get the url-pattern from webApp.getServletMappingArray() with
> some processing.
>
> This seems rather complicated to me so please let me know if there is a
> better way to do it.
>
> Second, the url-pattern of the servlet-mapping must be an exact match
> pattern (* is not permitted).   I tried to remove the * but I would get 404
> when I issue ?wsdl from the browser.  I think this is something we may have
> to write code to work around the spec requirement, as a user needs to be
> able to run ?wsdl calls using different syntax (like GreeterImpl?wsdl or
> test?wsdl...).   For example, a user can only specify 1 (or 0)
> servlet-mapping and url-pattern for one servlet in web.xml, but the Axis2
> integration code can add other url-patterns to the web deployment plan
> (web.xml). I am wondering if there is anyway to overwrite the in- memory
> version of servlet-mapping or url-pattern for Geronimo to use (of course,
> don't overwrite the original web.xml)?
>
> Reference doc:
> JSR 109 rev 1.2 Page 61 (sec 7.1.2) where it says:
> --//--
> Servlet Mapping. A developer may optionally specify a servlet-mapping,
> In the web.xml deployment descriptor, for a JAX-RPC or JAX-WS Service
> Endpoint.
> No more than one servlet-mapping may be specified for a servlet that is
> linked to by a port-component.
> The url-pattern of the servlet-mapping must be an exact match pattern
>  (i.e. it must not contain an asterisk ("*")).
> --//--
>
> Thanks for any input in advance!
>
> Lin
>
>

Re: url-pattern issue during Axis2 integration

Posted by Davanum Srinivas <da...@gmail.com>.
Lin,

Isn't setServicePath("") enough to do the trick?

thanks,
dims

On 1/30/07, Lin Sun <li...@gmail.com> wrote:
> Hi there,
>
> I have been working on one particular issue related to Axis2 integration
> into Geronimo.  Basically the problem is that in the jaxws test, we had to
> use /services/* as the url-pattern for the servlet:
>
> <servlet-mapping>
>         <servlet-name>cxfPojoServlet</servlet-name>
>         <url-pattern>/services/*</url-pattern>
> </servlet-mapping>
>
> This is invalid per JSR 109 spec.  There are two problems here:
>
> First, a user will have to use /services as part of the url-pattern.  After
> digging into this prob, I found out that the axis2 configurationcontext
> default the servicePath to 'services'.   One fix that I can think of
> (without a lot of work) is to use the configurationContext.setServicePath
> method to override the default 'services' value.  This looks okay to me as
> we are building one configurationcontext and one axisservice per
> endpointClass.
>
> To do this, I will have to either set url-pattern for the user when none is
> specified for the servlet/Implclass, or grab the url-pattern from web.xml.
> So I have been studying on how to get the url-pattern for a particular
> servlet from Geronimo.  One approach I can think of is:
> 1) inside Axis2Builder, the module object is passed in when configurePOJO is
> called.
> 2) then I can get the getOriginalSpecDD from webmodule, then use
> webModuleBuilder.convertToServletSchema to get the webAppType object.
> 3) I can then get the url-pattern from webApp.getServletMappingArray() with
> some processing.
>
> This seems rather complicated to me so please let me know if there is a
> better way to do it.
>
> Second, the url-pattern of the servlet-mapping must be an exact match
> pattern (* is not permitted).   I tried to remove the * but I would get 404
> when I issue ?wsdl from the browser.  I think this is something we may have
> to write code to work around the spec requirement, as a user needs to be
> able to run ?wsdl calls using different syntax (like GreeterImpl?wsdl or
> test?wsdl...).   For example, a user can only specify 1 (or 0)
> servlet-mapping and url-pattern for one servlet in web.xml, but the Axis2
> integration code can add other url-patterns to the web deployment plan
> (web.xml). I am wondering if there is anyway to overwrite the in- memory
> version of servlet-mapping or url-pattern for Geronimo to use (of course,
> don't overwrite the original web.xml)?
>
> Reference doc:
> JSR 109 rev 1.2 Page 61 (sec 7.1.2) where it says:
> --//--
> Servlet Mapping. A developer may optionally specify a servlet-mapping,
> In the web.xml deployment descriptor, for a JAX-RPC or JAX-WS Service
> Endpoint.
> No more than one servlet-mapping may be specified for a servlet that is
> linked to by a port-component.
> The url-pattern of the servlet-mapping must be an exact match pattern
>  (i.e. it must not contain an asterisk ("*")).
> --//--
>
> Thanks for any input in advance!
>
> Lin
>
>


-- 
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers