Issue #5264 Demo modules

Create modules in jetty-home to download and deploy demos
This commit is contained in:
gregw 2020-09-17 15:00:47 +02:00
parent f3f918ade2
commit 52a0fdfbfa
20 changed files with 896 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
A meta module to enable all demo modules.
[tags]
demo
[depends]
http
https
http2
webapp-root
webapp-async-rest
webapp-test-spec
test-keystore
work
demo-rewrite
demo-moved-context
[files]
maven://org.eclipse.jetty.example-async-rest/example-async-rest-webapp/${jetty.version}/war|webapps/async-rest.war
[ini-template]
# Websocket chat examples needs websocket enabled
# Don't start for all contexts (set to true in test.xml context)
org.eclipse.jetty.websocket.jsr356=false

View File

@ -0,0 +1,14 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Demonstrate a Moved Context Handler.
[tags]
demo
[depends]
deploy
[files]
basehome:modules/demo.d/demo-moved-context.xml|webapps/demo-moved-context.xml

View File

@ -0,0 +1,17 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Demonstrate the rewrite module.
[tags]
demo
[depends]
rewrite
[xml]
etc/demo-rewrite-rules.xml
[files]
basehome:modules/demo.d/demo-rewrite-rules.xml|etc/demo-rewrite-rules.xml

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_9_3.dtd">
<!-- Simple handler to redirect from old path to new -->
<Configure class="org.eclipse.jetty.server.handler.MovedContextHandler">
<Set name="contextPath">/oldContextPath</Set>
<Set name="newContextURL">/test/dump/moved</Set>
<Set name="permanent">false</Set>
<Set name="discardPathInfo">false</Set>
<Set name="discardQuery">false</Set>
<Set name="expires">-1</Set>
</Configure>

View File

@ -0,0 +1,104 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- =============================================================== -->
<!-- Configure the demos -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- ============================================================= -->
<!-- Add rewrite rules -->
<!-- ============================================================= -->
<Ref refid="Rewrite">
<!-- Add rule to protect against IE ssl bug -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.MsieSslRule"/>
</Arg>
</Call>
<!-- protect favicon handling -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
<Set name="pattern">/favicon.ico</Set>
<Set name="name">Cache-Control</Set>
<Set name="value">Max-Age=3600,public</Set>
<Set name="terminating">true</Set>
</New>
</Arg>
</Call>
<!-- redirect from the welcome page to a specific page -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
<Set name="pattern">/test/rewrite/</Set>
<Set name="replacement">/test/rewrite/info.html</Set>
</New>
</Arg>
</Call>
<!-- replace the entire request URI -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
<Set name="pattern">/test/some/old/context</Set>
<Set name="replacement">/test/rewritten/newcontext</Set>
</New>
</Arg>
</Call>
<!-- replace the beginning of the request URI -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
<Set name="pattern">/test/rewrite/for/*</Set>
<Set name="replacement">/test/rewritten/</Set>
</New>
</Arg>
</Call>
<!-- reverse the order of the path sections -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewriteRegexRule">
<Set name="regex">(.*?)/reverse/([^/]*)/(.*)</Set>
<Set name="replacement">$1/reverse/$3/$2</Set>
</New>
</Arg>
</Call>
<!-- add a cookie to each path visited -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.CookiePatternRule">
<Set name="pattern">/*</Set>
<Set name="name">visited</Set>
<Set name="value">yes</Set>
</New>
</Arg>
</Call>
<!-- actual redirect, instead of internal rewrite -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
<Set name="pattern">/test/redirect/*</Set>
<Set name="location">/test/redirected</Set>
</New>
</Arg>
</Call>
<!-- add a response rule -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.ResponsePatternRule">
<Set name="pattern">/400Error</Set>
<Set name="code">400</Set>
<Set name="message">ResponsePatternRule Demo</Set>
</New>
</Arg>
</Call>
</Ref>
</Configure>

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,71 @@
<html xmlns=\ "http://www.w3.org/1999/xhtml\" xml:lang=\"en\">
<head>
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache,no-store">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
<title>Welcome to Jetty-9</title>
<style type="text/css" title="jetty">
@import url(jetty.css);
</style>
</head>
<body>
<div id="header"></div>
<div id="content">
<h1>Welcome to Jetty 10</h1>
<p>
The Jetty project is a 100% Java <a
href="http://en.wikipedia.org/wiki/Java_Servlet">Servlet</a>
Container which supports asynchronous server and client
implementations of the <a href="http://en.wikipedia.org/wiki/HTTP">HTTP</a>,
<a href="http://en.wikipedia.org/wiki/WebSocket">Websocket</a> and <a
href="http://en.wikipedia.org/wiki/HTTP/2">HTTP/2</a> protocols. The
project is 100% <a href="http://en.wikipedia.org/wiki/Open_source">Open Source</a> and hosted by the <a href="http://www.eclipse.org">Eclipse Foundation</a> at <a href="http://www.eclipse.org/jetty/">http://www.eclipse.org/jetty</a>.
</p>
</div>
<div id="links">
<table>
<tr>
<td>
<h2>tests ...</h2>
<ul>
<li><a href="/test/">Test Jetty Webapp</a></li>
<li><a href="/test-spec/">Servlet 4.0 Test</a></li>
<li><a href="/test-jaas/">JAAS Test</a></li>
<li><a href="/test-jndi/">JNDI Test</a></li>
<li><a href="/async-rest/">Async Rest</a></li>
<li><a href="/oldContextPath/">Redirected Context</a></li>
</ul>
</td>
<td>
<h2>information ...</h2>
<ul>
<li><a href="http://www.eclipse.org/jetty/">Jetty Homepage</a></li>
<li><a href="http://www.eclipse.org/jetty/documentation/current">Jetty Documentation</a> (<a href="/doc/">local</a>)</li>
<li><a href="/proxy/current/">Javadoc</a> (via transparent proxy)</li>
<li><a
href="http://www.eclipse.org/jetty/powered">Jetty Powered</a></li>
</ul>
</td>
<td>
<h2>getting&nbsp;help ...</h2>
<ul>
<li><a href="http://www.eclipse.org/jetty/mailinglists.php">Mailing lists @ eclipse</a></li>
<li><a href="http://www.webtide.com/advice/">Developer Advice</a></li>
<li><a href="http://www.webtide.com/development">Custom Development</a></li>
<li><a href="http://www.webtide.com/support">Production support</a></li>
</ul>
</td>
</tr>
</table>
</div>
<div id='blog'>
<h1>Jetty Blog</h1>
<iframe src="https://webtide.com/blog.jsp" />
</div>
</body>
</html>

View File

@ -0,0 +1,351 @@
BODY
{
font-family: Arial, Helvetica, sans-serif;
background-color: #FFFFFF;
font-size: 10pt;
color: #666666;
}
img
{
border: 0px;
}
div#header
{
clear: both;
background-image: url('images/jetty-header.jpg');
background-repeat: no-repeat;
background-position: center;
height:200px;
border-bottom: 3px ridge #cccccc;
border-right: 3px ridge #cccccc;
border-top: 3px groove #cccccc;
border-left: 3px groove #cccccc;
width: 850px;
margin-left: auto;
margin-right: auto;
}
div#content
{
clear: both;
font-size: 10pt;
font-weight: normal;
color: #666666;
margin-top: 30px;
width: 850px;
margin-left: auto;
margin-right: auto;
}
div#links table
{
width: 850px;
}
div#links td
{
vertical-align: top;
text-align: left;
border: 2px dotted #cccccc;
padding: 8px;
background-color: #efefef;
width: 280px;
}
div#links
{
margin-top: 20px;
width: 850px;
color: #999999;
margin-left: auto;
margin-right: auto;
}
div#links h1,h2,p
{
font-size: 10pt;
font-family: sans-serif;
text-align:left;
margin: 5px;
}
div#links h1
{
font-size: 22pt;
font-weight: normal;
font-family: sans-serif;
letter-spacing: 6pt;
color: #666666;
text-align: center;
margin-top:20px;
}
div#links h2
{
font-size: 12pt;
font-weight: normal;
letter-spacing: 2pt;
color: #666666;
}
div#blog
{
margin-top: 20px;
width: 850px;
margin-left: auto;
margin-right: auto;
}
div#blog iframe
{
width: 100%;
height:350px;
border: 2px dotted #cccccc;
}
div#footer
{
clear: both;
border-top: 4px groove #cccccc;
margin-top:20px;
padding-top:10px;
width: 850px;
}
h1
{
font-size: 14pt;
text-align:center;
}
A:link
{
color: #0099cc;
text-decoration: none;
font-weight: normal;
font-size: 10pt;
font-family:sans-serif;
}
A:visited
{
color: #0099cc;
text-decoration: none;
font-weight: normal;
font-size: 10pt;
font-family:sans-serif;
}
A:hover
{
color: #ff6600;
text-decoration: none;
font-weight: normal;
font-size: 10pt;
font-family:sans-serif;
}
A:active
{
color: #0099cc;
text-decoration: none;
font-weight: normal;
font-size: 10pt;
font-family:sans-serif;
}
A.disabled
{
color: #666666;
}
form
{
display: inline;
}
.SEVERE
{
background-color: #ff0000;
}
.WARNING
{
background-color: #ff6633;
}
.INFO
{
background-color: #00cc33;
}
.CONFIG
{
background-color: #999999;
}
.FINE
{
background-color: #3333ff;
}
.FINER
{
background-color: #3333cc;
}
.FINEST
{
background-color: #333399;
}
table
{
width: 100%;
border-spacing: 0px;
border-collapse: separate;
}
td
{
font-family: Arial,sans-serif;
font-size: 10pt;
padding: 2px;
margin: 0px;
border: #eeeeee groove 2px;
}
#content td
{
vertical-align: top;
}
#key
{
border-spacing: 0px;
border: 0px;
}
#key td
{
border: #eeeeee groove 2px;
font-size: 8pt;
font-family: Helvetica;
font-weight: bold;
color: white;
}
thead th
{
border: #eeeeee groove 2px;
}
.seq
{
width: 7em;
min-width: 7em;
max-width: 7em;
color: white;
font-family: Helvetica;
font-weight: bold;
}
.date
{
width: 19em;
min-width: 19em;
max-width: 19em;
color: black;
background-color: #eeeeee;
}
.thread
{
width: 3em;
min-width: 3em;
max-width: 3em;
color: black;
background-color: #eeeeee;
}
.logger
{
width: 30em;
min-width: 30em;
max-width: 30em;
background-color: #eeeeee;
}
.logclass
{
width: 30em;
min-width: 30em;
max-width: 30em;
background-color: #eeeeee;
}
.method
{
width: 20em;
min-width: 20em;
max-width: 20em;
background-color: #eeeeee;
}
.message
{
width: 250em;
min-width: 250em;
max-width: 250em;
text-align: left;
background-color: #eeeeee;
font-family: monospace;
}
.message table
{
border: 0px;
}
.message td,tr
{
text-align: left;
vertical-align: top;
padding-top: 0px;
border: 0px;
}
.except
{
background: #eeeeee;
padding-top: 2px;
}
.excepticon
{
width: 40px;
max-width: 40px;
min-width: 40px;
}
button
{
background: white;
}

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- This web.xml format file is an override file that is applied to the test webapp AFTER
it has been configured by the default descriptor and the WEB-INF/web.xml descriptor -->
<!-- Add or override context init parameter -->
<context-param>
<param-name>context-override-example</param-name>
<param-value>a context value</param-value>
</context-param>
<!-- Add or override servlet init parameter -->
<servlet>
<servlet-name>default</servlet-name>
<init-param>
<param-name>precompressed</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<!-- Add or override servlet init parameter -->
<servlet>
<servlet-name>Dump</servlet-name>
<init-param>
<param-name>servlet-override-example</param-name>
<param-value>a servlet value</param-value>
</init-param>
</servlet>
<!-- Add servlet mapping -->
<servlet-mapping>
<servlet-name>Dump</servlet-name>
<url-pattern>*.more</url-pattern>
</servlet-mapping>
<!-- Reset servlet class and/or start order -->
<servlet>
<servlet-name>Session</servlet-name>
<servlet-class>com.acme.SessionDump</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<!-- Allow remote access to test webapp -->
<!--
<filter>
<filter-name>TestFilter</filter-name>
<filter-class>com.acme.TestFilter</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>remote</param-name>
<param-value>true</param-value>
</init-param>
</filter>
-->
</web-app>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- ==================================================================
Configure and deploy the test web application
===================================================================== -->
<Configure id="testWebapp" class="org.eclipse.jetty.webapp.WebAppContext">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/test</Set>
<Set name="war"><Property name="jetty.webapps" default="."/>/test-jetty.war</Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="overrideDescriptor"><Property name="jetty.webapps" default="."/>/test-jetty.d/test-jetty-override-web.xml</Set>
<!-- Enable WebSocket container -->
<Call name="setAttribute">
<Arg>org.eclipse.jetty.websocket.javax</Arg>
<Arg type="Boolean">true</Arg>
</Call>
<Call name="insertHandler">
<Arg>
<New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">2048</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,21 @@
#
# This file defines users passwords and roles for a HashUserRealm
#
# The format is
# <username>: <password>[,<rolename> ...]
#
# Passwords may be clear text, obfuscated or checksummed. The class
# org.eclipse.util.Password should be used to generate obfuscated
# passwords or password checksums
#
# If DIGEST Authentication is used, the password must be in a recoverable
# format, either plain text or OBF:.
#
jetty: MD5:164c88b302622e17050af52c89945d44,user
admin: CRYPT:adpexzg3FUZAk,server-administrator,content-administrator,admin,user
other: OBF:1xmk1w261u9r1w1c1xmq,user
plain: plain,user
user: password,user
# This entry is for digest auth. The credential is a MD5 hash of username:realmname:password
digest: MD5:6e120743ad67abfbc385bc2bb754e297,user

View File

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Configure Authentication Login Service -->
<!-- Realms may be configured for the entire server here, or -->
<!-- they can be configured for a specific web app in a context -->
<!-- configuration (see $(jetty.home)/webapps/test.xml for an -->
<!-- example). -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config">etc/test-realm.properties</Set>
<Set name="hotReload">false</Set>
</New>
</Arg>
</Call>
<Call class="org.slf4j.LoggerFactory" name="getLogger">
<Arg>org.eclipse.jetty</Arg>
<Call name="warn">
<Arg>demo-realm is deployed. DO NOT USE IN PRODUCTION!</Arg>
</Call>
</Call>
</Configure>

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id='wac' class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="war"><Property name="jetty.webapps"/>/test-spec.war</Set>
<Set name="configurationDiscovered">true</Set>
<New id="tx" class="org.eclipse.jetty.plus.jndi.Transaction">
<Arg>
<New class="com.acme.MockUserTransaction"/>
</Arg>
</New>
<New id="maxAmount" class="org.eclipse.jetty.plus.jndi.EnvEntry">
<Arg><Ref refid='wac'/></Arg>
<Arg>maxAmount</Arg>
<Arg type="java.lang.Double">100</Arg>
<Arg type="boolean">true</Arg>
</New>
<New id="mydatasource" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg><Ref refid='wac'/></Arg>
<Arg>jdbc/mydatasource</Arg>
<Arg>
<New class="com.acme.MockDataSource">
</New>
</Arg>
</New>
</Configure>

View File

@ -0,0 +1,17 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Configure a demo authentication realm.
[tags]
demo
[depends]
security
[xml]
etc/test-realm.xml
[files]
basehome:modules/demo.d/test-realm.xml|etc/test-realm.xml
basehome:modules/demo.d/test-realm.properties|etc/test-realm.properties

View File

@ -0,0 +1,15 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Download and deploy the Async Rest webapp demo.
[tags]
demo
webapp
[depends]
deploy
[files]
maven://org.eclipse.jetty.example-async-rest/example-async-rest-webapp/${jetty.version}/war|webapps/async-rest.war

View File

@ -0,0 +1,19 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Deploy demo root webapp.
[tags]
demo
webapp
[depends]
deploy
[files]
webapps/root/
webapps/root/images/
basehome:modules/demo.d/root/index.html|webapps/root/index.html
basehome:modules/demo.d/root/jetty.css|webapps/root/jetty.css
basehome:modules/demo.d/root/images/jetty-header.jpg|webapps/root/images/jetty-header.jpg
basehome:modules/demo.d/root/images/webtide_logo.jpg|webapps/root/images/webtide_logo.jpg

View File

@ -0,0 +1,21 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Download and deploy the Test Spec webapp demo.
[tags]
demo
webapp
[depends]
deploy
jdbc
jsp
annotations
test-realm
ext
[files]
basehome:modules/demo.d/test-spec.xml|webapps/test-spec.xml
maven://org.eclipse.jetty.tests/test-spec-webapp/${jetty.version}/war|webapps/test-spec.war
maven://org.eclipse.jetty.tests/test-mock-resources/${jetty.version}/jar|lib/ext/test-mock-resources-${jetty.version}.jar

View File

@ -0,0 +1,25 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Download and deploy the Test Spec webapp demo.
[tags]
demo
webapp
[depends]
deploy
jdbc
jsp
annotations
test-realm
ext
servlets
websocket-javax
websocket-jetty
[files]
webapps/test-jetty.d/
basehome:modules/demo.d/test-jetty.xml|webapps/test-jetty.xml
maven://org.eclipse.jetty/test-jetty-webapp/${jetty.version}/war|webapps/test-jetty.war
basehome:modules/demo.d/test-jetty-override-web.xml|webapps/test-jetty.d/test-jetty-override-web.xml

View File

@ -0,0 +1,21 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Download and deploy the Test Spec webapp demo.
[tags]
demo
webapp
[depends]
deploy
jdbc
jsp
annotations
test-realm
ext
[files]
basehome:modules/demo.d/test-spec.xml|webapps/test-spec.xml
maven://org.eclipse.jetty.tests/test-spec-webapp/${jetty.version}/war|webapps/test-spec.war
maven://org.eclipse.jetty.tests/test-mock-resources/${jetty.version}/jar|lib/ext/test-mock-resources-${jetty.version}.jar