You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jpv <jp...@gmail.com> on 2011/03/08 22:51:34 UTC

Virtual host (?) with jetty standalone (RS + WS) - need help !

well, well, well.... really need help for that stuff : 2 webservices (1
jax-rs, 1 jax-ws) published on http://localhost:8080/json and 
http://localhost:8080/soap. I want to deploy theses two services on multiple
IP, URL (e.g http://172.xx.yy..:8080/json (/soap),
http://myservice.mycompagn.org/json .... etc). With a ".war", i can use
virtualHost configured in xml config file. Not this time, i want to do
everything in java. But ..... hell !
Any ideas ?

		JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
		sf.setResourceClasses(MyRest4json.class);
		sf.setAddress("http://myaddress:" + port + "/json");
		sf.create();

		Object implementor = new MySOAPClassImpl();
		Endpoint ep = Endpoint.publish("http://myaddress:" + port + "/soap",
implementor);		
		EndpointImpl epImpl = (org.apache.cxf.jaxws.EndpointImpl) ep;
		SOAPBinding soap = (SOAPBinding) ep.getBinding();
		soap.setMTOMEnabled(true);
                .........
                // Here the server is running both for REST and SOAP, fast,
light, easy ...
               //  but virtualHosting ? How ? 



--
View this message in context: http://cxf.547215.n5.nabble.com/Virtual-host-with-jetty-standalone-RS-WS-need-help-tp3414715p3414715.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Virtual host (?) with jetty standalone (RS + WS) - need help !

Posted by jpv <jp...@gmail.com>.
well, well, well. Searching in your direction .....


        // the server
        JettyHTTPServerEngineFactory eg = new
JettyHTTPServerEngineFactory();
        eg.createJettyHTTPServerEngine(8080,"http");

       // jax-rs
       JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
       sf.setResourceClasses( MyRest4json.class);
       sf.setAddress("http://myaddress <http://myaddress/>:" + port +
"/json");
       sf.create();

      // soap
      Object implementor = new MySOAPClassImpl();
      Endpoint ep = Endpoint.publish("http://myaddress:" + port + "/soap",
implementor);
      EndpointImpl epImpl = (org.apache.cxf.jaxws.EndpointImpl) ep;
      SOAPBinding soap = (SOAPBinding) ep.getBinding();
      soap.setMTOMEnabled(true);

     ......

And ..... it just works both on localhost:8080, http://127.0.0.1 and ...
http://192.168......:8080.
I'm on holidays (at home) so i can't test it with DNS and proxy/reverse
proxy and all this kind of stuff.
It seems to work properly. I will put a message somewhere in the mailing
because i'm sure this will be helpfull for somebody else.

Anyway : THANKS A MILLION Daniel !





2011/3/8 Daniel Kulp [via CXF] <
ml-node+3414750-2085704353-151180@n5.nabble.com>

>
> From Java, I THINK you can do something like:
>
> bus.getExtention(JettyHTTPServerEngine.class)
>      .createJettyHTTPServerEngine(null, 8080, "http");
>
> and that will create the connector for the port on all hosts, not the one
> for
> the passed in host.    Not 100% sure though.
>
> Dan
>
>
>
> On Tuesday 08 March 2011 4:51:34 PM jpv wrote:
>
> > well, well, well.... really need help for that stuff : 2 webservices (1
> > jax-rs, 1 jax-ws) published on http://localhost:8080/json and
> > http://localhost:8080/soap. I want to deploy theses two services on
> > multiple IP, URL (e.g http://172.xx.yy..:8080/json (/soap),
> > http://myservice.mycompagn.org/json .... etc). With a ".war", i can use
> > virtualHost configured in xml config file. Not this time, i want to do
> > everything in java. But ..... hell !
> > Any ideas ?
> >
> > JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
> > sf.setResourceClasses(MyRest4json.class);
> > sf.setAddress("<a href="http://myaddress:&quot;" added>http://myaddress:" +
> port + "/json");
> > sf.create();
> >
> > Object implementor = new MySOAPClassImpl();
> > Endpoint ep = Endpoint.publish("<a href="http://myaddress:&quot;" added>
> http://myaddress:" + port + "/soap",
> > implementor);
> > EndpointImpl epImpl = (org.apache.cxf.jaxws.EndpointImpl) ep;
> > SOAPBinding soap = (SOAPBinding) ep.getBinding();
> > soap.setMTOMEnabled(true);
> >                 .........
> >                 // Here the server is running both for REST and SOAP,
> fast,
> > light, easy ...
> >                //  but virtualHosting ? How ?
> >
> >
> >
> > --
> > View this message in context:
> >
> http://cxf.547215.n5.nabble.com/Virtual-host-with-jetty-standalone-RS-WS-n<http://cxf.547215.n5.nabble.com/Virtual-host-with-jetty-standalone-RS-WS-n?by-user=t>
> > eed-help-tp3414715p3414715.html Sent from the cxf-user mailing list
> archive
> > at Nabble.com.
>
> --
> Daniel Kulp
> [hidden email]<http://user/SendEmail.jtp?type=node&node=3414750&i=0&by-user=t>
> http://dankulp.com/blog
> Talend - http://www.talend.com
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://cxf.547215.n5.nabble.com/Virtual-host-with-jetty-standalone-RS-WS-need-help-tp3414715p3414750.html
>  To unsubscribe from Virtual host (?) with jetty standalone (RS + WS) -
> need help !, click here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3414715&code=anBodmF5QGdtYWlsLmNvbXwzNDE0NzE1fDE0NDE2MjAzMTk=>.
>
>



-- 
Jean Philippe VAY http://www.linkedin.com/in/jpvay


--
View this message in context: http://cxf.547215.n5.nabble.com/Virtual-host-with-jetty-standalone-RS-WS-need-help-tp3414715p3415186.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Virtual host (?) with jetty standalone (RS + WS) - need help !

Posted by Daniel Kulp <dk...@apache.org>.
From Java, I THINK you can do something like:

bus.getExtention(JettyHTTPServerEngine.class)
     .createJettyHTTPServerEngine(null, 8080, "http");

and that will create the connector for the port on all hosts, not the one for 
the passed in host.    Not 100% sure though.

Dan



On Tuesday 08 March 2011 4:51:34 PM jpv wrote:
> well, well, well.... really need help for that stuff : 2 webservices (1
> jax-rs, 1 jax-ws) published on http://localhost:8080/json and
> http://localhost:8080/soap. I want to deploy theses two services on
> multiple IP, URL (e.g http://172.xx.yy..:8080/json (/soap),
> http://myservice.mycompagn.org/json .... etc). With a ".war", i can use
> virtualHost configured in xml config file. Not this time, i want to do
> everything in java. But ..... hell !
> Any ideas ?
> 
> 		JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
> 		sf.setResourceClasses(MyRest4json.class);
> 		sf.setAddress("http://myaddress:" + port + "/json");
> 		sf.create();
> 
> 		Object implementor = new MySOAPClassImpl();
> 		Endpoint ep = Endpoint.publish("http://myaddress:" + port + "/soap",
> implementor);
> 		EndpointImpl epImpl = (org.apache.cxf.jaxws.EndpointImpl) ep;
> 		SOAPBinding soap = (SOAPBinding) ep.getBinding();
> 		soap.setMTOMEnabled(true);
>                 .........
>                 // Here the server is running both for REST and SOAP, fast,
> light, easy ...
>                //  but virtualHosting ? How ?
> 
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Virtual-host-with-jetty-standalone-RS-WS-n
> eed-help-tp3414715p3414715.html Sent from the cxf-user mailing list archive
> at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com