Skip to content

Commit

Permalink
Migrate xtext web to jakarta
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Pirchner <florian.pirchner@gmail.com>
  • Loading branch information
florianpirchner committed Jul 26, 2023
1 parent 530ba80 commit bb61abe
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dependencies {
api "org.webjars:requirejs:2.3.6"
api "org.webjars:jquery:3.6.0"
api "org.webjars:ace:1.3.3"
providedCompile "org.eclipse.jetty:jetty-annotations:9.4.51.v20230217"
providedCompile "org.slf4j:slf4j-simple:1.7.33"
providedCompile "org.eclipse.jetty:jetty-annotations:11.0.15"
providedCompile "org.slf4j:slf4j-simple:2.0.5"
}
task jettyRun(type:JavaExec) {
dependsOn(sourceSets.main.runtimeClasspath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dependencies {
api "org.webjars:requirejs:2.3.6"
api "org.webjars:jquery:3.6.0"
api "org.webjars:ace:1.3.3"
providedCompile "org.eclipse.jetty:jetty-annotations:9.4.51.v20230217"
providedCompile "org.slf4j:slf4j-simple:1.7.33"
providedCompile "org.eclipse.jetty:jetty-annotations:11.0.15"
providedCompile "org.slf4j:slf4j-simple:2.0.5"
}
task jettyRun(type:JavaExec) {
dependsOn(sourceSets.main.runtimeClasspath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<configuration>
<webAppSourceDirectory>WebRoot</webAppSourceDirectory>
</configuration>
Expand Down Expand Up @@ -116,13 +116,13 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.33</version>
<version>2.0.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<configuration>
<webAppSourceDirectory>WebRoot</webAppSourceDirectory>
</configuration>
Expand Down Expand Up @@ -116,13 +116,13 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.33</version>
<version>2.0.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<configuration>
<webAppSourceDirectory>WebRoot</webAppSourceDirectory>
</configuration>
Expand Down Expand Up @@ -116,13 +116,13 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.33</version>
<version>2.0.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<configuration>
<webAppSourceDirectory>WebRoot</webAppSourceDirectory>
</configuration>
Expand Down Expand Up @@ -116,13 +116,13 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.33</version>
<version>2.0.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<configuration>
<webAppSourceDirectory>src/main/webapp</webAppSourceDirectory>
</configuration>
Expand Down Expand Up @@ -106,13 +106,13 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>9.4.51.v20230217</version>
<version>11.0.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.33</version>
<version>2.0.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.xtext.web.example.jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<packaging>war</packaging>

<properties>
<jetty-version>9.4.51.v20230217</jetty-version>
<jetty-version>11.0.15</jetty-version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*******************************************************************************/
package org.eclipse.xtext.web.example.jetty;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import org.eclipse.xtext.util.DisposableRegistry;
import org.eclipse.xtext.web.server.persistence.IResourceBaseProvider;
import org.eclipse.xtext.web.server.persistence.ResourceBaseProviderImpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.log.Slf4jLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.MetaInfConfiguration;
import org.eclipse.jetty.webapp.WebAppConfiguration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebInfConfiguration;
import org.eclipse.jetty.webapp.WebXmlConfiguration;

public class ServerLauncher {

private static final Logger LOG = LoggerFactory.getLogger(ServerLauncher.class);

public static void main(String[] args) {
Server server = new Server(new InetSocketAddress("localhost", 8080));
RewriteHandler rewriteHandler = new RewriteHandler();
Expand All @@ -44,37 +48,35 @@ public static void main(String[] args) {
webAppContext.setResourceBase("../org.eclipse.xtext.web/src/main/js");
webAppContext.setContextPath("/");
webAppContext.setConfigurations(new Configuration[] { new AnnotationConfiguration(), new WebXmlConfiguration(),
new WebInfConfiguration(), new MetaInfConfiguration() });
webAppContext.setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN,
new WebInfConfiguration(), new MetaInfConfiguration(), new WebAppConfiguration() });
webAppContext.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN,
".*/org\\.eclipse\\.xtext\\.web.*,.*/org.webjars.*");

handlerList.setHandlers(new Handler[] { resourceHandler1, resourceHandler2, webAppContext });
rewriteHandler.setHandler(handlerList);
Slf4jLog log = new Slf4jLog(ServerLauncher.class.getName());
try {
server.start();
log.info("Server started " + server.getURI() + "...");
LOG.info("Server started " + server.getURI() + "...");
new Thread() {

public void run() {
try {
log.info("Press enter to stop the server...");
LOG.info("Press enter to stop the server...");
int key = System.in.read();
if (key != -1) {
server.stop();
} else {
log.warn(
LOG.warn(
"Console input is not available. In order to stop the server, you need to cancel process manually.");
}
} catch (Exception e) {
log.warn(e);
LOG.warn(e.getMessage());
}
}

}.start();
server.join();
} catch (Exception exception) {
log.warn(exception.getMessage());
LOG.warn(exception.getMessage());
System.exit(1);
}
}
Expand Down
8 changes: 4 additions & 4 deletions org.eclipse.xtext.web.servlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;

import org.eclipse.xtext.web.server.IServiceContext;
import org.eclipse.xtext.web.server.ISession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
package org.eclipse.xtext.web.servlet;

import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSession;

import org.eclipse.xtext.web.server.ISession;
import org.eclipse.xtext.xbase.lib.Functions.Function0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

import java.io.IOException;
import java.io.InputStream;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.xtext.web.server.XtextServiceDispatcher;
import org.eclipse.xtext.xbase.lib.Exceptions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import java.io.IOException;
import java.util.Set;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.eclipse.emf.common.util.URI;
Expand Down

0 comments on commit bb61abe

Please sign in to comment.