Merge branch 'jetty-9.3.x'

This commit is contained in:
Joakim Erdfelt 2016-03-08 15:53:50 -07:00
commit e7081d7b84
5 changed files with 39 additions and 2 deletions

View File

@ -13,6 +13,7 @@ bin=application/octet-stream
bmp=image/bmp
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

View File

@ -56,6 +56,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";
private boolean _sniHostCheck;
private long _stsMaxAge=-1;
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.key_size",keySize);
request.setAttribute("javax.servlet.request.ssl_session_id", idStr);
request.setAttribute(getSslSessionAttribute(), sslSession);
}
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
public String toString()
{

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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<Session> openSessions = session.getOpenSessions();
writeMessage("OpenSessions.size() = " + openSessions.size());
int i = 0;
for (Session open : openSessions)
{
writeMessage(" OpenSession[%d] = %s", i++, open);
}
break;
}
case "many":