Jetty Development (2)

Source: Internet
Author: User

Deploying Web Apps

The jetty server instance that is configured with the deployment module is able to hot deploy Web apps in the WebApps directory. In the WebApps directory, the standard war packages and jetty configuration files can be hot deployed into the server and need to comply with the following rules:

    • The example/directory is automatically deployed, and if the directory contains web-inf/subdirectories, it will be used as a Web application, or as a static content directory. His access path is/example (that is, http://localhost:8080/example/), unless your directory is named root (case sensitive), then the access path is/. If the directory name ends with ". D", the directory will be processed as a configuration directory.
    • The war package named Example.war will be deployed as a web app that accesses the path to/example (that is, http://localhost:8080/example/). If the war name is root (case sensitive), then the access path is/. If Example.war and example/exist at the same time, only the war packets will be valid (because directories with the same name will be overwritten as the archive of the war package).
    • The configuration of the access path can be made through XML, which must contain the context path configuration and, if there is an XML file with the same name as the war package, takes precedence over XML as the configuration of the application.

If you have a Web application, you can copy it directly to the WebApps directory for hot deployment.

Demo Demo program for Jetty

The following deployable and configuration files are included in the Demo-base/webapps directory:

ROOT/

This is a static content directory, the access path is/, which contains the Jetty Demo program Welcome page.

test.xml

This is a configuration file for configuring and deploying the Test.war Web application, which configures the access path configuration and loads additional profile paths, such as setting up the TEST.D directory.

test.war

This is a Web application configured by Test.xml.

test.d

This directory contains additional configuration that is used by test.xml and injected into the configuration of the Test.war application.

async-rest.war

An ebay restful asynchronous web app that automatically deploys after the access path is/async-test.

test-jaas.war

A Web application that uses the Jaas security validation framework.

test-jaas.xml

A file about the context configuration of the Test-jaas.war. Additional configuration includes boot Loginservice for authorization and authentication.

test-jndi.war

Show the Web App demo program using Jndi.

test-jndi.xml

配置test-jndi.war上下文的文件. The additional configuration contains objects defined in the namespace that are referenced by the Web App.

test-spec.war

The demo program shows the use of annotations, fragments, servletcontainerinitializers and other servlet3.0/3.1 features.

test-spec.xml

Configures the configuration file for the Test-spec.war context path. Additional configuration includes starting some annotations that need to be referenced in the namespace.

xref-proxy.war

A xref directory service that uses transparent proxies from the jetty Src of the Eclipse website.

example-moved.xml
Demonstrates how to use Movedcontexthandler to redirect Web App demo programs to another path.
Using Maven in Jetty

Jetty has been in Maven's central repository since MAVEN was founded, and over the years there have been several different maven coordinates, the GroupID used when jetty in SourceForge and Codehaus communities org.mortbay.jetty . When Jetty7 joined the Eclipse Foundation, a new GroupID was used. The POM is shown below:

<Dependency>  <groupId>Org.eclipse.jetty</groupId>  <Artifactid>Jetty-project</Artifactid>  <version>${project.version}</version></Dependency>

Jetty Development (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.