-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jetty 10.0.x methodhandles lookup linkage (#4552)
* use a lookup dedicated to the target class (webapp classloader) to avoid collision with server classloader Signed-off-by: olivier lamy <oliver.lamy@gmail.com> * cleanup war test dependencies Signed-off-by: olivier lamy <oliver.lamy@gmail.com> * remove empty lines Signed-off-by: olivier lamy <oliver.lamy@gmail.com> * make it clear it is a bad websocket webapp only for testing purpose and add a good websocket webapp Signed-off-by: olivier lamy <oliver.lamy@gmail.com> * no need anymore of this dependency Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
- Loading branch information
Showing
16 changed files
with
445 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>org.eclipse.jetty.tests</groupId> | ||
<artifactId>test-webapps-parent</artifactId> | ||
<version>10.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>test-bad-websocket-webapp</artifactId> | ||
<packaging>war</packaging> | ||
|
||
<name>Test :: Jetty Bad Websocket Simple Webapp</name> | ||
<description>Contains wrong websocket which should fail at deployment</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.jetty.toolchain</groupId> | ||
<artifactId>jetty-javax-websocket-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty.websocket</groupId> | ||
<artifactId>websocket-javax-common</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty.toolchain</groupId> | ||
<artifactId>jetty-servlet-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
53 changes: 53 additions & 0 deletions
53
.../src/main/java/org/eclipse/jetty/tests/webapp/websocket/bad/BadOnCloseServerEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under | ||
// the terms of the Eclipse Public License 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0 | ||
// | ||
// This Source Code may also be made available under the following | ||
// Secondary Licenses when the conditions for such availability set | ||
// forth in the Eclipse Public License, v. 2.0 are satisfied: | ||
// the Apache License v2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.tests.webapp.websocket.bad; | ||
|
||
import java.io.IOException; | ||
import javax.websocket.OnClose; | ||
import javax.websocket.OnError; | ||
import javax.websocket.OnMessage; | ||
import javax.websocket.Session; | ||
import javax.websocket.server.PathParam; | ||
import javax.websocket.server.ServerEndpoint; | ||
|
||
@ServerEndpoint("/badonclose/{arg}") | ||
public class BadOnCloseServerEndpoint | ||
{ | ||
private static String close = ""; | ||
|
||
@OnMessage | ||
public String echo(String echo) | ||
{ | ||
return close + echo; | ||
} | ||
|
||
@OnClose | ||
public void onClose(Session session, @PathParam("arg") StringSequence sb) | ||
{ | ||
close = sb.toString(); | ||
} | ||
|
||
@OnError | ||
public void onError(Session session, Throwable t) | ||
throws IOException | ||
{ | ||
String message = "Error happened:" + t.getMessage(); | ||
session.getBasicRemote().sendText(message); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...p/src/main/java/org/eclipse/jetty/tests/webapp/websocket/bad/BadOnOpenServerEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under | ||
// the terms of the Eclipse Public License 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0 | ||
// | ||
// This Source Code may also be made available under the following | ||
// Secondary Licenses when the conditions for such availability set | ||
// forth in the Eclipse Public License, v. 2.0 are satisfied: | ||
// the Apache License v2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.tests.webapp.websocket.bad; | ||
|
||
import java.io.IOException; | ||
import javax.websocket.OnError; | ||
import javax.websocket.OnMessage; | ||
import javax.websocket.OnOpen; | ||
import javax.websocket.Session; | ||
import javax.websocket.server.PathParam; | ||
import javax.websocket.server.ServerEndpoint; | ||
|
||
@ServerEndpoint("/badonopen/{arg}") | ||
public class BadOnOpenServerEndpoint | ||
{ | ||
private static String open = ""; | ||
|
||
@OnMessage | ||
public String echo(String echo) | ||
{ | ||
return open + echo; | ||
} | ||
|
||
@OnOpen | ||
public void onOpen(Session session, @PathParam("arg") StringSequence sb) | ||
{ | ||
open = sb.toString(); | ||
} | ||
|
||
@OnError | ||
public void onError(Session session, Throwable t) | ||
throws IOException | ||
{ | ||
String message = "Error happened:" + t.getMessage(); | ||
session.getBasicRemote().sendText(message); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...ket-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/bad/StringSequence.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under | ||
// the terms of the Eclipse Public License 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0 | ||
// | ||
// This Source Code may also be made available under the following | ||
// Secondary Licenses when the conditions for such availability set | ||
// forth in the Eclipse Public License, v. 2.0 are satisfied: | ||
// the Apache License v2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.tests.webapp.websocket.bad; | ||
|
||
public class StringSequence | ||
implements CharSequence | ||
{ | ||
public String stringBuffer = ""; | ||
|
||
public StringSequence(String hold) | ||
{ | ||
stringBuffer = hold; | ||
} | ||
|
||
public StringSequence() | ||
{ | ||
} | ||
|
||
@Override | ||
public int length() | ||
{ | ||
return stringBuffer.length(); | ||
} | ||
|
||
@Override | ||
public char charAt(int index) | ||
{ | ||
return stringBuffer.charAt(index); | ||
} | ||
|
||
@Override | ||
public CharSequence subSequence(int start, int end) | ||
{ | ||
return stringBuffer.subSequence(start, end); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return stringBuffer; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/test-webapps/test-bad-websocket-webapp/src/main/webapp/WEB-INF/web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?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" | ||
metadata-complete="false" | ||
version="3.1"> | ||
|
||
<display-name>Very Simple Bad Websocket Application</display-name> | ||
</web-app> |
5 changes: 5 additions & 0 deletions
5
tests/test-webapps/test-bad-websocket-webapp/src/main/webapp/index.jsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html> | ||
<body> | ||
<h2>Hello World!</h2> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>org.eclipse.jetty.tests</groupId> | ||
<artifactId>test-webapps-parent</artifactId> | ||
<version>10.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>test-websocket-webapp</artifactId> | ||
<packaging>war</packaging> | ||
|
||
<name>Test :: Jetty Websocket Simple Webapp</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.jetty.toolchain</groupId> | ||
<artifactId>jetty-javax-websocket-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty.websocket</groupId> | ||
<artifactId>websocket-javax-common</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty.toolchain</groupId> | ||
<artifactId>jetty-servlet-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
Oops, something went wrong.