javaee / metro-jaxws-commons

Metro has been contributed to Eclipse Foundation. This repository is for legacy review only. Please refer to the Eclipse EE4J Metro project for the very latest
https://eclipse-ee4j.github.io/metro-wsit/
Other
10 stars 9 forks source link

SpringService.ContainerWrapper must handle getSPI(ServletContext.class) #14

Closed glassfishrobot closed 16 years ago

glassfishrobot commented 16 years ago

When trying to use an XWSS 2.0 style configuration file (/WEB-INF/server_security_config.xml) for my Metro 1.0.1 service endpoint implementation using JAX-WS Commons Spring integration and Provider, but does not provide/reference any WSDL, Metro simply did not take my XWSS security config into account.

I tracked this behavior down to the following issue in com.sun.xml.ws.assembler.PipelineAssemblerFactoryImpl (line 728 in Metro 1.0.1 source code):

ServletContext ctxt = context.getEndpoint().getContainer().getSPI(ServletContext.class);

It turned out that JAX-WS Commons Spring integration uses a SpringService.ContainerWrapper implementation which is unable to return a ServletContext (but instead returns null), as no default Container will be available in class SpringService:

// TODO: how to set the default container? public void setContainer(Container container)

{ this.container = container; }

Luckily, we have the correct ServletContext available in SpringService

I therefore suggest the following two small changes to class SpringService:

1) Add a getter method for the ServletContext instance:

public ServletContext getServletContext()

{ return servletContext; }

2) Take special care of ServletContexts in the ContainerWrapper (inner class):

if(spiType==TubelineAssemblerFactory.class)

{ (... omitted by intention ...) // take special care of requests for the ServletContext }

else if(spiType==ServletContext.class)

{ return spiType.cast(getServletContext()); }

if(container!=null)

{ (... omitted by intention ...) }

After applying these two changes, my Provider endpoint has been able to successfully pick up /WEB-INF/server_security_config.xml and configure its XWSSServerPipe.

After fixing this, please be so kind as to post a new release of the JAX-WS Commons Spring integration, such that we can return to using an officially released version.

Many thanks in advance and best regards,

Andreas

– Andreas Loew Java Architect Sun Microsystems (Germany)

Environment

Operating System: All Platform: All

Affected Versions

[current]

glassfishrobot commented 16 years ago

Reported by al130959@java.net

glassfishrobot commented 16 years ago

kohsuke@java.net said: Thanks for the patch and apologies for the delay. Fixed in 1.8.

glassfishrobot commented 16 years ago

Was assigned to kohsuke@java.net

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAX_WS_COMMONS-14

glassfishrobot commented 16 years ago

Marked as fixed on Tuesday, January 15th 2008, 3:28:07 am