You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Conficio <Ka...@Conficio.com> on 2011/07/26 15:34:35 UTC

Re: separate CXFServlet for private API's (solution?)

Thanks Dan,
2.4.1 does seem to improve things a lot.

I got it working as you hint on and did not need to subclass CXFServlet.

Here is web.xml
{code}
<web-app>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/globalContext.xml</param-value>
	</context-param>
 	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

	<servlet>
		<servlet-name>PublicCXFServlet</servlet-name>
		<display-name>Public CXF Servlet</display-name>
		<servlet-class>
			org.apache.cxf.transport.servlet.CXFServlet
		</servlet-class>
		<init-param>
      		<param-name>config-location</param-name>
      		<param-value>/WEB-INF/beans-public.xml</param-value>    
    	</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>PublicCXFServlet</servlet-name>
		<url-pattern>/public/*</url-pattern>
	</servlet-mapping>

	<servlet>
		<servlet-name>PrivateCXFServlet</servlet-name>
		<display-name>Private CXF Servlet</display-name>
		<servlet-class>
			org.apache.cxf.transport.servlet.CXFServlet
		</servlet-class>
		<init-param>
      		<param-name>config-location</param-name>
      		<param-value>/WEB-INF/beans-private.xml</param-value>    
    	</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>PrivateCXFServlet</servlet-name>
		<url-pattern>/private/*</url-pattern>
	</servlet-mapping>
</web-app>
{/code}
and here my public beans as an example
{code}
	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

	<cxf:bus name="public"/>
	
	<jaxws:endpoint 
	  id="helloWorld" 
	  implementor="demo.spring.HelloWorldImpl" 
	  address="/HelloWorld" />
{/code}
I even found that it appears the <cxf:bus .../> clause is optional. It
appears to be working (in the sample derived from java-first-spring) with
all services being on the default bus "cxf". Is there any advantage to
separate the busses?

K<o>
P.S.: Would you like me to submit my example for inclusion in the CXF
samples?

--
View this message in context: http://cxf.547215.n5.nabble.com/separate-CXFServlet-for-private-API-s-tp3261355p4634799.html
Sent from the cxf-user mailing list archive at Nabble.com.