Merge branch 'jetty-9.3.x'
This commit is contained in:
commit
e7081d7b84
|
@ -13,6 +13,7 @@ bin=application/octet-stream
|
||||||
bmp=image/bmp
|
bmp=image/bmp
|
||||||
cab=application/x-cabinet
|
cab=application/x-cabinet
|
||||||
cdf=application/x-netcdf
|
cdf=application/x-netcdf
|
||||||
|
chm=application/vnd.ms-htmlhelp
|
||||||
class=application/java-vm
|
class=application/java-vm
|
||||||
cpio=application/x-cpio
|
cpio=application/x-cpio
|
||||||
cpt=application/mac-compactpro
|
cpt=application/mac-compactpro
|
||||||
|
|
|
@ -56,6 +56,8 @@ public class SecureRequestCustomizer implements HttpConfiguration.Customizer
|
||||||
*/
|
*/
|
||||||
public static final String CACHED_INFO_ATTR = CachedInfo.class.getName();
|
public static final String CACHED_INFO_ATTR = CachedInfo.class.getName();
|
||||||
|
|
||||||
|
private String sslSessionAttribute = "org.eclipse.jetty.servlet.request.ssl_session";
|
||||||
|
|
||||||
private boolean _sniHostCheck;
|
private boolean _sniHostCheck;
|
||||||
private long _stsMaxAge=-1;
|
private long _stsMaxAge=-1;
|
||||||
private boolean _stsIncludeSubDomains;
|
private boolean _stsIncludeSubDomains;
|
||||||
|
@ -270,6 +272,7 @@ public class SecureRequestCustomizer implements HttpConfiguration.Customizer
|
||||||
request.setAttribute("javax.servlet.request.cipher_suite",cipherSuite);
|
request.setAttribute("javax.servlet.request.cipher_suite",cipherSuite);
|
||||||
request.setAttribute("javax.servlet.request.key_size",keySize);
|
request.setAttribute("javax.servlet.request.key_size",keySize);
|
||||||
request.setAttribute("javax.servlet.request.ssl_session_id", idStr);
|
request.setAttribute("javax.servlet.request.ssl_session_id", idStr);
|
||||||
|
request.setAttribute(getSslSessionAttribute(), sslSession);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -277,6 +280,16 @@ public class SecureRequestCustomizer implements HttpConfiguration.Customizer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSslSessionAttribute(String attribute)
|
||||||
|
{
|
||||||
|
this.sslSessionAttribute = attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSslSessionAttribute()
|
||||||
|
{
|
||||||
|
return sslSessionAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
|
|
|
@ -245,12 +245,14 @@ public class ServerContainer extends ClientContainer implements javax.websocket.
|
||||||
@Override
|
@Override
|
||||||
public void onSessionClosed(WebSocketSession session)
|
public void onSessionClosed(WebSocketSession session)
|
||||||
{
|
{
|
||||||
|
super.onSessionClosed(session);
|
||||||
webSocketServerFactory.onSessionClosed(session);
|
webSocketServerFactory.onSessionClosed(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSessionOpened(WebSocketSession session)
|
public void onSessionOpened(WebSocketSession session)
|
||||||
{
|
{
|
||||||
|
super.onSessionOpened(session);
|
||||||
webSocketServerFactory.onSessionOpened(session);
|
webSocketServerFactory.onSessionOpened(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,11 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.jsr356.server.browser;
|
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.servlet.ServletException;
|
||||||
import javax.websocket.DeploymentException;
|
import javax.websocket.DeploymentException;
|
||||||
|
|
||||||
|
@ -30,6 +35,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
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.ServerContainer;
|
||||||
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
|
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
|
||||||
|
|
||||||
|
@ -78,7 +84,7 @@ public class JsrBrowserDebugTool
|
||||||
server.join();
|
server.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupServer(int port) throws DeploymentException, ServletException
|
private void setupServer(int port) throws DeploymentException, ServletException, URISyntaxException, MalformedURLException
|
||||||
{
|
{
|
||||||
server = new Server();
|
server = new Server();
|
||||||
|
|
||||||
|
@ -89,10 +95,16 @@ public class JsrBrowserDebugTool
|
||||||
connector.setPort(port);
|
connector.setPort(port);
|
||||||
server.addConnector(connector);
|
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);
|
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
||||||
context.setContextPath("/");
|
context.setContextPath("/");
|
||||||
|
context.setBaseResource(Resource.newResource(urlBase));
|
||||||
|
|
||||||
ServletHolder holder = context.addServlet(DefaultServlet.class,"/");
|
ServletHolder holder = context.addServlet(DefaultServlet.class,"/");
|
||||||
holder.setInitParameter("resourceBase","src/test/resources/jsr-browser-debug-tool");
|
|
||||||
holder.setInitParameter("dirAllowed","true");
|
holder.setInitParameter("dirAllowed","true");
|
||||||
server.setHandler(context);
|
server.setHandler(context);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.websocket.CloseReason;
|
import javax.websocket.CloseReason;
|
||||||
import javax.websocket.OnClose;
|
import javax.websocket.OnClose;
|
||||||
|
@ -129,6 +130,14 @@ public class JsrBrowserSocket
|
||||||
{
|
{
|
||||||
writeMessage("Client Sec-WebSocket-Extensions: " + this.requestedExtensions);
|
writeMessage("Client Sec-WebSocket-Extensions: " + this.requestedExtensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<Session> openSessions = session.getOpenSessions();
|
||||||
|
writeMessage("OpenSessions.size() = " + openSessions.size());
|
||||||
|
int i = 0;
|
||||||
|
for (Session open : openSessions)
|
||||||
|
{
|
||||||
|
writeMessage(" OpenSession[%d] = %s", i++, open);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "many":
|
case "many":
|
||||||
|
|
Loading…
Reference in New Issue