Skip to content

Commit

Permalink
EE 8 to EE 9
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed May 16, 2024
1 parent 4845bb9 commit 3f566c2
Show file tree
Hide file tree
Showing 186 changed files with 11,385 additions and 290 deletions.
2 changes: 1 addition & 1 deletion core/example/src/example/Book.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package example;

import jakarta.servlet.ServletException;
import java.io.IOException;
import javax.servlet.ServletException;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

Expand Down
2 changes: 1 addition & 1 deletion core/example/src/example/BookStore.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package example;

import jakarta.servlet.ServletException;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
import javax.servlet.ServletException;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

Expand Down
4 changes: 2 additions & 2 deletions core/example/src/example/WebAppMain.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package example;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import org.kohsuke.stapler.Stapler;

/**
Expand Down
18 changes: 9 additions & 9 deletions core/maven-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
<version>1.253</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>2.0.0</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.0</version>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion core/maven-example/src/main/java/example/Book.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package example;

import jakarta.servlet.ServletException;
import java.io.IOException;
import javax.servlet.ServletException;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

Expand Down
2 changes: 1 addition & 1 deletion core/maven-example/src/main/java/example/BookStore.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package example;

import jakarta.servlet.ServletException;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
import javax.servlet.ServletException;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

Expand Down
4 changes: 2 additions & 2 deletions core/maven-example/src/main/java/example/WebAppMain.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package example;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import org.kohsuke.stapler.Stapler;

/**
Expand Down
50 changes: 39 additions & 11 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@
<artifactId>stapler</artifactId>
<name>Stapler</name>
<description>Stapler HTTP request handling engine</description>

<properties>
<bridge-method-injector.version>1.29</bridge-method-injector.version>
<commons-fileupload2.version>2.0.0-M2</commons-fileupload2.version>
</properties>

<dependencies>
<dependency>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-annotation</artifactId>
<version>${bridge-method-injector.version}</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
Expand Down Expand Up @@ -38,12 +49,6 @@
<artifactId>commons-discovery</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<!-- perhaps mark this dependency optional? -->
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand All @@ -63,6 +68,17 @@
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<!-- perhaps mark these dependencies optional? -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-fileupload2-core</artifactId>
<version>${commons-fileupload2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-fileupload2-jakarta-servlet5</artifactId>
<version>${commons-fileupload2.version}</version>
</dependency>
<dependency>
<!--
To allow stapler to be used from Groovy, code, we have a bit of tooling
Expand Down Expand Up @@ -103,7 +119,7 @@
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>4.0.4</version>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -135,13 +151,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-servlet</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-webapp</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -178,6 +194,18 @@

<build>
<plugins>
<plugin>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-injector</artifactId>
<version>${bridge-method-injector.version}</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
Expand Down
58 changes: 58 additions & 0 deletions core/src/main/java/javax/servlet/AsyncContext.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2017, 2018 Oracle and/or its affiliates and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://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: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package javax.servlet;

public interface AsyncContext {
String ASYNC_REQUEST_URI = "javax.servlet.async.request_uri";

String ASYNC_CONTEXT_PATH = "javax.servlet.async.context_path";

String ASYNC_MAPPING = "javax.servlet.async.mapping";

String ASYNC_PATH_INFO = "javax.servlet.async.path_info";

String ASYNC_SERVLET_PATH = "javax.servlet.async.servlet_path";

String ASYNC_QUERY_STRING = "javax.servlet.async.query_string";

ServletRequest getRequest();

ServletResponse getResponse();

boolean hasOriginalRequestAndResponse();

void dispatch();

void dispatch(String path);

void dispatch(ServletContext context, String path);

void complete();

void start(Runnable run);

void addListener(AsyncListener listener);

void addListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse);

<T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException;

void setTimeout(long timeout);

long getTimeout();
}
60 changes: 60 additions & 0 deletions core/src/main/java/javax/servlet/AsyncEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://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: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package javax.servlet;

public class AsyncEvent {
private AsyncContext context;
private ServletRequest request;
private ServletResponse response;
private Throwable throwable;

public AsyncEvent(AsyncContext context) {
this(context, context.getRequest(), context.getResponse(), null);
}

public AsyncEvent(AsyncContext context, ServletRequest request, ServletResponse response) {
this(context, request, response, null);
}

public AsyncEvent(AsyncContext context, Throwable throwable) {
this(context, context.getRequest(), context.getResponse(), throwable);
}

public AsyncEvent(AsyncContext context, ServletRequest request, ServletResponse response, Throwable throwable) {
this.context = context;
this.request = request;
this.response = response;
this.throwable = throwable;
}

public AsyncContext getAsyncContext() {
return context;
}

public ServletRequest getSuppliedRequest() {
return request;
}

public ServletResponse getSuppliedResponse() {
return response;
}

public Throwable getThrowable() {
return throwable;
}
}
31 changes: 31 additions & 0 deletions core/src/main/java/javax/servlet/AsyncListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 2018 Oracle and/or its affiliates and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://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: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package javax.servlet;

import java.io.IOException;
import java.util.EventListener;

public interface AsyncListener extends EventListener {
void onComplete(AsyncEvent event) throws IOException;

void onTimeout(AsyncEvent event) throws IOException;

void onError(AsyncEvent event) throws IOException;

void onStartAsync(AsyncEvent event) throws IOException;
}
60 changes: 60 additions & 0 deletions core/src/main/java/javax/servlet/DispatcherType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2017, 2018 Oracle and/or its affiliates and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://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: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package javax.servlet;

public enum DispatcherType {
FORWARD,
INCLUDE,
REQUEST,
ASYNC,
ERROR;

public static jakarta.servlet.DispatcherType toJakartaDispatcherType(DispatcherType from) {
switch (from) {
case FORWARD:
return jakarta.servlet.DispatcherType.FORWARD;
case INCLUDE:
return jakarta.servlet.DispatcherType.INCLUDE;
case REQUEST:
return jakarta.servlet.DispatcherType.REQUEST;
case ASYNC:
return jakarta.servlet.DispatcherType.ASYNC;
case ERROR:
return jakarta.servlet.DispatcherType.ERROR;
default:
throw new IllegalArgumentException("Unknown DispatcherType: " + from);
}
}

public static DispatcherType fromJakartaDispatcherType(jakarta.servlet.DispatcherType from) {
switch (from) {
case FORWARD:
return DispatcherType.FORWARD;
case INCLUDE:
return DispatcherType.INCLUDE;
case REQUEST:
return DispatcherType.REQUEST;
case ASYNC:
return DispatcherType.ASYNC;
case ERROR:
return DispatcherType.ERROR;
default:
throw new IllegalArgumentException("Unknown DispatcherType: " + from);
}
}
}
Loading

0 comments on commit 3f566c2

Please sign in to comment.