Improved SPDY connector to take into account confidential and integral settings.

This commit is contained in:
Simone Bordet 2012-03-12 15:31:23 +01:00
parent 41874b5fbe
commit 9158115a82
2 changed files with 42 additions and 2 deletions

View File

@ -16,6 +16,11 @@
package org.eclipse.jetty.spdy.http;
import java.io.IOException;
import org.eclipse.jetty.http.HttpSchemes;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.spdy.AsyncConnectionFactory;
import org.eclipse.jetty.spdy.SPDYServerConnector;
import org.eclipse.jetty.spdy.api.SPDY;
@ -52,4 +57,34 @@ public class HTTPSPDYServerConnector extends SPDYServerConnector
{
return defaultConnectionFactory;
}
@Override
public void customize(EndPoint endPoint, Request request) throws IOException
{
super.customize(endPoint, request);
if (getSslContextFactory() != null)
request.setScheme(HttpSchemes.HTTPS);
}
@Override
public boolean isConfidential(Request request)
{
if (getSslContextFactory() != null)
{
int confidentialPort = getConfidentialPort();
return confidentialPort == 0 || confidentialPort == request.getServerPort();
}
return super.isConfidential(request);
}
@Override
public boolean isIntegral(Request request)
{
if (getSslContextFactory() != null)
{
int integralPort = getIntegralPort();
return integralPort == 0 || integralPort == request.getServerPort();
}
return super.isIntegral(request);
}
}

View File

@ -76,7 +76,7 @@ public class SPDYServerConnector extends SelectChannelConnector
return bufferPool;
}
protected Executor getExecutor()
public Executor getExecutor()
{
final ThreadPool threadPool = getThreadPool();
if (threadPool instanceof Executor)
@ -91,11 +91,16 @@ public class SPDYServerConnector extends SelectChannelConnector
};
}
protected ScheduledExecutorService getScheduler()
public ScheduledExecutorService getScheduler()
{
return scheduler;
}
public SslContextFactory getSslContextFactory()
{
return sslContextFactory;
}
@Override
protected void doStart() throws Exception
{