diff --git a/documentation/jetty-asciidoctor-extensions/pom.xml b/documentation/jetty-asciidoctor-extensions/pom.xml index e88868467d7..c81bac6094c 100644 --- a/documentation/jetty-asciidoctor-extensions/pom.xml +++ b/documentation/jetty-asciidoctor-extensions/pom.xml @@ -33,7 +33,7 @@ org.eclipse.jetty.tests - test-distribution + test-distribution-common diff --git a/documentation/jetty-documentation/pom.xml b/documentation/jetty-documentation/pom.xml index 0d6c2f57e54..fbf798d7bd5 100644 --- a/documentation/jetty-documentation/pom.xml +++ b/documentation/jetty-documentation/pom.xml @@ -11,7 +11,9 @@ Jetty :: Documentation jar - ee9 + ${skipTests} + ${skipTests} + ee10 @@ -158,10 +160,6 @@ - - org.eclipse.jetty.toolchain - jetty-jakarta-servlet-api - org.eclipse.jetty jetty-alpn-server @@ -236,16 +234,16 @@ jetty-nosql - org.eclipse.jetty.ee9.websocket - jetty-ee9-websocket-jetty-client + org.eclipse.jetty.${ee.version}.websocket + jetty-${ee.version}-websocket-jetty-client - org.eclipse.jetty.ee9.websocket - jetty-ee9-websocket-jakarta-server + org.eclipse.jetty.${ee.version}.websocket + jetty-${ee.version}-websocket-jakarta-server - org.eclipse.jetty.ee9.websocket - jetty-ee9-websocket-jetty-server + org.eclipse.jetty.${ee.version}.websocket + jetty-${ee.version}-websocket-jetty-server diff --git a/documentation/jetty-documentation/src/main/asciidoc/programming-guide/server/http/server-http-handler.adoc b/documentation/jetty-documentation/src/main/asciidoc/programming-guide/server/http/server-http-handler.adoc index 2e72ed7390f..5ae906339fd 100644 --- a/documentation/jetty-documentation/src/main/asciidoc/programming-guide/server/http/server-http-handler.adoc +++ b/documentation/jetty-documentation/src/main/asciidoc/programming-guide/server/http/server-http-handler.adoc @@ -41,12 +41,11 @@ The corresponding `Handler` tree structure looks like the following: [source,screen] ---- -HandlerCollection -├── HandlerList -│ ├── App1Handler -│ └── HandlerWrapper -│ └── App2Handler +Server └── LoggingHandler + └── Handler.Collection + ├── App1Handler + └── App2Handler ---- Server applications should rarely write custom ``Handler``s, preferring instead to use existing ``Handler``s provided by the Jetty Server Libraries for managing web application contexts, security, HTTP sessions and Servlet support. diff --git a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/WebSocketDocs.java b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/WebSocketDocs.java index c29db7a07df..9801796411f 100644 --- a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/WebSocketDocs.java +++ b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/WebSocketDocs.java @@ -20,18 +20,18 @@ import java.nio.ByteBuffer; import java.nio.file.Path; import java.time.Duration; -import org.eclipse.jetty.ee9.websocket.api.RemoteEndpoint; -import org.eclipse.jetty.ee9.websocket.api.Session; -import org.eclipse.jetty.ee9.websocket.api.StatusCode; -import org.eclipse.jetty.ee9.websocket.api.WebSocketListener; -import org.eclipse.jetty.ee9.websocket.api.WebSocketPartialListener; -import org.eclipse.jetty.ee9.websocket.api.WebSocketPingPongListener; -import org.eclipse.jetty.ee9.websocket.api.WriteCallback; -import org.eclipse.jetty.ee9.websocket.api.annotations.OnWebSocketClose; -import org.eclipse.jetty.ee9.websocket.api.annotations.OnWebSocketConnect; -import org.eclipse.jetty.ee9.websocket.api.annotations.OnWebSocketError; -import org.eclipse.jetty.ee9.websocket.api.annotations.OnWebSocketMessage; -import org.eclipse.jetty.ee9.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.ee10.websocket.api.RemoteEndpoint; +import org.eclipse.jetty.ee10.websocket.api.Session; +import org.eclipse.jetty.ee10.websocket.api.StatusCode; +import org.eclipse.jetty.ee10.websocket.api.WebSocketListener; +import org.eclipse.jetty.ee10.websocket.api.WebSocketPartialListener; +import org.eclipse.jetty.ee10.websocket.api.WebSocketPingPongListener; +import org.eclipse.jetty.ee10.websocket.api.WriteCallback; +import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketError; +import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket; import org.eclipse.jetty.util.IteratingCallback; @SuppressWarnings("unused") diff --git a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/http/HTTPClientDocs.java b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/http/HTTPClientDocs.java index 91ddace1291..33dea519221 100644 --- a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/http/HTTPClientDocs.java +++ b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/http/HTTPClientDocs.java @@ -341,7 +341,7 @@ public class HTTPClientDocs // Offer the content, and release the ByteBuffer // to the pool when the Callback is completed. - content.offer(buffer, Callback.from(() -> bufferPool.release(buffer))); + content.write(buffer, Callback.from(() -> bufferPool.release(buffer))); // Close AsyncRequestContent when all the content is arrived. if (lastContent) @@ -489,7 +489,7 @@ public class HTTPClientDocs public void onContent(Response response, LongConsumer demand, ByteBuffer content, Callback callback) { // When response content is received from server1, forward it to server2. - content2.offer(content, Callback.from(() -> + content2.write(content, Callback.from(() -> { // When the request content to server2 is sent, // succeed the callback to recycle the buffer. diff --git a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/websocket/WebSocketClientDocs.java b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/websocket/WebSocketClientDocs.java index fb234689778..b7187224efe 100644 --- a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/websocket/WebSocketClientDocs.java +++ b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/websocket/WebSocketClientDocs.java @@ -22,10 +22,10 @@ import org.eclipse.jetty.client.HttpProxy; import org.eclipse.jetty.client.HttpRequest; import org.eclipse.jetty.client.HttpResponse; import org.eclipse.jetty.client.dynamic.HttpClientTransportDynamic; -import org.eclipse.jetty.ee9.websocket.api.Session; -import org.eclipse.jetty.ee9.websocket.client.ClientUpgradeRequest; -import org.eclipse.jetty.ee9.websocket.client.JettyUpgradeListener; -import org.eclipse.jetty.ee9.websocket.client.WebSocketClient; +import org.eclipse.jetty.ee10.websocket.api.Session; +import org.eclipse.jetty.ee10.websocket.client.ClientUpgradeRequest; +import org.eclipse.jetty.ee10.websocket.client.JettyUpgradeListener; +import org.eclipse.jetty.ee10.websocket.client.WebSocketClient; import org.eclipse.jetty.http2.client.HTTP2Client; import org.eclipse.jetty.http2.client.http.ClientConnectionFactoryOverHTTP2; import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; diff --git a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/HandlerDocs.java b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/HandlerDocs.java index ffc6da2f9da..086e60395e3 100644 --- a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/HandlerDocs.java +++ b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/HandlerDocs.java @@ -15,10 +15,8 @@ package org.eclipse.jetty.docs.programming.server; import java.io.IOException; import java.io.PrintStream; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.Queue; import java.util.concurrent.Flow; @@ -35,6 +33,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.thread.SerializedInvoker; +@SuppressWarnings("unused") public class HandlerDocs { // TODO this class has been temporarily moved to jetty-core/jetty-demo diff --git a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/http/HTTPServerDocs.java b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/http/HTTPServerDocs.java index 86615425cd1..563f834ec1e 100644 --- a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/http/HTTPServerDocs.java +++ b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/http/HTTPServerDocs.java @@ -16,61 +16,56 @@ package org.eclipse.jetty.docs.programming.server.http; import java.io.IOException; import java.nio.file.Path; import java.util.EnumSet; +import java.util.List; import java.util.TimeZone; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import jakarta.servlet.DispatcherType; -import jakarta.servlet.ServletException; import jakarta.servlet.ServletInputStream; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; -import org.eclipse.jetty.ee9.servlet.DefaultServlet; -import org.eclipse.jetty.ee9.servlet.FilterHolder; -import org.eclipse.jetty.ee9.servlet.ServletContextHandler; -import org.eclipse.jetty.ee9.servlet.ServletHolder; -import org.eclipse.jetty.ee9.servlets.CrossOriginFilter; -import org.eclipse.jetty.ee9.webapp.WebAppContext; +import org.eclipse.jetty.ee10.servlet.DefaultServlet; +import org.eclipse.jetty.ee10.servlet.FilterHolder; +import org.eclipse.jetty.ee10.servlet.ServletContextHandler; +import org.eclipse.jetty.ee10.servlet.ServletHolder; +import org.eclipse.jetty.ee10.servlets.CrossOriginFilter; +import org.eclipse.jetty.ee10.webapp.WebAppContext; import org.eclipse.jetty.http.HttpCompliance; +import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeaderValue; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory; import org.eclipse.jetty.http3.server.HTTP3ServerConnectionFactory; import org.eclipse.jetty.http3.server.HTTP3ServerConnector; +import org.eclipse.jetty.io.Content; import org.eclipse.jetty.rewrite.handler.CompactPathRule; import org.eclipse.jetty.rewrite.handler.RedirectRegexRule; import org.eclipse.jetty.rewrite.handler.RewriteHandler; import org.eclipse.jetty.rewrite.handler.RewriteRegexRule; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.CustomRequestLog; +import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.ProxyConnectionFactory; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.RequestLogWriter; +import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.SecureRequestCustomizer; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.Slf4jRequestLogWriter; import org.eclipse.jetty.server.SslConnectionFactory; -import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.DefaultHandler; -import org.eclipse.jetty.server.handler.HandlerCollection; -import org.eclipse.jetty.server.handler.HandlerList; -import org.eclipse.jetty.server.handler.HandlerWrapper; -import org.eclipse.jetty.server.handler.RequestLogHandler; import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.server.handler.SecuredRedirectHandler; import org.eclipse.jetty.server.handler.StatisticsHandler; import org.eclipse.jetty.server.handler.gzip.GzipHandler; -import org.eclipse.jetty.server.internal.HttpChannelState; import org.eclipse.jetty.unixdomain.server.UnixDomainServerConnector; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.resource.Resource; @@ -78,8 +73,6 @@ import org.eclipse.jetty.util.resource.ResourceCollection; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.QueuedThreadPool; -import static java.lang.System.Logger.Level.INFO; - @SuppressWarnings("unused") public class HTTPServerDocs { @@ -100,14 +93,13 @@ public class HTTPServerDocs server.addConnector(connector); // Set a simple Handler to handle requests/responses. - server.setHandler(new AbstractHandler() + server.setHandler(new Handler.Processor() { @Override - public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) { - // Mark the request as handled so that it - // will not be processed by other handlers. - jettyRequest.setHandled(true); + // Succeed the callback to write the response. + callback.succeeded(); } }); @@ -119,6 +111,8 @@ public class HTTPServerDocs public void httpChannelListener() throws Exception { // tag::httpChannelListener[] + // TODO: HttpChannelState.Listener does not exist anymore. +/* class TimingHttpChannelListener implements HttpChannelState.Listener { private final ConcurrentMap times = new ConcurrentHashMap<>(); @@ -157,6 +151,7 @@ public class HTTPServerDocs }); server.start(); +*/ // end::httpChannelListener[] } @@ -197,6 +192,8 @@ public class HTTPServerDocs mainContext.setContextPath("/main"); // Create a RequestLogHandler to log requests for your main application. + // TODO: RequestLogHandler may need to be re-introduced, to allow per-context logging? +/* RequestLogHandler requestLogHandler = new RequestLogHandler(); requestLogHandler.setRequestLog(new CustomRequestLog()); // Wrap the main application with the request log handler. @@ -208,6 +205,7 @@ public class HTTPServerDocs mainContext.setContextPath("/other"); server.setHandler(new HandlerList(requestLogHandler, otherContext)); +*/ // end::contextRequestLog[] } @@ -475,27 +473,30 @@ public class HTTPServerDocs public void handlerTree() { - class LoggingHandler extends AbstractHandler + class LoggingHandler extends Handler.Processor { @Override - public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) throws Exception { + callback.succeeded(); } } - class App1Handler extends AbstractHandler + class App1Handler extends Handler.Processor { @Override - public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) throws Exception { + callback.succeeded(); } } - class App2Handler extends HandlerWrapper + class App2Handler extends Handler.Processor { @Override - public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) throws Exception { + callback.succeeded(); } } @@ -503,29 +504,23 @@ public class HTTPServerDocs // Create a Server instance. Server server = new Server(); - HandlerCollection collection = new HandlerCollection(); + LoggingHandler loggingHandler = new LoggingHandler(); // Link the root Handler with the Server. - server.setHandler(collection); + server.setHandler(loggingHandler); - HandlerList list = new HandlerList(); - collection.addHandler(list); - collection.addHandler(new LoggingHandler()); - - list.addHandler(new App1Handler()); - HandlerWrapper wrapper = new HandlerWrapper(); - list.addHandler(wrapper); - - wrapper.setHandler(new App2Handler()); + Handler.Collection collection = new Handler.Collection(); + collection.addHandler(new App1Handler()); + collection.addHandler(new App2Handler()); // end::handlerTree[] } public void handlerAPI() { - class MyHandler extends AbstractHandler + class MyHandler extends Handler.Processor { @Override // tag::handlerAPI[] - public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) throws Exception { } // end::handlerAPI[] @@ -535,29 +530,26 @@ public class HTTPServerDocs public void handlerHello() throws Exception { // tag::handlerHello[] - class HelloWorldHandler extends AbstractHandler + class HelloWorldHandler extends Handler.Processor { @Override - public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException + public void process(Request request, Response response, Callback callback) { - // Mark the request as handled by this Handler. - jettyRequest.setHandled(true); - response.setStatus(200); - response.setContentType("text/html; charset=UTF-8"); + response.getHeaders().put(HttpHeader.CONTENT_TYPE, "text/html; charset=UTF-8"); // Write a Hello World response. - response.getWriter().print("" + - "" + - "" + - "" + - " Jetty Hello World Handler" + - "" + - "" + - "

Hello World

" + - "" + - "" + - ""); + Content.Sink.write(response, true, """ + + + + Jetty Hello World Handler + + +

Hello World

+ + + """, callback); } } @@ -574,15 +566,17 @@ public class HTTPServerDocs public void handlerFilter() throws Exception { - class HelloWorldHandler extends AbstractHandler + class HelloWorldHandler extends Handler.Processor { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) { } } // tag::handlerFilter[] + // TODO: This needs to be rewritten using a custom Processor +/* class FilterHandler extends HandlerWrapper { @Override @@ -617,19 +611,19 @@ public class HTTPServerDocs server.setHandler(filter); server.start(); +*/ // end::handlerFilter[] } public void contextHandler() throws Exception { // tag::contextHandler[] - class ShopHandler extends AbstractHandler + class ShopHandler extends Handler.Processor { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) throws Exception { - baseRequest.setHandled(true); - // Implement the shop. + // Implement the shop, remembering to complete the callback. } } @@ -652,23 +646,21 @@ public class HTTPServerDocs public void contextHandlerCollection() throws Exception { // tag::contextHandlerCollection[] - class ShopHandler extends AbstractHandler + class ShopHandler extends Handler.Processor { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) throws Exception { - baseRequest.setHandled(true); - // Implement the shop. + // Implement the shop, remembering to complete the callback. } } - class RESTHandler extends AbstractHandler + class RESTHandler extends Handler.Processor { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) throws Exception { - baseRequest.setHandled(true); - // Implement the REST APIs. + // Implement the REST APIs, remembering to complete the callback. } } @@ -767,9 +759,10 @@ public class HTTPServerDocs // Configure the directory where static resources are located. handler.setBaseResource(Resource.newResource("/path/to/static/resources/")); // Configure directory listing. - handler.setDirectoriesListed(false); + // TODO: is the directoriesListed feature still present? +// handler.setDirectoriesListed(false); // Configure welcome files. - handler.setWelcomeFiles(new String[]{"index.html"}); + handler.setWelcomeFiles(List.of("index.html")); // Configure whether to accept range requests. handler.setAcceptRanges(true); @@ -787,8 +780,9 @@ public class HTTPServerDocs // For multiple directories, use ResourceCollection. ResourceCollection directories = new ResourceCollection(); - directories.addPath("/path/to/static/resources/"); - directories.addPath("/another/path/to/static/resources/"); + // TODO: how to add paths to ResourceCollection? +// directories.addPath("/path/to/static/resources/"); +// directories.addPath("/another/path/to/static/resources/"); handler.setBaseResource(directories); // end::multipleResourcesHandler[] @@ -840,23 +834,21 @@ public class HTTPServerDocs public void contextGzipHandler() throws Exception { - class ShopHandler extends AbstractHandler + class ShopHandler extends Handler.Processor { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException + public void process(Request request, Response response, Callback callback) throws Exception { - baseRequest.setHandled(true); - // Implement the shop. + // Implement the shop, remembering to complete the callback. } } - class RESTHandler extends AbstractHandler + class RESTHandler extends Handler.Processor { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + public void process(Request request, Response response, Callback callback) throws Exception { - baseRequest.setHandled(true); - // Implement the REST APIs. + // Implement the REST APIs, remembering to complete the callback. } } @@ -999,8 +991,8 @@ public class HTTPServerDocs Connector connector = new ServerConnector(server); server.addConnector(connector); - // Create a HandlerList. - HandlerList handlerList = new HandlerList(); + // Create a Handler collection. + Handler.Collection handlerList = new Handler.Collection(); // Add as first a ContextHandlerCollection to manage contexts. ContextHandlerCollection contexts = new ContextHandlerCollection(); diff --git a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/session/SessionDocs.java b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/session/SessionDocs.java index 9d4c3eb7d4d..01a044b4d3d 100644 --- a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/session/SessionDocs.java +++ b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/session/SessionDocs.java @@ -16,8 +16,9 @@ package org.eclipse.jetty.docs.programming.server.session; import java.io.File; import java.net.InetSocketAddress; -import org.eclipse.jetty.ee9.servlet.ServletContextHandler; -import org.eclipse.jetty.ee9.webapp.WebAppContext; +import org.eclipse.jetty.ee10.servlet.ServletContextHandler; +import org.eclipse.jetty.ee10.servlet.SessionHandler; +import org.eclipse.jetty.ee10.webapp.WebAppContext; import org.eclipse.jetty.memcached.session.MemcachedSessionDataMapFactory; import org.eclipse.jetty.nosql.mongodb.MongoSessionDataStoreFactory; import org.eclipse.jetty.server.Server; @@ -34,7 +35,6 @@ import org.eclipse.jetty.session.NullSessionCache; import org.eclipse.jetty.session.NullSessionCacheFactory; import org.eclipse.jetty.session.NullSessionDataStore; import org.eclipse.jetty.session.SessionCache; -import org.eclipse.jetty.session.SessionHandler; @SuppressWarnings("unused") public class SessionDocs @@ -46,7 +46,7 @@ public class SessionDocs DefaultSessionIdManager idMgr = new DefaultSessionIdManager(server); //you must set the workerName unless you set the env viable JETTY_WORKER_NAME idMgr.setWorkerName("server3"); - server.setSessionIdManager(idMgr); + server.addBean(idMgr, true); //end::default[] } @@ -58,7 +58,7 @@ public class SessionDocs Server server = new Server(); DefaultSessionIdManager idMgr = new DefaultSessionIdManager(server); idMgr.setWorkerName("server7"); - server.setSessionIdManager(idMgr); + server.addBean(idMgr, true); HouseKeeper houseKeeper = new HouseKeeper(); houseKeeper.setSessionIdManager(idMgr); @@ -169,7 +169,9 @@ public class SessionDocs //Add a webapp that uses an explicit NullSessionCache instead WebAppContext app2 = new WebAppContext(); app2.setContextPath("/app2"); - NullSessionCache nullSessionCache = new NullSessionCache(app2.getSessionHandler()); + // TODO +// NullSessionCache nullSessionCache = new NullSessionCache(app2.getSessionHandler()); + NullSessionCache nullSessionCache = null; nullSessionCache.setFlushOnResponseCommit(true); nullSessionCache.setRemoveUnloadableSessions(true); nullSessionCache.setSaveOnCreate(true); @@ -220,7 +222,9 @@ public class SessionDocs app1.setContextPath("/app1"); //First, we create a DefaultSessionCache - DefaultSessionCache cache = new DefaultSessionCache(app1.getSessionHandler()); + // TODO +// DefaultSessionCache cache = new DefaultSessionCache(app1.getSessionHandler()); + DefaultSessionCache cache = null; cache.setEvictionPolicy(SessionCache.NEVER_EVICT); cache.setFlushOnResponseCommit(true); cache.setInvalidateOnShutdown(false); diff --git a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/websocket/WebSocketServerDocs.java b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/websocket/WebSocketServerDocs.java index 8776f670b9c..a8cc3a8689b 100644 --- a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/websocket/WebSocketServerDocs.java +++ b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/server/websocket/WebSocketServerDocs.java @@ -24,15 +24,15 @@ import jakarta.websocket.DeploymentException; import jakarta.websocket.server.ServerContainer; import jakarta.websocket.server.ServerEndpoint; import jakarta.websocket.server.ServerEndpointConfig; -import org.eclipse.jetty.ee9.servlet.ServletContextHandler; -import org.eclipse.jetty.ee9.webapp.WebAppContext; -import org.eclipse.jetty.ee9.websocket.api.annotations.WebSocket; -import org.eclipse.jetty.ee9.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; -import org.eclipse.jetty.ee9.websocket.server.JettyWebSocketCreator; -import org.eclipse.jetty.ee9.websocket.server.JettyWebSocketServerContainer; -import org.eclipse.jetty.ee9.websocket.server.JettyWebSocketServlet; -import org.eclipse.jetty.ee9.websocket.server.JettyWebSocketServletFactory; -import org.eclipse.jetty.ee9.websocket.server.config.JettyWebSocketServletContainerInitializer; +import org.eclipse.jetty.ee10.servlet.ServletContextHandler; +import org.eclipse.jetty.ee10.webapp.WebAppContext; +import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; +import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketCreator; +import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketServerContainer; +import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketServlet; +import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketServletFactory; +import org.eclipse.jetty.ee10.websocket.server.config.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.server.Server; @SuppressWarnings("unused") diff --git a/jetty-ee10/jetty-ee10-bom/pom.xml b/jetty-ee10/jetty-ee10-bom/pom.xml index c01c4b1b73d..c4e0cb6c73d 100644 --- a/jetty-ee10/jetty-ee10-bom/pom.xml +++ b/jetty-ee10/jetty-ee10-bom/pom.xml @@ -169,7 +169,7 @@ jakarta.servlet jakarta.servlet-api - ${jetty.servlet.api.version} + ${jakarta.servlet.api.version} org.eclipse.jetty.orbit diff --git a/pom.xml b/pom.xml index 30577767f4a..111e4af3080 100644 --- a/pom.xml +++ b/pom.xml @@ -194,7 +194,7 @@ jetty-home tests - + documentation @@ -1489,7 +1489,7 @@ org.eclipse.jetty.tests - test-distribution + test-distribution-common ${project.version}