Jetty eclipse setup
The process enumerated below should remain more-or-less the same for different versions of Jetty and Eclipse. The name is not significant, you can name it anything as long as it makes sense. This project is the one that will be used to launch Jetty as an application from within Eclipse.
Copy the necessary files from the Jetty 6. The project tree should now look somewhat like this:. Right-click on the project name, select Properties in the popup menu to get the properties dialog box. Add start. Create your Web application as a separate project under the same Eclipse workspace. The folder structure of a sample Web application is as provided below:. You need to make sure that the Web application project defines a web root folder for setup with Jetty. One nice thing about Jetty 6.
To make use of this feature, create a file called sampleapp. The contents of this file should look somewhat like this:. Note that relative path names are allowed for the contextPath attribute. From the main menubar select Run and Run … to bring up the configuration dialog box. Create a new run configuration under Java Application as shown below:. The main class to launch is org. Save the settings by clicking on the Apply button.
Now press Run to start the Jetty server. If everything goes fine, you will see the Jetty output in the Eclipse console pane. For mid-sized development teams, repeating the above steps on multiple desktops can be a time consuming and error-prone process. See the original article here. Integration Zone. Thanks for visiting DZone today,. Edit Profile. Sign Out View Profile. Over 2 million developers have joined DZone. Jetty and Eclipse Integration in 3 Steps. Like 0.
Join the DZone community and get the full member experience. For its security layer, it uses java nio SslEngine. You can configure these two connectors similarly; the difference is in the implementation.
The following is an example of an SslSelectChannelConnector configuration. You can configure an SslSocketConnector the same way—just change the value of the class to org. If there is no value for the truststore , the system uses the keystore value.
You can obfuscate passwords by using the Jetty password utility. The keystore file in the example above is given relative to the jetty home directory. For production, choose a private directory with restricted access to keep your keystore in. Even though it has a password on it, the password may be configured into the runtime environment so is vulnerable to theft. You can now start Jetty the normal way make sure that jcert. Remember that the default port for https is not 80, so change to if you want to be able to use URLs without explicit port numbers.
For a production site it normally makes sense to have an HttpListener on port 80 and a SunJsseListener on port Because these are privileged ports, you might want to use a redirection mechanism to map port 80 to, for example, and to, for example, For details on this, see Accessing Port 80 as a non-Root User.
This is done in web. Then you need to tell the plain http connector if the users try to access that webapp using plain http, they should be redirected to the port of your ssl connector the "confidential port" :.
That's it. For instructions on configuring SSL for versions earlier than Jetty 7. If the configuration does not include passwords, you can provide them as as java properties jetty. Remember that putting your password on the command line is a security risk. You can also set them as properties within the config file, but this risks accidental discovery by developers.
If jetty is given a password that begins with "OBF:" it is treated as an obfuscated password. You can obfuscated passwords by running org. Password as a main class. This can protect passwords from casual observation. See Secure Passwords for more details. If you are updating your configuration to use a newer certificate, as when the old one is expiring, just load the newer certificate as described in the section, Loading Keys and Certificates. If you imported the key and certificate originally using the PKCS12 method, use an alias of "1" rather than "jetty", because that is the alias the PKCS12 process enters into the keystore.
This page was last modified , 7 January by Wim Jongman.