Merge remote-tracking branch 'origin/jetty-9.3.x'
This commit is contained in:
commit
2c197878bd
|
@ -155,6 +155,7 @@ public abstract class Resource implements ResourceFactory, Closeable
|
|||
* @param useCaches controls URLConnection caching
|
||||
* @return A Resource object.
|
||||
* @throws MalformedURLException Problem accessing URI
|
||||
* @throws IOException Problem handling resource as file.
|
||||
*/
|
||||
public static Resource newResource(String resource, boolean useCaches)
|
||||
throws MalformedURLException
|
||||
|
@ -176,13 +177,13 @@ public abstract class Resource implements ResourceFactory, Closeable
|
|||
// It's a file.
|
||||
if (resource.startsWith("./"))
|
||||
resource=resource.substring(2);
|
||||
|
||||
File file=new File(resource).getCanonicalFile();
|
||||
return new PathResource(file.toPath());
|
||||
return new PathResource(file);
|
||||
}
|
||||
catch(Exception e2)
|
||||
catch(IOException e2)
|
||||
{
|
||||
LOG.debug(Log.EXCEPTION,e2);
|
||||
// TODO throw the IOException instead
|
||||
e.addSuppressed(e2);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -226,6 +227,7 @@ public abstract class Resource implements ResourceFactory, Closeable
|
|||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
// Catches scenario where a bad Windows path like "C:\dev" is
|
||||
// improperly escaped, which various downstream classloaders
|
||||
// tend to have a problem with
|
||||
|
|
|
@ -60,6 +60,7 @@ import javax.net.ssl.SSLPeerUnverifiedException;
|
|||
import javax.net.ssl.SSLServerSocket;
|
||||
import javax.net.ssl.SSLServerSocketFactory;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.SSLSessionContext;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.StandardConstants;
|
||||
|
@ -209,7 +210,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
|||
/** Set to true to enable SSL Session caching */
|
||||
private boolean _sessionCachingEnabled = true;
|
||||
/** SSL session cache size */
|
||||
private int _sslSessionCacheSize;
|
||||
private int _sslSessionCacheSize=0;
|
||||
/** SSL session timeout */
|
||||
private int _sslSessionTimeout;
|
||||
|
||||
|
@ -384,9 +385,15 @@ public class SslContextFactory extends AbstractLifeCycle
|
|||
SecureRandom secureRandom = (_secureRandomAlgorithm == null)?null:SecureRandom.getInstance(_secureRandomAlgorithm);
|
||||
context = _sslProvider == null ? SSLContext.getInstance(_sslProtocol) : SSLContext.getInstance(_sslProtocol, _sslProvider);
|
||||
context.init(keyManagers,trustManagers,secureRandom);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize cache
|
||||
SSLSessionContext serverContext=context.getServerSessionContext();
|
||||
if (serverContext!=null)
|
||||
serverContext.setSessionCacheSize(getSslSessionCacheSize());
|
||||
|
||||
// select the protocols and ciphers
|
||||
SSLEngine sslEngine=context.createSSLEngine();
|
||||
selectCipherSuites(
|
||||
|
@ -1411,14 +1418,20 @@ public class SslContextFactory extends AbstractLifeCycle
|
|||
}
|
||||
|
||||
/** Set the flag to enable SSL Session caching.
|
||||
* @param enableSessionCaching the value of the flag
|
||||
*/
|
||||
* If set to true, then the {@link SSLContext#createSSLEngine(String, int)} method is
|
||||
* used to pass host and port information as a hint for session reuse. Note that
|
||||
* this is only a hint and session may not be reused. Moreover, the hint is typically
|
||||
* only used on client side implementations and setting this to false does not
|
||||
* stop a server from accepting an offered session ID to reuse.
|
||||
* @param enableSessionCaching the value of the flag
|
||||
*/
|
||||
public void setSessionCachingEnabled(boolean enableSessionCaching)
|
||||
{
|
||||
_sessionCachingEnabled = enableSessionCaching;
|
||||
}
|
||||
|
||||
/** Get SSL session cache size.
|
||||
* Passed directly to {@link SSLSessionContext#setSessionCacheSize(int)}
|
||||
* @return SSL session cache size
|
||||
*/
|
||||
public int getSslSessionCacheSize()
|
||||
|
|
Loading…
Reference in New Issue