Ah, my mistake. I was focusing on the port parm to addServletMapping and overlooked the if(state == STARTING) part. Wouldn't it be better to set the httpPort separately?
On 4/16/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote:
Ignacio Silva-Lepe wrote: > Perhaps I don't understand jetty as well as I thought or I am missing > your > idea here but why does the JettyServer create and start a new Jetty > server > every time a servlet mapping is added? IIRC, previously JettyServiceImpl > used to start one Jetty server and register every new servlet that was > added > with this server. It seems to me that now we may be wasting resources, > e.g., http ports. > > > On 4/15/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote: >> >> I just made some changes to the tuscany-http-* modules to allow servlets >> to be registered with a Tomcat or Jetty server. I guess this is going to >> be useful in Servlet based bindings like the WebService or JSONRPC >> bindings. >> >> Here's how to use this capability. >> >> In a binding, do this: >> ExtensionPointRegistry extensionPointRegistry; <-- passed to your >> ModuleActivator start method. >> ServletHostExtensionPoint servletHosts = >> extensionPointRegistry.getExtensionPoint( ServletHostExtensionPoint.class); >> >> servletHosts.addServletMapping(yourServlet); >> >> The ServletHost interface from module tuscany-http replaces the old >> ServletHost interface from tuscany-core-spi, which will have to be >> deleted. >> >> In a sample or integration test: >> - Add the tuscany-http-tomcat or tuscany-http-jetty to your >> dependencies, depending on which server you want to use. >> >> Here's how it works: >> - I have defined ServletHostExtensionPoint in tuscany-http. That module >> contributes the extension point in its ModuleActivator. >> - The tuscany-http-jetty and tuscany-http-tomcat respectively register >> in this extension point their ServletHost extensions. >> >> More to do later: >> - change the addServletMapping to take more configuration info (like the >> HTTPS port number for example). >> - add logic to the ServletHostExtensionPoint to handle multiple >> ServletHosts and select the best one from what's passed to >> addServletMapping. >> >> Hope this helps... >> >> -- >> Jean-Sebastien >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > Hi Ignacio. Are you actually seeing a new server getting created each time a servlet mapping is added? The server should only start the first time you add a servlet mapping, not each time... or that would be a bug :) but I'm not sure how this could happen as the second start would fail anyway with a "port already in use" error... Do you have a test case that shows this problem? -- Jean-Sebastien --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
