Merge remote-tracking branch 'origin/master' into servlet-3.1-api

Conflicts:
	aggregates/jetty-all/pom.xml
	examples/async-rest/async-rest-jar/pom.xml
	examples/async-rest/async-rest-webapp/pom.xml
	examples/async-rest/pom.xml
	examples/embedded/pom.xml
	examples/pom.xml
	jetty-annotations/pom.xml
	jetty-ant/pom.xml
	jetty-client/pom.xml
	jetty-continuation/pom.xml
	jetty-deploy/pom.xml
	jetty-distribution/pom.xml
	jetty-http/pom.xml
	jetty-io/pom.xml
	jetty-jaas/pom.xml
	jetty-jaspi/pom.xml
	jetty-jmx/pom.xml
	jetty-jndi/pom.xml
	jetty-jsp/pom.xml
	jetty-jspc-maven-plugin/pom.xml
	jetty-maven-plugin/pom.xml
	jetty-monitor/pom.xml
	jetty-nosql/pom.xml
	jetty-osgi/jetty-osgi-boot-jsp/pom.xml
	jetty-osgi/jetty-osgi-boot-warurl/pom.xml
	jetty-osgi/jetty-osgi-boot/pom.xml
	jetty-osgi/jetty-osgi-httpservice/pom.xml
	jetty-osgi/jetty-osgi-npn/pom.xml
	jetty-osgi/pom.xml
	jetty-osgi/test-jetty-osgi-context/pom.xml
	jetty-osgi/test-jetty-osgi-webapp/pom.xml
	jetty-plus/pom.xml
	jetty-proxy/pom.xml
	jetty-rewrite/pom.xml
	jetty-runner/pom.xml
	jetty-security/pom.xml
	jetty-server/pom.xml
	jetty-servlet/pom.xml
	jetty-servlets/pom.xml
	jetty-spdy/pom.xml
	jetty-spdy/spdy-client/pom.xml
	jetty-spdy/spdy-core/pom.xml
	jetty-spdy/spdy-example-webapp/pom.xml
	jetty-spdy/spdy-http-server/pom.xml
	jetty-spdy/spdy-server/pom.xml
	jetty-spring/pom.xml
	jetty-start/pom.xml
	jetty-util-ajax/pom.xml
	jetty-util/pom.xml
	jetty-webapp/pom.xml
	jetty-websocket/pom.xml
	jetty-websocket/websocket-api/pom.xml
	jetty-websocket/websocket-client/pom.xml
	jetty-websocket/websocket-common/pom.xml
	jetty-websocket/websocket-server/pom.xml
	jetty-websocket/websocket-servlet/pom.xml
	jetty-xml/pom.xml
	pom.xml
	tests/pom.xml
	tests/test-continuation/pom.xml
	tests/test-loginservice/pom.xml
	tests/test-sessions/pom.xml
	tests/test-sessions/test-hash-sessions/pom.xml
	tests/test-sessions/test-jdbc-sessions/pom.xml
	tests/test-sessions/test-sessions-common/pom.xml
	tests/test-webapps/pom.xml
	tests/test-webapps/test-jaas-webapp/pom.xml
	tests/test-webapps/test-jetty-webapp/pom.xml
	tests/test-webapps/test-jndi-webapp/pom.xml
	tests/test-webapps/test-mock-resources/pom.xml
	tests/test-webapps/test-proxy-webapp/pom.xml
	tests/test-webapps/test-servlet-spec/pom.xml
	tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml
	tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml
	tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/AnnotationTest.java
	tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml
	tests/test-webapps/test-webapp-rfc2616/pom.xml
This commit is contained in:
Jan Bartel 2013-05-09 11:29:45 +10:00
commit 2fb23e705c
33 changed files with 468 additions and 264 deletions

View File

@ -1,3 +1,6 @@
branches:
only:
- /^release-.*$/
language: java
script: mvn install
jdk:

View File

@ -1,4 +1,36 @@
jetty-9.0.3-SNAPSHOT
jetty-9.0.3.v20130506 06 May 2013
+ 404010 fix cast exception in mongodb session manager
+ 404911 WebSocketCloseTest fails spuriously
+ 405281 allow filemappedbuffers to not be used
+ 405327 Modular Start.ini
+ 405530 Wrap AsyncContext to throw ISE after complete
+ 405537 NPE in rendering JSP using SPDY and wrapped ServletRequest
+ 405570 spdy push: resource ordering and sequential push.
+ 405631 Plugin gives error when its started twice
+ 405925 Redeploy with jetty-maven-plugin fails
+ 406015 Query parameters and POST queries. Fixed proxy case where the path is
rewritten to be absolute.
+ 406202 re-enabled connector statistics
+ 406214 fix constructor for PushSynInfo ignores timeout, remove timeout for
creating push streams in HttpTransportOverSPDY
+ 406272 Security constraints with multiple http-method-omissions can be
incorrectly applied
+ 406390 406617 removed tiny race from handling of suspend and complete
+ 406437 Digest Auth supports out of order nc
+ 406449 Session's disconnect not detected
+ 406617 Spin in Request.recycle
+ 406618 Jetty startup in OSGi Equinox fails when using option
jetty.home.bundle=org.eclipse.jetty.osgi.boot
+ 406753 jetty-runner contains invalid signature files
+ 406768 Improved handling of static content resources
+ 406861 IPv6 redirects fail.
+ 406923 Accept CRLF or LF but not CR as line termination
+ 406962 Improve attribute names in Request
+ 407075 Do not dispatch from complete
+ 407135 Unauthorized response causes retry loop.
+ 407136 @PreDestroy called after Servlet.destroy()
+ 407173 java.lang.IllegalStateException: null when using JDBCSessionManager
+ 407214 Reduce build logging of OSGi modules
jetty-9.0.2.v20130417 - 17 April 2013
+ 364921 FIN WAIT sockets

View File

@ -51,3 +51,9 @@ etc/jetty-plus.xml
# -----------------------------------------------------------
OPTIONS=annotations
etc/jetty-annotations.xml
# ===========================================================
# Enable https listener
# -----------------------------------------------------------
etc/jetty-ssl.xml
etc/jetty-https.xml

View File

@ -2,7 +2,7 @@
<parent>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-project</artifactId>
<version>9.0.3-SNAPSHOT</version>
<version>9.0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -25,7 +25,6 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketException;
/**
* Annotation for receiving websocket errors (exceptions) that have occurred internally in the websocket implementation.
@ -34,8 +33,8 @@ import org.eclipse.jetty.websocket.api.WebSocketException;
* Note: <code>methodName</code> can be any name you want to use.
* <p>
* <ol>
* <li><code>public void methodName({@link WebSocketException} error)</code></li>
* <li><code>public void methodName({@link Session} session, {@link WebSocketException} error)</code></li>
* <li><code>public void methodName({@link Throwable} error)</code></li>
* <li><code>public void methodName({@link Session} session, {@link Throwable} error)</code></li>
* </ol>
*/
@Documented

View File

@ -25,17 +25,16 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.extensions.Frame;
/**
* (ADVANCED) Annotation for tagging methods to receive frame events.
* <p>
* Note: any frame derived from {@link WebSocketFrame} is acceptable to use as the last parameter here.
* <p>
* Acceptable method patterns.<br>
* Note: <code>methodName</code> can be any name you want to use.
* <ol>
* <li><code>public void methodName({@link WebSocketFrame} frame)</code></li>
* <li><code>public void methodName({@link Session} session, {@link WebSocketFrame} frame)</code></li>
* <li><code>public void methodName({@link Frame} frame)</code></li>
* <li><code>public void methodName({@link Session} session, {@link Frame} frame)</code></li>
* </ol>
*/
@Documented

View File

@ -0,0 +1,70 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package examples;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
/**
* Example of a simple Echo Client.
*/
public class SimpleEchoClient
{
public static void main(String[] args)
{
String destUri = "ws://echo.websocket.org";
if (args.length > 0)
{
destUri = args[0];
}
WebSocketClient client = new WebSocketClient();
SimpleEchoSocket socket = new SimpleEchoSocket();
try
{
client.start();
URI echoUri = new URI(destUri);
ClientUpgradeRequest request = new ClientUpgradeRequest();
client.connect(socket,echoUri,request);
System.out.printf("Connecting to : %s%n",echoUri);
// wait for closed socket connection.
socket.awaitClose(5,TimeUnit.SECONDS);
}
catch (Throwable t)
{
t.printStackTrace();
}
finally
{
try
{
client.stop();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}

View File

@ -0,0 +1,87 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package examples;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
/**
* Basic Echo Client Socket
*/
@WebSocket(maxMessageSize = 64 * 1024)
public class SimpleEchoSocket
{
private final CountDownLatch closeLatch;
@SuppressWarnings("unused")
private Session session;
public SimpleEchoSocket()
{
this.closeLatch = new CountDownLatch(1);
}
public boolean awaitClose(int duration, TimeUnit unit) throws InterruptedException
{
return this.closeLatch.await(duration,unit);
}
@OnWebSocketClose
public void onClose(int statusCode, String reason)
{
System.out.printf("Connection closed: %d - %s%n",statusCode,reason);
this.session = null;
this.closeLatch.countDown(); // trigger latch
}
@OnWebSocketConnect
public void onConnect(Session session)
{
System.out.printf("Got connect: %s%n",session);
this.session = session;
try
{
Future<Void> fut;
fut = session.getRemote().sendStringByFuture("Hello");
fut.get(2,TimeUnit.SECONDS); // wait for send to complete.
fut = session.getRemote().sendStringByFuture("Thanks for the conversation.");
fut.get(2,TimeUnit.SECONDS); // wait for send to complete.
session.close(StatusCode.NORMAL,"I'm done");
}
catch (Throwable t)
{
t.printStackTrace();
}
}
@OnWebSocketMessage
public void onMessage(String msg)
{
System.out.printf("Got msg: %s%n",msg);
}
}

View File

@ -1,133 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.websocket.client.examples;
import java.net.URI;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
/**
* Example of a simple Echo Client.
*/
public class SimpleEchoClient
{
@WebSocket(maxMessageSize = 64 * 1024)
public static class SimpleEchoSocket
{
private final CountDownLatch closeLatch;
@SuppressWarnings("unused")
private Session session;
public SimpleEchoSocket()
{
this.closeLatch = new CountDownLatch(1);
}
public boolean awaitClose(int duration, TimeUnit unit) throws InterruptedException
{
return this.closeLatch.await(duration,unit);
}
@OnWebSocketClose
public void onClose(int statusCode, String reason)
{
System.out.printf("Connection closed: %d - %s%n",statusCode,reason);
this.session = null;
this.closeLatch.countDown(); // trigger latch
}
@OnWebSocketConnect
public void onConnect(Session session)
{
System.out.printf("Got connect: %s%n",session);
this.session = session;
try
{
Future<Void> fut;
fut = session.getRemote().sendStringByFuture("Hello");
fut.get(2,TimeUnit.SECONDS); // wait for send to complete.
fut = session.getRemote().sendStringByFuture("Thanks for the conversation.");
fut.get(2,TimeUnit.SECONDS); // wait for send to complete.
session.close(StatusCode.NORMAL,"I'm done");
}
catch (Throwable t)
{
t.printStackTrace();
}
}
@OnWebSocketMessage
public void onMessage(String msg)
{
System.out.printf("Got msg: %s%n",msg);
}
}
public static void main(String[] args)
{
String destUri = "ws://echo.websocket.org";
if (args.length > 0)
{
destUri = args[0];
}
WebSocketClient client = new WebSocketClient();
SimpleEchoSocket socket = new SimpleEchoSocket();
try
{
client.start();
URI echoUri = new URI(destUri);
ClientUpgradeRequest request = new ClientUpgradeRequest();
// request.addExtensions("x-webkit-deflate-frame");
client.connect(socket,echoUri,request);
System.out.printf("Connecting to : %s%n",echoUri);
// wait for closed socket connection.
socket.awaitClose(5,TimeUnit.SECONDS);
}
catch (Throwable t)
{
t.printStackTrace();
}
finally
{
try
{
client.stop();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}

View File

@ -20,8 +20,6 @@ package examples.echo;
import java.io.IOException;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.api.WebSocketAdapter;
/**
@ -29,26 +27,21 @@ import org.eclipse.jetty.websocket.api.WebSocketAdapter;
*/
public class AdapterEchoSocket extends WebSocketAdapter
{
private static final Logger LOG = Log.getLogger(AdapterEchoSocket.class);
@Override
public void onWebSocketText(String message)
{
if (isNotConnected())
if (isConnected())
{
LOG.debug("WebSocket Not Connected");
return;
}
try
{
LOG.debug("Echoing back message [{}]",message);
// echo the data back
getRemote().sendString(message);
}
catch (IOException e)
{
e.printStackTrace();
try
{
System.out.printf("Echoing back message [%s]%n",message);
// echo the message back
getRemote().sendString(message);
}
catch (IOException e)
{
e.printStackTrace(System.err);
}
}
}
}

View File

@ -33,8 +33,9 @@ public class AnnotatedEchoSocket
{
if (session.isOpen())
{
return;
System.out.printf("Echoing back message [%s]%n",message);
// echo the message back
session.getRemote().sendStringByFuture(message);
}
session.getRemote().sendStringByFuture(message);
}
}

View File

@ -18,9 +18,6 @@
package examples.echo;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketListener;
@ -29,7 +26,6 @@ import org.eclipse.jetty.websocket.api.WebSocketListener;
*/
public class ListenerEchoSocket implements WebSocketListener
{
private static final Logger LOG = Logger.getLogger(ListenerEchoSocket.class.getName());
private Session outbound;
@Override
@ -53,17 +49,17 @@ public class ListenerEchoSocket implements WebSocketListener
@Override
public void onWebSocketError(Throwable cause)
{
LOG.log(Level.WARNING,"onWebSocketError",cause);
cause.printStackTrace(System.err);
}
@Override
public void onWebSocketText(String message)
{
if (outbound == null)
if ((outbound != null) && (outbound.isOpen()))
{
return;
System.out.printf("Echoing back message [%s]%n",message);
// echo the message back
outbound.getRemote().sendStringByFuture(message);
}
outbound.getRemote().sendStringByFuture(message);
}
}

View File

@ -0,0 +1,57 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package examples;
import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.api.UpgradeResponse;
import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
public class MyAdvancedEchoCreator implements WebSocketCreator
{
private MyBinaryEchoSocket binaryEcho;
private MyEchoSocket textEcho;
public MyAdvancedEchoCreator()
{
// Create the reusable sockets
this.binaryEcho = new MyBinaryEchoSocket();
this.textEcho = new MyEchoSocket();
}
@Override
public Object createWebSocket(UpgradeRequest req, UpgradeResponse resp)
{
for (String subprotocol : req.getSubProtocols())
{
if ("binary".equals(subprotocol))
{
resp.setAcceptedSubProtocol(subprotocol);
return binaryEcho;
}
if ("text".equals(subprotocol))
{
resp.setAcceptedSubProtocol(subprotocol);
return textEcho;
}
}
// No valid subprotocol in request, ignore the request
return null;
}
}

View File

@ -0,0 +1,39 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package examples;
import javax.servlet.annotation.WebServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
@SuppressWarnings("serial")
@WebServlet(name = "MyAdvanced Echo WebSocket Servlet", urlPatterns = { "/advecho" })
public class MyAdvancedEchoServlet extends WebSocketServlet
{
@Override
public void configure(WebSocketServletFactory factory)
{
// set a 10 second timeout
factory.getPolicy().setIdleTimeout(10000);
// set a custom WebSocket creator
factory.setCreator(new MyAdvancedEchoCreator());
}
}

View File

@ -0,0 +1,39 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package examples;
import java.nio.ByteBuffer;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
/**
* Echo BINARY messages
*/
@WebSocket
public class MyBinaryEchoSocket
{
@OnWebSocketMessage
public void onWebSocketText(Session session, byte buf[], int offset, int len)
{
// Echo message back, asynchronously
session.getRemote().sendBytesByFuture(ByteBuffer.wrap(buf,offset,len));
}
}

View File

@ -18,18 +18,22 @@
package examples;
import javax.servlet.annotation.WebServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
@SuppressWarnings("serial")
public class MyExampleServlet extends WebSocketServlet
@WebServlet(name = "MyEcho WebSocket Servlet", urlPatterns = { "/echo" })
public class MyEchoServlet extends WebSocketServlet
{
@Override
public void configure(WebSocketServletFactory factory)
{
// set a 10 second timeout
factory.getPolicy().setIdleTimeout(10000);
// register my socket
factory.register(MyExampleSocket.class);
// register MyEchoSocket as the WebSocket to create on Upgrade
factory.register(MyEchoSocket.class);
}
}

View File

@ -18,17 +18,20 @@
package examples;
import org.eclipse.jetty.websocket.api.WebSocketAdapter;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
/**
* Example WebSocket, simple echo
*/
public class MyExampleSocket extends WebSocketAdapter
@WebSocket
public class MyEchoSocket
{
@Override
public void onWebSocketText(String message)
@OnWebSocketMessage
public void onWebSocketText(Session session, String message)
{
// Echo message back, asynchronously
getSession().getRemote().sendStringByFuture(message);
session.getRemote().sendStringByFuture(message);
}
}

View File

@ -685,7 +685,7 @@
<configuration>
<excludePackageNames>com.acme</excludePackageNames>
<links>
<link>http://docs.oracle.com/javase/6/docs/api/</link>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
<link>http://docs.oracle.com/javaee/6/api</link>
<link>http://junit.sourceforge.net/javadoc/</link>
</links>

View File

@ -2,6 +2,7 @@
<HEAD>
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache,no-store">
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
</HEAD>
<BODY>

View File

@ -1,6 +1,7 @@
<html>
<head>
<title>Authentication Failure</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
</head>
<body>
<h1>Authentication Failure</h1>

View File

@ -3,12 +3,7 @@
<TITLE>JAAS Authentication and Authorization Test</TITLE>
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache,no-store">
<style>
body {color: #2E2E2E; font-family:sans-serif; font-size:90%;}
h1 {font-variant: small-caps; font-size:130%; letter-spacing: 0.1em;}
h2 {font-variant: small-caps; font-size:100%; letter-spacing: 0.1em;}
</style>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
</HEAD>
<BODY>
<A HREF="http://www.eclipse.org/jetty"><IMG SRC="images/jetty_banner.gif"></A>

View File

@ -1,5 +1,8 @@
<HTML><HEAD><TITLE>JAAS Authentication and Authorization Test</TITLE></HEAD>
<HTML>
<HEAD><TITLE>JAAS Authentication and Authorization Test</TITLE>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
</HEAD>
<BODY>
<H1> Enter your username and password to login </H1>
<I> Enter login=me and password=me in order to authenticate successfully</I>

View File

@ -0,0 +1,7 @@
body {color: #2E2E2E; font-family:sans-serif; font-size:90%;}
h1 {font-variant: small-caps; font-size:130%; letter-spacing: 0.1em;}
h2 {font-variant: small-caps; font-size:100%; letter-spacing: 0.1em;}
h3 {font-size:100%; letter-spacing: 0.1em;}
span.pass { color: green; }
span.fail { color:red; }

View File

@ -55,8 +55,8 @@ public class JNDITest extends HttpServlet
private String resourceNameMappingInjectionResult;
private String envEntryOverrideResult;
private String postConstructResult = "PostConstruct method called: FALSE";
private String preDestroyResult = "PreDestroy method called: NOT YET";
private String postConstructResult = "PostConstruct method called: <span class=\"fail\">FALSE</span>";
private String preDestroyResult = "PreDestroy method called: <span class=\"pass\">NOT YET</span>";
private String envEntryGlobalScopeResult;
private String envEntryWebAppScopeResult;
private String userTransactionResult;
@ -71,15 +71,14 @@ public class JNDITest extends HttpServlet
private void postConstruct ()
{
String tmp = (myDS == null?"":myDS.toString());
resourceNameMappingInjectionResult= "Injection of resource to locally mapped name (java:comp/env/mydatasource as java:comp/env/mydatasource1): "+String.valueOf(myDS);
envEntryOverrideResult = "Override of EnvEntry in jetty-env.xml (java:comp/env/wiggle): "+(wiggle==55.0?"PASS":"FAIL(expected 55.0, got "+wiggle+")");
postConstructResult = "PostConstruct method called: PASS";
resourceNameMappingInjectionResult= "Injection of resource to locally mapped name (java:comp/env/mydatasource as java:comp/env/mydatasource1): "+(myDS!=null?"<span class=\"pass\">PASS</span>":"<span class=\"fail\">FAIL</span>");
envEntryOverrideResult = "Override of EnvEntry in jetty-env.xml (java:comp/env/wiggle): "+(wiggle==55.0?"<span class=\"pass\">PASS":"<span class=\"fail\">FAIL(expected 55.0, got "+wiggle+")")+"</span>";
postConstructResult = "PostConstruct method called: <span class=\"pass\">PASS</span>";
}
private void preDestroy()
{
preDestroyResult = "PreDestroy method called: PASS";
preDestroyResult = "PreDestroy method called: <span class=\"pass\">PASS</span>";
}
@ -90,13 +89,13 @@ public class JNDITest extends HttpServlet
{
InitialContext ic = new InitialContext();
woggle = (Integer)ic.lookup("java:comp/env/woggle");
envEntryGlobalScopeResult = "EnvEntry defined in context xml lookup result (java:comp/env/woggle): "+(woggle==4000?"PASS":"FAIL(expected 4000, got "+woggle+")");
envEntryGlobalScopeResult = "EnvEntry defined in context xml lookup result (java:comp/env/woggle): "+(woggle==4000?"<span class=\"pass\">PASS":"<span class=\"fail\">FAIL(expected 4000, got "+woggle+")")+"</span>";
gargle = (Double)ic.lookup("java:comp/env/gargle");
envEntryWebAppScopeResult = "EnvEntry defined in jetty-env.xml lookup result (java:comp/env/gargle): "+(gargle==100.0?"PASS":"FAIL(expected 100, got "+gargle+")");
envEntryWebAppScopeResult = "EnvEntry defined in jetty-env.xml lookup result (java:comp/env/gargle): "+(gargle==100.0?"<span class=\"pass\">PASS":"<span class=\"fail\">FAIL(expected 100, got "+gargle+")")+"</span>";
UserTransaction utx = (UserTransaction)ic.lookup("java:comp/UserTransaction");
userTransactionResult = "UserTransaction lookup result (java:comp/UserTransaction): "+(utx!=null?"PASS":"FAIL");
userTransactionResult = "UserTransaction lookup result (java:comp/UserTransaction): "+(utx!=null?"<span class=\"pass\">PASS":"<span class=\"fail\">FAIL")+"</span>";
myMailSession = (Session)ic.lookup("java:comp/env/mail/Session");
mailSessionResult = "Mail Session lookup result (java:comp/env/mail/Session): "+(myMailSession!=null?"PASS": "FAIL");
mailSessionResult = "Mail Session lookup result (java:comp/env/mail/Session): "+(myMailSession!=null?"<span class=\"pass\">PASS": "<span class=\"fail\">FAIL")+"</span>";
}
catch (Exception e)
{
@ -129,6 +128,7 @@ public class JNDITest extends HttpServlet
response.setContentType("text/html");
ServletOutputStream out = response.getOutputStream();
out.println("<html>");
out.println("<head><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\"/></head>");
out.println("<h1>Jetty JNDI Tests</h1>");
out.println("<body>");

View File

@ -3,12 +3,7 @@
<TITLE>JNDI Test WebApp</TITLE>
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache,no-store">
<style>
body {color: #2E2E2E; font-family:sans-serif; font-size:90%;}
h1 {font-variant: small-caps; font-size:130%; letter-spacing: 0.1em;}
h2 {font-variant: small-caps; font-size:100%; letter-spacing: 0.1em;}
h3 {font-size:100%; letter-spacing: 0.1em;}
</style>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
</HEAD>
<BODY>
<A HREF="http://www.eclipse.org/jetty"><IMG SRC="images/jetty_banner.gif"></A>

View File

@ -0,0 +1,7 @@
body {color: #2E2E2E; font-family:sans-serif; font-size:90%;}
h1 {font-variant: small-caps; font-size:130%; letter-spacing: 0.1em;}
h2 {font-variant: small-caps; font-size:100%; letter-spacing: 0.1em;}
h3 {font-size:100%; letter-spacing: 0.1em;}
span.pass { color: green; }
span.fail { color:red; }

View File

@ -94,18 +94,18 @@ public class AnnotationTest extends HttpServlet
@PostConstruct
private void myPostConstructMethod ()
{
postConstructResult = "Called";
postConstructResult = "<span class=\"pass\">PASS</span>";
try
{
dsResult = (myDS==null?"FAIL":"myDS="+myDS.toString());
dsResult = (myDS==null?"<span class=\"fail\">FAIL</span>":"<span class=\"pass\">myDS="+myDS.toString()+"</span>");
}
catch (Exception e)
{
dsResult = "FAIL: "+e;
dsResult = "<span class=\"fail\">FAIL:</span> "+e;
}
envResult = (maxAmount==null?"FAIL":"maxAmount="+maxAmount.toString());
envResult = (maxAmount==null?"FAIL</span>":"<span class=\"pass\">maxAmount="+maxAmount.toString()+"</span>");
try
{
@ -114,10 +114,10 @@ public class AnnotationTest extends HttpServlet
}
catch (Exception e)
{
envLookupResult = "FAIL: "+e;
envLookupResult = "<span class=\"fail\">FAIL:</span> "+e;
}
envResult2 = (minAmount==null?"FAIL":"minAmount="+minAmount.toString());
envResult2 = (minAmount==null?"<span class=\"fail\">FAIL</span>":"<span class=\"pass\">minAmount="+minAmount.toString()+"</span>");
try
{
InitialContext ic = new InitialContext();
@ -125,9 +125,9 @@ public class AnnotationTest extends HttpServlet
}
catch (Exception e)
{
envLookupResult2 = "FAIL: "+e;
envLookupResult2 = "<span class=\"fail\">FAIL:</span> "+e;
}
envResult3 = (minAmount==null?"FAIL":"avgAmount="+avgAmount.toString());
envResult3 = (minAmount==null?"<span class=\"fail\">FAIL</span>":"<span class=\"pass\">avgAmount="+avgAmount.toString()+"</span>");
try
{
InitialContext ic = new InitialContext();
@ -135,7 +135,7 @@ public class AnnotationTest extends HttpServlet
}
catch (Exception e)
{
envLookupResult3 = "FAIL: "+e;
envLookupResult3 = "<span class=\"fail\">FAIL:</span> "+e;
}
@ -147,10 +147,10 @@ public class AnnotationTest extends HttpServlet
}
catch (Exception e)
{
dsLookupResult = "FAIL: "+e;
dsLookupResult = "<span class=\"fail\">FAIL:</span> "+e;
}
txResult = (myUserTransaction==null?"FAIL":"myUserTransaction="+myUserTransaction);
txResult = (myUserTransaction==null?"<span class=\"fail\">FAIL</span>":"<span class=\"pass\">myUserTransaction="+myUserTransaction+"</span>");
try
{
InitialContext ic = new InitialContext();
@ -158,7 +158,7 @@ public class AnnotationTest extends HttpServlet
}
catch (Exception e)
{
txLookupResult = "FAIL: "+e;
txLookupResult = "<span class=\"fail\">FAIL:</span> "+e;
}
}
@ -189,6 +189,7 @@ public class AnnotationTest extends HttpServlet
response.setContentType("text/html");
ServletOutputStream out = response.getOutputStream();
out.println("<html>");
out.println("<HEAD><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\"/></HEAD>");
out.println("<body>");
out.println("<h1>Results</h1>");
@ -196,14 +197,14 @@ public class AnnotationTest extends HttpServlet
out.println("<pre>");
out.println("initParams={@WebInitParam(name=\"fromAnnotation\", value=\"xyz\")}");
out.println("</pre>");
out.println("<br/><b>Result: "+("xyz".equals(config.getInitParameter("fromAnnotation"))? "PASS": "FAIL"));
out.println("<br/><b>Result: "+("xyz".equals(config.getInitParameter("fromAnnotation"))? "<span class=\"pass\">PASS": "<span class=\"fail\">FAIL")+"</span>");
out.println("<h2>Init Params from web-fragment</h2>");
out.println("<pre>");
out.println("extra1=123, extra2=345");
out.println("</pre>");
boolean fragInitParamResult = "123".equals(config.getInitParameter("extra1")) && "345".equals(config.getInitParameter("extra2"));
out.println("<br/><b>Result: "+(fragInitParamResult? "PASS": "FAIL"));
out.println("<br/><b>Result: "+(fragInitParamResult? "<span class=\"pass\">PASS": "<span class=\"fail\">FAIL")+"</span>");
__HandlesTypes = Arrays.asList( "javax.servlet.GenericServlet",
@ -231,27 +232,27 @@ public class AnnotationTest extends HttpServlet
}
if (classNames.size() != __HandlesTypes.size())
out.println("<br/>FAIL");
out.println("<br/><span class=\"fail\">FAIL</span>");
else if (!classNames.containsAll(__HandlesTypes))
out.println("<br/>FAIL");
out.println("<br/><span class=\"fail\">FAIL</span>");
else
out.println("<br/>PASS");
out.println("<br/><span class=\"pass\">PASS</span>");
}
else
out.print("<br/>FAIL (No such attribute com.acme.Foo)");
out.print("<br/><span class=\"fail\">FAIL</span> (No such attribute com.acme.Foo)");
out.println("</b>");
out.println("<h2>Complete Servlet Registration</h2>");
Boolean complete = (Boolean)config.getServletContext().getAttribute("com.acme.AnnotationTest.complete");
out.println("<br/><b>Result: "+(complete.booleanValue()?"PASS":"FAIL")+"</b>");
out.println("<br/><b>Result: "+(complete.booleanValue()?"<span class=\"pass\">PASS":"<span class=\"fail\">FAIL")+"</span></b>");
out.println("<h2>ServletContextListener Programmatic Registration from ServletContainerInitializer</h2>");
Boolean programmaticListener = (Boolean)config.getServletContext().getAttribute("com.acme.AnnotationTest.listenerTest");
out.println("<br/><b>Result: "+(programmaticListener.booleanValue()?"PASS":"FAIL")+"</b>");
out.println("<br/><b>Result: "+(programmaticListener.booleanValue()?"<span class=\"pass\">PASS":"<span class=\"fail\">FAIL")+"</span></b>");
out.println("<h2>ServletContextListener Programmatic Registration Prevented from ServletContextListener</h2>");
Boolean programmaticListenerPrevention = (Boolean)config.getServletContext().getAttribute("com.acme.AnnotationTest.listenerRegoTest");
out.println("<br/><b>Result: "+(programmaticListenerPrevention.booleanValue()?"PASS":"FAIL")+"</b>");
out.println("<br/><b>Result: "+(programmaticListenerPrevention.booleanValue()?"<span class=\"pass\">PASS":"<span class=\"fail\">FAIL")+"</span></b>");
out.println("<h2>@PostConstruct Callback</h2>");
out.println("<pre>");
@ -281,11 +282,11 @@ public class AnnotationTest extends HttpServlet
out.println("@Resource(name=\"minAmount\")");
out.println("private Double minAmount;");
out.println("</pre>");
out.println("<br/><b>Result: "+envResult+": "+(maxAmount.compareTo(new Double(55))==0?" PASS":" FAIL")+"</b>");
out.println("<br/><b>Result: "+envResult+": "+(maxAmount.compareTo(new Double(55))==0?" <span class=\"pass\">PASS":" <span class=\"fail\">FAIL")+"</span></b>");
out.println("<br/><b>JNDI Lookup Result: "+envLookupResult+"</b>");
out.println("<br/><b>Result: "+envResult2+": "+(minAmount.compareTo(new Double("0.99"))==0?" PASS":" FAIL")+"</b>");
out.println("<br/><b>Result: "+envResult2+": "+(minAmount.compareTo(new Double("0.99"))==0?" <span class=\"pass\">PASS":" <span class=\"fail\">FAIL")+"</span></b>");
out.println("<br/><b>JNDI Lookup Result: "+envLookupResult2+"</b>");
out.println("<br/><b>Result: "+envResult3+": "+(avgAmount.compareTo(new Double("1.25"))==0?" PASS":" FAIL")+"</b>");
out.println("<br/><b>Result: "+envResult3+": "+(avgAmount.compareTo(new Double("1.25"))==0?" <span class=\"pass\">PASS":" <span class=\"fail\">FAIL")+"</span></b>");
out.println("<br/><b>JNDI Lookup Result: "+envLookupResult3+"</b>");
out.println("<h2>@Resource Injection for UserTransaction </h2>");
out.println("<pre>");
@ -294,28 +295,7 @@ public class AnnotationTest extends HttpServlet
out.println("</pre>");
out.println("<br/><b>Result: "+txResult+"</b>");
out.println("<br/><b>JNDI Lookup Result: "+txLookupResult+"</b>");
out.println("<h2>DeclaresRoles</h2>");
out.println("<p>Login as user \"admin\" with password \"admin\" when prompted after clicking the button below to test @DeclareRoles annotation</p>");
String context = request.getContextPath();
if (!context.endsWith("/"))
context += "/";
context += "role/";
out.println("<form action="+context+" method=\"post\"><button type=\"submit\">Test Role Annotations</button></form>");
out.println("<h2>ServletSecurity</h2>");
out.println("<p>Login as user \"admin\" with password \"admin\" when prompted after clicking the button below to test @ServletSecurity annotation</p>");
context = request.getContextPath();
if (!context.endsWith("/"))
context += "/";
String path = context +"sec/foo";
out.println("<form action="+path+" method=\"post\"><button type=\"submit\">Test ServletSecurity Annotation</button></form>");
out.println("<h2>AsyncListener Resource Injection</h2>");
out.println("<p>Click the following link to test that javax.servlet.AsyncListeners are injectable</p>");
path = context+"asy/xx";
out.println("<form action="+path+" method=\"post\"><button type=\"submit\">Test AsyncListener</button></form>");
out.println("</body>");
out.println("</html>");
out.flush();

View File

@ -62,8 +62,9 @@ public class MultiPartTest extends HttpServlet
response.setContentType("text/html");
ServletOutputStream out = response.getOutputStream();
out.println("<html>");
out.println("<h1>Results</h1>");
out.println("<HEAD><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\"/></HEAD>");
out.println("<body>");
out.println("<h1>Results</h1>");
out.println("<p>");
Collection<Part> parts = request.getParts();

View File

@ -64,17 +64,18 @@ public class RoleAnnotationTest extends HttpServlet
response.setContentType("text/html");
ServletOutputStream out = response.getOutputStream();
out.println("<html>");
out.println("<HEAD><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\"/></HEAD>");
out.println("<h1>Jetty DeclareRoles Annotation Results</h1>");
out.println("<body>");
out.println("<h2>Roles</h2>");
boolean result = request.isUserInRole("other");
out.println("<br/><b>Result: isUserInRole(\"other\")="+result+":"+ (result==false?" PASS":" FAIL")+"</b>");
out.println("<br/><b>Result: isUserInRole(\"other\")="+result+":"+ (result==false?" <span class=\"pass\">PASS":" <span class=\"fail\">FAIL")+"</span></b>");
result = request.isUserInRole("manager");
out.println("<br/><b>Result: isUserInRole(\"manager\")="+result+":"+ (result?" PASS":" FAIL")+"</b>");
out.println("<br/><b>Result: isUserInRole(\"manager\")="+result+":"+ (result?" <span class=\"pass\">PASS":" <span class=\"fail\">FAIL")+"</span></b>");
result = request.isUserInRole("user");
out.println("<br/><b>Result: isUserInRole(\"user\")="+result+":"+ (result==false?" PASS":" FAIL")+"</b>");
out.println("<br/><b>Result: isUserInRole(\"user\")="+result+":"+ (result==false?" <span class=\"pass\">PASS":" <span class=\"fail\">FAIL")+"</span></b>");
String context = _config.getServletContext().getContextPath();
if (!context.endsWith("/"))
context += "/";

View File

@ -40,13 +40,14 @@ public class SecuredServlet extends HttpServlet
{
PrintWriter writer = resp.getWriter();
writer.println( "<html>");
writer.println( "<body>");
writer.println("<h1>@ServletSecurity</h2>");
writer.println("<HEAD><link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\"/></HEAD>");
writer.println("<h1>@ServletSecurity</h1>");
writer.println("<body>");
writer.println("<pre>");
writer.println("@ServletSecurity");
writer.println("public class SecuredServlet");
writer.println("</pre>");
writer.println("<br/><b>Result: "+true+"</b>");
writer.println("<p><b>Result: <span class=\"pass\">PASS</span></b></p>");
String context = getServletConfig().getServletContext().getContextPath();
if (!context.endsWith("/"))
context += "/";

View File

@ -3,13 +3,7 @@
<TITLE>Test Specification WebApp</TITLE>
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache,no-store">
<style>
body {color: #2E2E2E; font-family:sans-serif; font-size:90%;}
h1 {font-variant: small-caps; font-size:130%; letter-spacing: 0.1em;}
h2 {font-variant: small-caps; font-size:100%; letter-spacing: 0.1em;}
h3 {font-size:100%; letter-spacing: 0.1em;}
</style>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
</HEAD>
<BODY >
<A HREF="http://www.eclipse.org/jetty"><IMG SRC="images/jetty_banner.gif"></A>
@ -38,6 +32,18 @@ The source repository for this test is available <a href="http://git.eclipse.org
<button type="submit">Test</button>
</form>
<h3>DeclaresRoles</h3>
<p>Login as user <code>admin</code> with password <code>admin</code> when prompted after clicking the button below to test @DeclareRoles annotation</p>
<form action="role" method="post">
<button type="submit">Test Role Annotations</button>
</form>
<h3>ServletSecurity</h3>
<p>Login as user <code>admin</code> with password <code>admin</code> when prompted after clicking the button below to test @ServletSecurity annotation</p>
<form action="sec/foo" method="post">
<button type="submit">Test ServletSecurity Annotation</button>
</form>
<h3>Test Servlet 3.0 Multipart Mime</h3>
Test of the annotation:
<pre>

View File

@ -1,5 +1,9 @@
<HTML><HEAD><TITLE>Annotation Test</TITLE></HEAD>
<HTML>
<HEAD>
<TITLE>Annotation Test</TITLE>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
</HEAD>
<BODY>
<H1> Enter your username and password to login </H1>
<I> Enter login=admin and password=admin in order to authenticate successfully</I>

View File

@ -0,0 +1,7 @@
body {color: #2E2E2E; font-family:sans-serif; font-size:90%;}
h1 {font-variant: small-caps; font-size:130%; letter-spacing: 0.1em;}
h2 {font-variant: small-caps; font-size:100%; letter-spacing: 0.1em;}
h3 {font-size:100%; letter-spacing: 0.1em;}
span.pass { color: green; }
span.fail { color:red; }