Skip to content

Commit

Permalink
#53 remove servlet test support
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorsten Marx committed Nov 5, 2023
1 parent b45badf commit 5f6748e
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 695 deletions.
5 changes: 0 additions & 5 deletions cms-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
<artifactId>jetty-http</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public abstract class JettyHttpHandlerExtensionPoint extends AbstractExtensionPo

abstract public String getContextPath();

abstract public Mapping getHandler();
abstract public Mapping getMapping();

}

This file was deleted.

This file was deleted.

Binary file not shown.
5 changes: 0 additions & 5 deletions cms-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-servlet</artifactId>
<version>12.0.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,14 @@
* #L%
*/
import com.github.thmarx.cms.api.ServerProperties;
import com.github.thmarx.cms.api.extensions.JettyHttpHandlerExtensionPoint;
import com.github.thmarx.cms.api.extensions.ServletExtensionPoint;
import com.github.thmarx.cms.server.jetty.handler.JettyDefaultHandler;
import com.github.thmarx.cms.server.jetty.handler.JettyExtensionHandler;
import com.github.thmarx.cms.server.VHost;
import com.github.thmarx.cms.server.jetty.handler.JettyModuleMappingHandler;
import com.github.thmarx.cms.server.jetty.handler.JettyServletModuleMappingHandler;
import jakarta.servlet.http.HttpServlet;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.http.pathmap.PathSpec;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.ContextHandler;
Expand Down Expand Up @@ -88,8 +83,7 @@ public Handler httpHandler() {
ContextHandlerCollection contextCollection = new ContextHandlerCollection(
defaultContextHandler,
moduleContextHandler,
extensionContextHandler,
servletContexteHandler()
extensionContextHandler
);

GzipHandler gzipHandler = new GzipHandler(contextCollection);
Expand All @@ -101,25 +95,4 @@ public Handler httpHandler() {

return gzipHandler;
}

private ServletContextHandler servletContexteHandler() {
ServletContextHandler contextHandler = new ServletContextHandler("/servlet-modules");
//contextHandler.addServlet(new JettyServletModuleMappingHandler(moduleManager, siteProperties), "/*");

siteProperties.activeModules().forEach((var moduleid) -> {
final com.github.thmarx.modules.api.Module module = moduleManager
.module(moduleid);
if (module.provides(ServletExtensionPoint.class)) {
List<ServletExtensionPoint> extensions = module.extensions(ServletExtensionPoint.class);
extensions.forEach(ext -> {
ext.getMapping().getServletMappings().forEach((path, servlet) -> {
contextHandler.addServlet(servlet, "/%s%s".formatted(moduleid, path));
});

});
}
});

return contextHandler;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void init () {
.module(moduleid);
if (module.provides(JettyHttpHandlerExtensionPoint.class)) {
List<JettyHttpHandlerExtensionPoint> extensions = module.extensions(JettyHttpHandlerExtensionPoint.class);
extensions.forEach(ext -> moduleMappgings.put(moduleid, ext.getHandler()));
extensions.forEach(ext -> moduleMappgings.put(moduleid, ext.getMapping()));
}
});
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public String getContextPath() {
}

@Override
public Mapping getHandler() {
public Mapping getMapping() {
Mapping mapping = new Mapping();
mapping.add(PathSpec.from("/world"), new ExampleHandler("Hello world!"));
mapping.add(PathSpec.from("/people"), new ExampleHandler("Hello people!"));
Expand Down

This file was deleted.

Loading

0 comments on commit 5f6748e

Please sign in to comment.