From 2cc50ed92522e28232865189be487a0b21f93b62 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 7 Mar 2016 16:32:36 -0700 Subject: [PATCH 1/4] Issue #316 - Add *.chm mimetype mapping --- .../src/main/resources/org/eclipse/jetty/http/mime.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/jetty-http/src/main/resources/org/eclipse/jetty/http/mime.properties b/jetty-http/src/main/resources/org/eclipse/jetty/http/mime.properties index 654454c7a14..302cbd0a0b5 100644 --- a/jetty-http/src/main/resources/org/eclipse/jetty/http/mime.properties +++ b/jetty-http/src/main/resources/org/eclipse/jetty/http/mime.properties @@ -12,6 +12,7 @@ bcpio=application/x-bcpio bin=application/octet-stream cab=application/x-cabinet cdf=application/x-netcdf +chm=application/vnd.ms-htmlhelp class=application/java-vm cpio=application/x-cpio cpt=application/mac-compactpro From 195a02fdaaeae47512ea1ee1e3849c8e0fe137c2 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 8 Mar 2016 14:27:38 -0700 Subject: [PATCH 2/4] Issue #85 - Expose TLS protocol used for connection in SecureRequestCustomizer --- .../jetty/server/SecureRequestCustomizer.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/SecureRequestCustomizer.java b/jetty-server/src/main/java/org/eclipse/jetty/server/SecureRequestCustomizer.java index dc6cf79d5d1..bf36446511a 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/SecureRequestCustomizer.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/SecureRequestCustomizer.java @@ -48,6 +48,8 @@ public class SecureRequestCustomizer implements HttpConfiguration.Customizer */ public static final String CACHED_INFO_ATTR = CachedInfo.class.getName(); + private String sslSessionAttribute = "org.eclipse.jetty.servlet.request.ssl_session"; + @Override public void customize(Connector connector, HttpConfiguration channelConfig, Request request) { @@ -118,12 +120,23 @@ public class SecureRequestCustomizer implements HttpConfiguration.Customizer request.setAttribute("javax.servlet.request.cipher_suite",cipherSuite); request.setAttribute("javax.servlet.request.key_size",keySize); request.setAttribute("javax.servlet.request.ssl_session_id", idStr); + request.setAttribute(getSslSessionAttribute(), sslSession); } catch (Exception e) { LOG.warn(Log.EXCEPTION,e); } } + + public void setSslSessionAttribute(String attribute) + { + this.sslSessionAttribute = attribute; + } + + public String getSslSessionAttribute() + { + return sslSessionAttribute; + } @Override public String toString() From 98448262eac41178d39624e61aca0c3e4c2492a4 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 8 Mar 2016 15:14:54 -0700 Subject: [PATCH 3/4] Making servlet context base resource discovery more robust --- .../server/browser/JsrBrowserDebugTool.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserDebugTool.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserDebugTool.java index ce8d230bbb6..ac5f8410f61 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserDebugTool.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserDebugTool.java @@ -18,6 +18,11 @@ package org.eclipse.jetty.websocket.jsr356.server.browser; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Objects; + import javax.servlet.ServletException; import javax.websocket.DeploymentException; @@ -30,6 +35,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.websocket.jsr356.server.ServerContainer; import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer; @@ -78,7 +84,7 @@ public class JsrBrowserDebugTool server.join(); } - private void setupServer(int port) throws DeploymentException, ServletException + private void setupServer(int port) throws DeploymentException, ServletException, URISyntaxException, MalformedURLException { server = new Server(); @@ -89,10 +95,16 @@ public class JsrBrowserDebugTool connector.setPort(port); server.addConnector(connector); + String resourcePath = "/jsr-browser-debug-tool/index.html"; + URL urlStatics = JsrBrowserDebugTool.class.getResource(resourcePath); + Objects.requireNonNull(urlStatics,"Unable to find " + resourcePath + " in classpath"); + String urlBase = urlStatics.toURI().toASCIIString().replaceFirst("/[^/]*$","/"); + ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); + context.setBaseResource(Resource.newResource(urlBase)); + ServletHolder holder = context.addServlet(DefaultServlet.class,"/"); - holder.setInitParameter("resourceBase","src/test/resources/jsr-browser-debug-tool"); holder.setInitParameter("dirAllowed","true"); server.setHandler(context); From db4b920ae4d2227b9bc73b90d8c973256c334dab Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 8 Mar 2016 15:15:21 -0700 Subject: [PATCH 4/4] Issue #407 - JSR356 Server WebSocket Sessions no longer being tracked --- .../jetty/websocket/jsr356/server/ServerContainer.java | 2 ++ .../jsr356/server/browser/JsrBrowserSocket.java | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java index 8d114c37e05..b21344a1163 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java +++ b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java @@ -245,12 +245,14 @@ public class ServerContainer extends ClientContainer implements javax.websocket. @Override public void onSessionClosed(WebSocketSession session) { + super.onSessionClosed(session); webSocketServerFactory.onSessionClosed(session); } @Override public void onSessionOpened(WebSocketSession session) { + super.onSessionOpened(session); webSocketServerFactory.onSessionOpened(session); } } diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java index 3b17bdb3c0e..d724913577a 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java @@ -23,6 +23,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import java.util.Random; +import java.util.Set; import javax.websocket.CloseReason; import javax.websocket.OnClose; @@ -129,6 +130,14 @@ public class JsrBrowserSocket { writeMessage("Client Sec-WebSocket-Extensions: " + this.requestedExtensions); } + + Set openSessions = session.getOpenSessions(); + writeMessage("OpenSessions.size() = " + openSessions.size()); + int i = 0; + for (Session open : openSessions) + { + writeMessage(" OpenSession[%d] = %s", i++, open); + } break; } case "many":