Change the default port in Jetty

The Using Embedded Jetty server entry talks about how to embed a Jetty server using Maven in web application. By default the embedded Jetty server starts at port 8080, some times you might want to change it so that it listens on different HTTP port. I wanted to get Jetty to listen on different port and this is how i configured it


      <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">

In this code the connectors element is used for configuring the new port number, in my case i changed it to use port 9000. In the version 6.1 code you would have to configure Jetty like this, name of the SelectorChannelConnector package was different before it was moved to eclipse

<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">

No comments: