Jetty9 - Fixed compilation problems.

This commit is contained in:
Simone Bordet 2012-07-23 15:38:27 +02:00
parent 6b4583b461
commit d2a0cb5c50
36 changed files with 480 additions and 575 deletions

View File

@ -9,6 +9,11 @@
<name>Example :: Jetty Embedded</name>
<description>Jetty Embedded Examples</description>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util-ajax</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>

View File

@ -15,14 +15,14 @@
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool
<!-- Default queued blocking threadpool
-->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="maxThreads">200</Set>
<Set name="minThreads">10</Set>
</New>
<!-- Optional Java 5 bounded threadpool with job queue
<!-- Optional Java 5 bounded threadpool with job queue
<New class="org.eclipse.thread.concurrent.ThreadPool">
<Set name="corePoolSize">50</Set>
<Set name="maximumPoolSize">50</Set>
@ -36,10 +36,10 @@
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<New class="org.eclipse.jetty.server.SelectChannelConnector">
<Set name="host"></Set>
<Set name="port">0</Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="confidentialPort">8443</Set>
</New>
</Arg>
@ -50,13 +50,7 @@
<!-- mixin jetty-ssl.xml: -->
<!-- java -jar start.jar etc/jetty-ssl.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To add a HTTP blocking connector -->
<!-- mixin jetty-bio.xml: -->
<!-- java -jar start.jar etc/jetty-bio.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To allow Jetty to be started from xinetd -->
<!-- mixin jetty-xinetd.xml: -->
@ -66,7 +60,7 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
@ -85,7 +79,7 @@
</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Configure Authentication Login Service -->
<!-- Realms may be configured for the entire server here, or -->

View File

@ -28,9 +28,9 @@ public class NetworkTrafficSelectChannelEndPoint extends SelectChannelEndPoint
private final List<NetworkTrafficListener> listeners;
public NetworkTrafficSelectChannelEndPoint(SocketChannel channel, SelectorManager.ManagedSelector selectSet, SelectionKey key, int maxIdleTime, List<NetworkTrafficListener> listeners) throws IOException
public NetworkTrafficSelectChannelEndPoint(SocketChannel channel, SelectorManager.ManagedSelector selectSet, SelectionKey key, long idleTimeout, List<NetworkTrafficListener> listeners) throws IOException
{
super(channel, selectSet, key, maxIdleTime);
super(channel, selectSet, key, idleTimeout);
this.listeners = listeners;
}

View File

@ -10,17 +10,15 @@
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<New class="org.eclipse.jetty.server.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -35,18 +35,16 @@
<!-- Use this connector for many frequently idle connections
and for threadless continuations.
-->
-->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<New class="org.eclipse.jetty.server.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="idleTimeout">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">10000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
@ -56,7 +54,7 @@
<!-- see jetty-ssl.xml to add an ssl connector. use -->
<!-- java -jar start.jar etc/jetty-ssl.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- =========================================================== -->
<!-- Set up global session ID manager -->
<!-- =========================================================== -->
@ -69,10 +67,10 @@
-->
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<!-- ========================================================== -->
<!-- RewriteHandler Sample Configuration -->
<!-- ========================================================== -->
@ -80,7 +78,7 @@
<Set name="originalPathAttribute">requestedPath</Set>
<Set name="rewriteRequestURI">true</Set>
<Set name="rules">
<Array type="org.eclipse.jetty.rewrite.handler.Rule">
@ -90,7 +88,7 @@
<Set name="replacement">/test</Set>
</New>
</Item>
<Item>
<New id="response" class="org.eclipse.jetty.rewrite.handler.ResponsePatternRule">
<Set name="pattern">/session/</Set>
@ -128,7 +126,7 @@
<Set name="replacement">/demo</Set>
</New>
</Item>
<Item>
<New id="forwardedHttps" class="org.eclipse.jetty.rewrite.handler.ForwardedSchemeHeaderRule">
<Set name="header">X-Forwarded-Scheme</Set>
@ -158,10 +156,10 @@
</New>
</Arg>
</Call>
</New>
</Item>
</Array>
</Set>
@ -184,7 +182,7 @@
</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Configure the context deployer -->
<!-- A context deployer will deploy contexts described in -->

View File

@ -1,30 +1,30 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.security;
//========================================================================
//Copyright (c) Webtide LLC
//------------------------------------------------------------------------
//All rights reserved. This program and the accompanying materials
//are made available under the terms of the Eclipse Public License v1.0
//and Apache License v2.0 which accompanies this distribution.
//
//The Eclipse Public License is available at
//http://www.eclipse.org/legal/epl-v10.html
//
//The Apache License v2.0 is available at
//http://www.opensource.org/licenses/apache2.0.php
//
//You may elect to redistribute this code under either of these licenses.
//========================================================================
import java.util.Properties;
import javax.security.auth.Subject;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.B64Code;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
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.util.security.B64Code;
import org.ietf.jgss.GSSContext;
import org.ietf.jgss.GSSCredential;
import org.ietf.jgss.GSSException;
@ -39,25 +39,25 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
protected IdentityService _identityService;// = new LdapIdentityService();
protected String _name;
private String _config;
private String _targetName;
public SpnegoLoginService()
{
}
public SpnegoLoginService( String name )
{
setName(name);
}
public SpnegoLoginService( String name, String config )
{
setName(name);
setConfig(config);
}
public String getName()
{
return _name;
@ -69,38 +69,38 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
{
throw new IllegalStateException("Running");
}
_name = name;
}
public String getConfig()
{
return _config;
}
public void setConfig( String config )
{
if (isRunning())
{
throw new IllegalStateException("Running");
}
_config = config;
}
@Override
protected void doStart() throws Exception
{
Properties properties = new Properties();
Resource resource = Resource.newResource(_config);
properties.load(resource.getInputStream());
_targetName = properties.getProperty("targetName");
LOG.debug("Target Name {}", _targetName);
super.doStart();
}
@ -110,9 +110,9 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
public UserIdentity login(String username, Object credentials)
{
String encodedAuthToken = (String)credentials;
byte[] authToken = B64Code.decode(encodedAuthToken);
GSSManager manager = GSSManager.getInstance();
try
{
@ -135,7 +135,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
{
String clientName = gContext.getSrcName().toString();
String role = clientName.substring(clientName.indexOf('@') + 1);
LOG.debug("SpnegoUserRealm: established a security context");
LOG.debug("Client Principal is: " + gContext.getSrcName());
LOG.debug("Server Principal is: " + gContext.getTargName());
@ -145,7 +145,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
Subject subject = new Subject();
subject.getPrincipals().add(user);
return _identityService.newUserIdentity(subject,user, new String[]{role});
}
}
@ -176,7 +176,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
public void logout(UserIdentity user) {
// TODO Auto-generated method stub
}
}

View File

@ -1,4 +1,3 @@
package org.eclipse.jetty.security;
//========================================================================
//Copyright 2011-2012 Mort Bay Consulting Pty. Ltd.
//------------------------------------------------------------------------
@ -12,28 +11,30 @@ package org.eclipse.jetty.security;
//You may elect to redistribute this code under either of these licenses.
//========================================================================
package org.eclipse.jetty.security;
import java.security.Principal;
import org.eclipse.jetty.util.security.B64Code;
import org.eclipse.jetty.util.B64Code;
public class SpnegoUserPrincipal implements Principal
{
private final String _name;
private byte[] _token;
private String _encodedToken;
public SpnegoUserPrincipal( String name, String encodedToken )
{
_name = name;
_encodedToken = encodedToken;
}
public SpnegoUserPrincipal( String name, byte[] token )
{
_name = name;
_token = token;
}
public String getName()
{
return _name;
@ -47,7 +48,7 @@ public class SpnegoUserPrincipal implements Principal
}
return _token;
}
public String getEncodedToken()
{
if ( _encodedToken == null )
@ -55,5 +56,5 @@ public class SpnegoUserPrincipal implements Principal
_encodedToken = new String(B64Code.encode(_token,true));
}
return _encodedToken;
}
}
}

View File

@ -4,11 +4,11 @@
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.security.authentication;
@ -16,7 +16,6 @@ package org.eclipse.jetty.security.authentication;
import java.io.IOException;
import java.util.Collections;
import java.util.Enumeration;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
@ -47,18 +46,18 @@ import org.eclipse.jetty.util.security.Constraint;
/**
* FORM Authenticator.
*
*
* <p>This authenticator implements form authentication will use dispatchers to
* the login page if the {@link #__FORM_DISPATCH} init parameter is set to true.
* Otherwise it will redirect.</p>
*
*
* <p>The form authenticator redirects unauthenticated requests to a log page
* which should use a form to gather username/password from the user and send them
* to the /j_security_check URI within the context. FormAuthentication uses
* to the /j_security_check URI within the context. FormAuthentication uses
* {@link SessionAuthentication} to wrap Authentication results so that they
* are associated with the session.</p>
*
*
*
*
*/
public class FormAuthenticator extends LoginAuthenticator
{
@ -94,7 +93,7 @@ public class FormAuthenticator extends LoginAuthenticator
setErrorPage(error);
_dispatch=dispatch;
}
/* ------------------------------------------------------------ */
/**
* If true, uris that cause a redirect to a login page will always
@ -107,14 +106,14 @@ public class FormAuthenticator extends LoginAuthenticator
{
_alwaysSaveUri = alwaysSave;
}
/* ------------------------------------------------------------ */
public boolean getAlwaysSaveUri ()
{
return _alwaysSaveUri;
}
/* ------------------------------------------------------------ */
/**
* @see org.eclipse.jetty.security.authentication.LoginAuthenticator#setConfiguration(org.eclipse.jetty.security.Authenticator.AuthConfiguration)
@ -149,7 +148,7 @@ public class FormAuthenticator extends LoginAuthenticator
}
_formLoginPage = path;
_formLoginPath = path;
if (_formLoginPath.indexOf('?') > 0)
if (_formLoginPath.indexOf('?') > 0)
_formLoginPath = _formLoginPath.substring(0, _formLoginPath.indexOf('?'));
}
@ -171,14 +170,14 @@ public class FormAuthenticator extends LoginAuthenticator
_formErrorPage = path;
_formErrorPath = path;
if (_formErrorPath.indexOf('?') > 0)
if (_formErrorPath.indexOf('?') > 0)
_formErrorPath = _formErrorPath.substring(0, _formErrorPath.indexOf('?'));
}
}
/* ------------------------------------------------------------ */
public Authentication validateRequest(ServletRequest req, ServletResponse res, boolean mandatory) throws ServerAuthException
{
{
HttpServletRequest request = (HttpServletRequest)req;
HttpServletResponse response = (HttpServletResponse)res;
String uri = request.getRequestURI();
@ -188,12 +187,12 @@ public class FormAuthenticator extends LoginAuthenticator
mandatory|=isJSecurityCheck(uri);
if (!mandatory)
return _deferred;
if (isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo())))
return Authentication.NOT_CHECKED;
HttpSession session = request.getSession(true);
try
{
// Handle a request for authentication.
@ -201,39 +200,39 @@ public class FormAuthenticator extends LoginAuthenticator
{
final String username = request.getParameter(__J_USERNAME);
final String password = request.getParameter(__J_PASSWORD);
UserIdentity user = _loginService.login(username,password);
if (user!=null)
{
session=renewSessionOnAuthentication(request,response);
// Redirect to original request
String nuri;
synchronized(session)
{
nuri = (String) session.getAttribute(__J_URI);
}
if (nuri == null || nuri.length() == 0)
{
nuri = request.getContextPath();
if (nuri.length() == 0)
if (nuri.length() == 0)
nuri = URIUtil.SLASH;
}
response.setContentLength(0);
response.setContentLength(0);
response.sendRedirect(response.encodeRedirectURL(nuri));
Authentication cached=new SessionAuthentication(getAuthMethod(),user,password);
session.setAttribute(SessionAuthentication.__J_AUTHENTICATED, cached);
return new FormAuthentication(getAuthMethod(),user);
}
// not authenticated
if (LOG.isDebugEnabled())
if (LOG.isDebugEnabled())
LOG.debug("Form authentication FAILED for " + StringUtil.printable(username));
if (_formErrorPage == null)
{
if (response != null)
if (response != null)
response.sendError(HttpServletResponse.SC_FORBIDDEN);
}
else if (_dispatch)
@ -247,20 +246,20 @@ public class FormAuthenticator extends LoginAuthenticator
{
response.sendRedirect(response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(),_formErrorPage)));
}
return Authentication.SEND_FAILURE;
}
// Look for cached authentication
Authentication authentication = (Authentication) session.getAttribute(SessionAuthentication.__J_AUTHENTICATED);
if (authentication != null)
if (authentication != null)
{
// Has authentication been revoked?
if (authentication instanceof Authentication.User &&
if (authentication instanceof Authentication.User &&
_loginService!=null &&
!_loginService.validate(((Authentication.User)authentication).getUserIdentity()))
{
session.removeAttribute(SessionAuthentication.__J_AUTHENTICATED);
}
else
@ -268,7 +267,7 @@ public class FormAuthenticator extends LoginAuthenticator
String j_uri=(String)session.getAttribute(__J_URI);
if (j_uri!=null)
{
MultiMap<String> j_post = (MultiMap<String>)session.getAttribute(__J_POST);
MultiMap j_post = (MultiMap)session.getAttribute(__J_POST);
if (j_post!=null)
{
StringBuffer buf = request.getRequestURL();
@ -280,7 +279,7 @@ public class FormAuthenticator extends LoginAuthenticator
// This is a retry of an original POST request
// so restore method and parameters
session.removeAttribute(__J_POST);
session.removeAttribute(__J_POST);
Request base_request = HttpChannel.getCurrentHttpChannel().getRequest();
base_request.setMethod(HttpMethod.POST,HttpMethod.POST.asString());
base_request.setParameters(j_post);
@ -288,36 +287,36 @@ public class FormAuthenticator extends LoginAuthenticator
}
else
session.removeAttribute(__J_URI);
}
return authentication;
}
}
// if we can't send challenge
if (_deferred.isDeferred(response))
return Authentication.UNAUTHENTICATED;
if (DeferredAuthentication.isDeferred(response))
return Authentication.UNAUTHENTICATED;
// remember the current URI
synchronized (session)
{
// But only if it is not set already, or we save every uri that leads to a login form redirect
if (session.getAttribute(__J_URI)==null || _alwaysSaveUri)
{
{
StringBuffer buf = request.getRequestURL();
if (request.getQueryString() != null)
buf.append("?").append(request.getQueryString());
session.setAttribute(__J_URI, buf.toString());
if (MimeTypes.Type.FORM_ENCODED.is(req.getContentType()) && HttpMethod.POST.is(request.getMethod()))
{
Request base_request = (req instanceof Request)?(Request)req:HttpChannel.getCurrentHttpChannel().getRequest();
base_request.extractParameters();
session.setAttribute(__J_POST, new MultiMap<String>(base_request.getParameters()));
base_request.extractParameters();
session.setAttribute(__J_POST, new MultiMap(base_request.getParameters()));
}
}
}
// send the the challenge
if (_dispatch)
{
@ -331,24 +330,20 @@ public class FormAuthenticator extends LoginAuthenticator
response.sendRedirect(response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(),_formLoginPage)));
}
return Authentication.SEND_CONTINUE;
}
catch (IOException e)
{
throw new ServerAuthException(e);
}
catch (ServletException e)
catch (IOException | ServletException e)
{
throw new ServerAuthException(e);
}
}
/* ------------------------------------------------------------ */
public boolean isJSecurityCheck(String uri)
{
int jsc = uri.indexOf(__J_SECURITY_CHECK);
if (jsc<0)
return false;
int e=jsc+__J_SECURITY_CHECK.length();
@ -357,13 +352,13 @@ public class FormAuthenticator extends LoginAuthenticator
char c = uri.charAt(e);
return c==';'||c=='#'||c=='/'||c=='?';
}
/* ------------------------------------------------------------ */
public boolean isLoginOrErrorPage(String pathInContext)
{
return pathInContext != null && (pathInContext.equals(_formErrorPath) || pathInContext.equals(_formLoginPath));
}
/* ------------------------------------------------------------ */
public boolean secureResponse(ServletRequest req, ServletResponse res, boolean mandatory, User validatedUser) throws ServerAuthException
{
@ -386,7 +381,7 @@ public class FormAuthenticator extends LoginAuthenticator
return -1;
return super.getDateHeader(name);
}
@Override
public String getHeader(String name)
{
@ -396,16 +391,16 @@ public class FormAuthenticator extends LoginAuthenticator
}
@Override
public Enumeration getHeaderNames()
public Enumeration<String> getHeaderNames()
{
return Collections.enumeration(Collections.list(super.getHeaderNames()));
}
@Override
public Enumeration getHeaders(String name)
public Enumeration<String> getHeaders(String name)
{
if (name.toLowerCase().startsWith("if-"))
return Collections.enumeration(Collections.EMPTY_LIST);
return Collections.<String>enumeration(Collections.<String>emptyList());
return super.getHeaders(name);
}
}
@ -439,14 +434,14 @@ public class FormAuthenticator extends LoginAuthenticator
if (notIgnored(name))
super.setDateHeader(name,date);
}
@Override
public void setHeader(String name, String value)
{
if (notIgnored(name))
super.setHeader(name,value);
}
private boolean notIgnored(String name)
{
if (HttpHeader.CACHE_CONTROL.is(name) ||
@ -459,10 +454,10 @@ public class FormAuthenticator extends LoginAuthenticator
return true;
}
}
/* ------------------------------------------------------------ */
/** This Authentication represents a just completed Form authentication.
* Subsequent requests from the same user are authenticated by the presents
* Subsequent requests from the same user are authenticated by the presents
* of a {@link SessionAuthentication} instance in their session.
*/
public static class FormAuthentication extends UserAuthentication implements Authentication.ResponseSent
@ -471,7 +466,7 @@ public class FormAuthenticator extends LoginAuthenticator
{
super(method,userIdentity);
}
@Override
public String toString()
{

View File

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure SSL for the Jetty Server -->
<!-- this configuration file should be used in combination with -->
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty-ssl.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSocketConnector">
<Set name="Port">9443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Keystore"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="Password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="truststore"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="trustPassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -1,23 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Mixin configuration for Block socket connector -->
<!-- -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- Use this connector if NIO is not available. -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.bio.SocketConnector">
<Set name="port"><Property name="jetty.bio.port" default="8081"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -16,7 +16,7 @@
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool
<!-- Default queued blocking threadpool
-->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
@ -31,14 +31,12 @@
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<New class="org.eclipse.jetty.server.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8888"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
@ -52,7 +50,7 @@
</Call>
</New>
</Set>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->

View File

@ -12,7 +12,7 @@
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- if NIO is not available, use org.eclipse.jetty.server.ssl.SslSocketConnector -->
<New id="sslContextFactory" class="org.eclipse.jetty.http.ssl.SslContextFactory">
<Set name="KeyStore"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
@ -26,7 +26,7 @@
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Arg><Ref id="sslContextFactory" /></Arg>
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="idleTimeout">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="AcceptQueueSize">100</Set>
</New>

View File

@ -16,8 +16,8 @@ service jetty
disable = no
id = jetty
type = UNLISTED
wait = yes
type = UNLISTED
wait = yes
socket_type = stream
# change this
@ -39,16 +39,14 @@ service jetty
<New class="org.eclipse.jetty.server.nio.InheritedChannelConnector">
<!-- Optional. Fallback in case System.inheritedChannel() does not give a ServerSocketChannel
<!-- Optional. Fallback in case System.inheritedChannel() does not give a ServerSocketChannel
<Set name="port"><Property name="jetty.service.port" default="8082"/></Set>
-->
<!-- sane defaults -->
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>

View File

@ -35,21 +35,19 @@
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<New class="org.eclipse.jetty.server.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">

View File

@ -57,7 +57,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
private final Statistics _stats = new ConnectionStatistics();
protected int _idleTimeout = 200000;
protected long _idleTimeout = 200000;
protected int _soLingerTime = -1;
@ -216,7 +216,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
* @param idleTimeout
* The idleTimeout to set.
*/
public void setIdleTimeout(int idleTimeout)
public void setIdleTimeout(long idleTimeout)
{
_idleTimeout = idleTimeout;
}

View File

@ -4,11 +4,11 @@
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.server.handler;
@ -33,7 +33,7 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
public AbstractHandlerContainer()
{
}
/* ------------------------------------------------------------ */
@Override
public Handler[] getChildHandlers()
@ -41,7 +41,7 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
Object list = expandChildren(null,null);
return (Handler[])LazyList.toArray(list, Handler.class);
}
/* ------------------------------------------------------------ */
@Override
public Handler[] getChildHandlersByClass(Class<?> byclass)
@ -49,7 +49,7 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
Object list = expandChildren(null,byclass);
return (Handler[])LazyList.toArray(list, byclass);
}
/* ------------------------------------------------------------ */
@Override
public <T extends Handler> T getChildHandlerByClass(Class<T> byclass)
@ -60,7 +60,7 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
return null;
return (T)LazyList.get(list, 0);
}
/* ------------------------------------------------------------ */
protected Object expandChildren(Object list, Class<?> byClass)
{
@ -72,7 +72,7 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
{
if (handler==null)
return list;
if (byClass==null || byClass.isAssignableFrom(handler.getClass()))
list=LazyList.add(list, handler);
@ -84,17 +84,17 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
Handler[] handlers=byClass==null?container.getChildHandlers():container.getChildHandlersByClass(byClass);
list=LazyList.addArray(list, handlers);
}
return list;
}
/* ------------------------------------------------------------ */
public static <T extends HandlerContainer> T findContainerOf(HandlerContainer root,Class<T>type, Handler handler)
{
if (root==null || handler==null)
return null;
Handler[] branches=root.getChildHandlersByClass((Class<Handler>)type);
Handler[] branches=root.getChildHandlersByClass(type);
if (branches!=null)
{
for (Handler h:branches)
@ -111,7 +111,7 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
}
return null;
}
/* ------------------------------------------------------------ */
@Override
public void dump(Appendable out,String indent) throws IOException

View File

@ -55,7 +55,7 @@ public class NetworkTrafficSelectChannelConnector extends SelectChannelConnector
@Override
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectorManager.ManagedSelector selectSet, SelectionKey key) throws IOException
{
NetworkTrafficSelectChannelEndPoint endPoint = new NetworkTrafficSelectChannelEndPoint(channel, selectSet, key, _idleTimeout, listeners);
NetworkTrafficSelectChannelEndPoint endPoint = new NetworkTrafficSelectChannelEndPoint(channel, selectSet, key, getIdleTimeout(), listeners);
endPoint.notifyOpened();
return endPoint;
}

View File

@ -0,0 +1 @@
SelectChannelConnector: HTTP connector using NIO ByteChannels and Selectors

View File

@ -1,2 +0,0 @@
SelectChannelConnector: HTTP connector using NIO ByteChannels and Selectors
lowResourcesConnections: The number of connections, which if exceeded represents low resources

View File

@ -4,22 +4,19 @@
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.servlets;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
@ -29,7 +26,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@ -42,38 +38,35 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.Part;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.MultiPartInputStream;
import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
/* ------------------------------------------------------------ */
/**
* Multipart Form Data Filter.
* <p>
* This class decodes the multipart/form-data stream sent by a HTML form that uses a file input
* item. Any files sent are stored to a temporary file and a File object added to the request
* item. Any files sent are stored to a temporary file and a File object added to the request
* as an attribute. All other values are made available via the normal getParameter API and
* the setCharacterEncoding mechanism is respected when converting bytes to Strings.
* <p>
* If the init parameter "delete" is set to "true", any files created will be deleted when the
* current request returns.
* <p>
* The init parameter maxFormKeys sets the maximum number of keys that may be present in a
* form (default set by system property org.eclipse.jetty.server.Request.maxFormKeys or 1000) to protect
* against DOS attacks by bad hash keys.
* The init parameter maxFormKeys sets the maximum number of keys that may be present in a
* form (default set by system property org.eclipse.jetty.server.Request.maxFormKeys or 1000) to protect
* against DOS attacks by bad hash keys.
* <p>
* The init parameter deleteFiles controls if uploaded files are automatically deleted after the request
* completes.
*
*
* Use init parameter "maxFileSize" to set the max size file that can be uploaded.
*
*
* Use init parameter "maxRequestSize" to limit the size of the multipart request.
*
*
*/
public class MultiPartFilter implements Filter
{
@ -85,7 +78,7 @@ public class MultiPartFilter implements Filter
private int _fileOutputBuffer = 0;
private long _maxFileSize = -1L;
private long _maxRequestSize = -1L;
private int _maxFormKeys = Integer.getInteger("org.eclipse.jetty.server.Request.maxFormKeys",1000).intValue();
private int _maxFormKeys = Integer.getInteger("org.eclipse.jetty.server.Request.maxFormKeys", 1000);
/* ------------------------------------------------------------------------------- */
/**
@ -104,7 +97,7 @@ public class MultiPartFilter implements Filter
String maxRequestSize = filterConfig.getInitParameter("maxRequestSize");
if (maxRequestSize != null)
_maxRequestSize = Long.parseLong(maxRequestSize.trim());
_context=filterConfig.getServletContext();
String mfks = filterConfig.getInitParameter("maxFormKeys");
if (mfks!=null)
@ -116,7 +109,7 @@ public class MultiPartFilter implements Filter
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
* javax.servlet.ServletResponse, javax.servlet.FilterChain)
*/
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain)
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain)
throws IOException, ServletException
{
HttpServletRequest srequest=(HttpServletRequest)request;
@ -125,25 +118,24 @@ public class MultiPartFilter implements Filter
chain.doFilter(request,response);
return;
}
InputStream in = new BufferedInputStream(request.getInputStream());
String content_type=srequest.getContentType();
//Get current parameters so we can merge into them
MultiMap<String> params = new MultiMap<String>();
for (Iterator<Map.Entry<String,String[]>> i = request.getParameterMap().entrySet().iterator();i.hasNext();)
MultiMap params = new MultiMap();
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet())
{
Map.Entry<String,String[]> entry=i.next();
Object value=entry.getValue();
Object value = entry.getValue();
if (value instanceof String[])
params.addValues(entry.getKey(),(String[])value);
params.addValues(entry.getKey(), (String[])value);
else
params.add(entry.getKey(),value);
params.add(entry.getKey(), value);
}
MultipartConfigElement config = new MultipartConfigElement(tempdir.getCanonicalPath(), _maxFileSize, _maxRequestSize, _fileOutputBuffer);
MultiPartInputStream mpis = new MultiPartInputStream(in, content_type, config, tempdir);
try
{
@ -168,10 +160,10 @@ public class MultiPartFilter implements Filter
{
mp.getFile().deleteOnExit();
ArrayList files = (ArrayList)request.getAttribute(FILES);
ArrayList<File> files = (ArrayList<File>)request.getAttribute(FILES);
if (files==null)
{
files=new ArrayList();
files=new ArrayList<>();
request.setAttribute(FILES,files);
}
files.add(mp.getFile());
@ -199,30 +191,22 @@ public class MultiPartFilter implements Filter
private void deleteFiles(ServletRequest request)
{
ArrayList files = (ArrayList)request.getAttribute(FILES);
ArrayList<File> files = (ArrayList<File>)request.getAttribute(FILES);
if (files!=null)
{
Iterator iter = files.iterator();
while (iter.hasNext())
for (File file : files)
{
File file=(File)iter.next();
try
{
file.delete();
}
catch(Exception e)
catch (Exception e)
{
_context.log("failed to delete "+file,e);
_context.log("failed to delete " + file, e);
}
}
}
}
/* ------------------------------------------------------------ */
private String value(String nameEqualsValue)
{
return nameEqualsValue.substring(nameEqualsValue.indexOf('=')+1).trim();
}
/* ------------------------------------------------------------------------------- */
/**
@ -238,7 +222,7 @@ public class MultiPartFilter implements Filter
{
String _encoding=StringUtil.__UTF8;
MultiMap _params;
/* ------------------------------------------------------------------------------- */
/** Constructor.
* @param request
@ -248,7 +232,7 @@ public class MultiPartFilter implements Filter
super(request);
this._params=map;
}
/* ------------------------------------------------------------------------------- */
/**
* @see javax.servlet.ServletRequest#getContentLength()
@ -258,7 +242,7 @@ public class MultiPartFilter implements Filter
{
return 0;
}
/* ------------------------------------------------------------------------------- */
/**
* @see javax.servlet.ServletRequest#getParameter(java.lang.String)
@ -269,13 +253,12 @@ public class MultiPartFilter implements Filter
Object o=_params.get(name);
if (!(o instanceof byte[]) && LazyList.size(o)>0)
o=LazyList.get(o,0);
if (o instanceof byte[])
{
try
{
String s=new String((byte[])o,_encoding);
return s;
return new String((byte[])o,_encoding);
}
catch(Exception e)
{
@ -286,34 +269,34 @@ public class MultiPartFilter implements Filter
return String.valueOf(o);
return null;
}
/* ------------------------------------------------------------------------------- */
/**
* @see javax.servlet.ServletRequest#getParameterMap()
*/
@Override
public Map getParameterMap()
public Map<String, String[]> getParameterMap()
{
Map<String, String> cmap = new HashMap<String,String>();
for ( Object key : _params.keySet() )
Map<String, String[]> cmap = new HashMap<>();
for ( String key : _params.keySet() )
{
cmap.put((String)key,getParameter((String)key));
cmap.put(key,getParameterValues(key));
}
return Collections.unmodifiableMap(cmap);
}
/* ------------------------------------------------------------------------------- */
/**
* @see javax.servlet.ServletRequest#getParameterNames()
*/
@Override
public Enumeration getParameterNames()
public Enumeration<String> getParameterNames()
{
return Collections.enumeration(_params.keySet());
}
/* ------------------------------------------------------------------------------- */
/**
* @see javax.servlet.ServletRequest#getParameterValues(java.lang.String)
@ -344,13 +327,13 @@ public class MultiPartFilter implements Filter
}
return v;
}
/* ------------------------------------------------------------------------------- */
/**
* @see javax.servlet.ServletRequest#setCharacterEncoding(java.lang.String)
*/
@Override
public void setCharacterEncoding(String enc)
public void setCharacterEncoding(String enc)
throws UnsupportedEncodingException
{
_encoding=enc;

View File

@ -42,6 +42,7 @@
</archive>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
@ -59,6 +60,7 @@
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>

View File

@ -76,13 +76,13 @@ public class WebSocketClientFactory extends AggregateLifeCycle
addBean(sslContextFactory);
}
selector = new WebSocketClientSelectorManager(bufferPool,executor);
this.policy = WebSocketPolicy.newClientPolicy();
selector = new WebSocketClientSelectorManager(bufferPool,executor,policy);
selector.setSslContextFactory(sslContextFactory);
addBean(selector);
this.methodsCache = new EventMethodsCache();
this.policy = WebSocketPolicy.newClientPolicy();
}
public WebSocketClientFactory(SslContextFactory sslContextFactory)

View File

@ -40,14 +40,16 @@ import org.eclipse.jetty.websocket.io.WebSocketAsyncConnection;
public class WebSocketClientSelectorManager extends SelectorManager
{
private SslContextFactory sslContextFactory;
private Executor executor;
private ByteBufferPool bufferPool;
private final Executor executor;
private final WebSocketPolicy policy;
private final ByteBufferPool bufferPool;
public WebSocketClientSelectorManager(ByteBufferPool bufferPool, Executor executor)
public WebSocketClientSelectorManager(ByteBufferPool bufferPool, Executor executor, WebSocketPolicy policy)
{
super();
this.bufferPool = bufferPool;
this.executor = executor;
this.policy = policy;
}
@Override
@ -133,7 +135,7 @@ public class WebSocketClientSelectorManager extends SelectorManager
@Override
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey selectionKey) throws IOException
{
return new SelectChannelEndPoint(channel,selectSet, selectionKey, getIdleTimeout());
return new SelectChannelEndPoint(channel,selectSet, selectionKey, policy.getIdleTimeout());
}
public SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)

View File

@ -15,8 +15,6 @@
//========================================================================
package org.eclipse.jetty.websocket.client;
import static org.hamcrest.Matchers.*;
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetSocketAddress;
@ -46,6 +44,10 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
@Ignore("Client not yet functional")
public class WebSocketClientTest
{
@ -259,7 +261,7 @@ public class WebSocketClientTest
{
WebSocketClientFactory factory = new WebSocketClientFactory();
WebSocketClient client = factory.newWebSocketClient();
client.getPolicy().setMaxIdleTime(60000);
client.getPolicy().setIdleTimeout(60000);
final AtomicBoolean open = new AtomicBoolean(false);
final AtomicInteger close = new AtomicInteger();
@ -388,7 +390,7 @@ public class WebSocketClientTest
{
WebSocketClientFactory factory = new WebSocketClientFactory();
WebSocketClient client = factory.newWebSocketClient();
client.getPolicy().setMaxIdleTime(10000);
client.getPolicy().setIdleTimeout(10000);
TrackingSocket wsocket = new TrackingSocket();
@ -521,7 +523,7 @@ public class WebSocketClientTest
{
WebSocketClientFactory factory = new WebSocketClientFactory();
WebSocketClient client = factory.newWebSocketClient();
client.getPolicy().setMaxIdleTime(500);
client.getPolicy().setIdleTimeout(500);
TrackingSocket wsocket = new TrackingSocket();
@ -579,7 +581,7 @@ public class WebSocketClientTest
{
WebSocketClientFactory factory = new WebSocketClientFactory();
WebSocketClient client = factory.newWebSocketClient();
client.getPolicy().setMaxIdleTime(500);
client.getPolicy().setIdleTimeout(500);
TrackingSocket wsocket = new TrackingSocket();

View File

@ -321,7 +321,7 @@ public class TestClient
private void open() throws Exception
{
WebSocketClient client = factory.newWebSocketClient();
client.getPolicy().setMaxIdleTime(_timeout);
client.getPolicy().setIdleTimeout(_timeout);
client.setProtocol(_protocol);
socket = new TestSocket();
URI wsUri = new URI("ws://" + _host + ":" + _port + "/");

View File

@ -75,7 +75,7 @@ public class WebSocketPolicy
* <p>
* Default: 300000 (ms)
*/
private int maxIdleTime = 300000;
private int idleTimeout = 300000;
/**
* The implementation for masking
@ -131,7 +131,7 @@ public class WebSocketPolicy
clone.bufferSize = this.bufferSize;
clone.masker = this.masker;
clone.maxBinaryMessageSize = this.maxBinaryMessageSize;
clone.maxIdleTime = this.maxIdleTime;
clone.idleTimeout = this.idleTimeout;
clone.maxTextMessageSize = this.maxTextMessageSize;
return clone;
}
@ -156,9 +156,9 @@ public class WebSocketPolicy
return maxBinaryMessageSize;
}
public int getMaxIdleTime()
public int getIdleTimeout()
{
return maxIdleTime;
return idleTimeout;
}
public int getMaxPayloadSize()
@ -196,9 +196,9 @@ public class WebSocketPolicy
this.maxBinaryMessageSize = maxBinaryMessageSize;
}
public void setMaxIdleTime(int maxIdleTime)
public void setIdleTimeout(int idleTimeout)
{
this.maxIdleTime = maxIdleTime;
this.idleTimeout = idleTimeout;
}
public void setMaxPayloadSize(int maxPayloadSize)

View File

@ -64,7 +64,7 @@ public class WebSocketEventDriver implements IncomingFrames
/**
* Establish the driver for the Websocket POJO
*
*
* @param websocket
*/
public WebSocketEventDriver(Object websocket, EventMethodsCache methodsCache, WebSocketPolicy policy, ByteBufferPool bufferPool)
@ -81,7 +81,7 @@ public class WebSocketEventDriver implements IncomingFrames
policy.setBufferSize(anno.maxBufferSize());
policy.setMaxBinaryMessageSize(anno.maxBinarySize());
policy.setMaxTextMessageSize(anno.maxTextSize());
policy.setMaxIdleTime(anno.maxIdleTime());
policy.setIdleTimeout(anno.maxIdleTime());
}
}
@ -101,7 +101,7 @@ public class WebSocketEventDriver implements IncomingFrames
/**
* Get the Websocket POJO in use
*
*
* @return the Websocket POJO
*/
public Object getWebSocketObject()
@ -131,7 +131,7 @@ public class WebSocketEventDriver implements IncomingFrames
/**
* Internal entry point for incoming frames
*
*
* @param frame
* the frame that appeared
*/
@ -351,7 +351,7 @@ public class WebSocketEventDriver implements IncomingFrames
/**
* Set the connection to use for this driver
*
*
* @param conn
* the connection
*/

View File

@ -298,9 +298,9 @@ public class WebSocketAsyncConnection extends AbstractAsyncConnection implements
private <C> void scheduleTimeout(FrameBytes<C> bytes)
{
if (policy.getMaxIdleTime() > 0)
if (policy.getIdleTimeout() > 0)
{
bytes.task = scheduler.schedule(bytes,policy.getMaxIdleTime(),TimeUnit.MILLISECONDS);
bytes.task = scheduler.schedule(bytes,policy.getIdleTimeout(),TimeUnit.MILLISECONDS);
}
}

View File

@ -16,7 +16,6 @@
package org.eclipse.jetty.websocket.server;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@ -35,14 +34,14 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
* appropriate conditions.
* <p>
* The most basic implementation would be as follows.
*
*
* <pre>
* package my.example;
*
*
* import javax.servlet.http.HttpServletRequest;
* import org.eclipse.jetty.websocket.WebSocket;
* import org.eclipse.jetty.websocket.server.WebSocketServlet;
*
*
* public class MyEchoServlet extends WebSocketServlet
* {
* &#064;Override
@ -52,29 +51,29 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
* }
* }
* </pre>
*
*
* Note: that only request that conforms to a "WebSocket: Upgrade" handshake request will trigger the {@link WebSocketServerFactory} handling of creating
* WebSockets.<br>
* All other requests are treated as normal servlet requests.
*
*
* <p>
* <b>Configuration / Init-Parameters:</b><br>
* Note: If you use the {@link WebSocket &#064;WebSocket} annotation, these configuration settings can be specified on a per WebSocket basis, vs a per Servlet
* basis.
*
*
* <dl>
* <dt>bufferSize</dt>
* <dd>can be used to set the buffer size, which is also the max frame byte size<br>
* <i>Default: 8192</i></dd>
*
*
* <dt>maxIdleTime</dt>
* <dd>set the time in ms that a websocket may be idle before closing<br>
* <i>Default:</i></dd>
*
*
* <dt>maxTextMessagesSize</dt>
* <dd>set the size in characters that a websocket may be accept before closing<br>
* <i>Default:</i></dd>
*
*
* <dt>maxBinaryMessagesSize</dt>
* <dd>set the size in bytes that a websocket may be accept before closing<br>
* <i>Default:</i></dd>
@ -117,7 +116,7 @@ public abstract class WebSocketServlet extends HttpServlet
String max = getInitParameter("maxIdleTime");
if (max != null)
{
policy.setMaxIdleTime(Integer.parseInt(max));
policy.setIdleTimeout(Integer.parseInt(max));
}
max = getInitParameter("maxTextMessageSize");

View File

@ -12,11 +12,11 @@
<New class="org.eclipse.jetty.server.bio.SocketConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="0"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
</New>
</Arg>
</Call>
</Configure>
</Configure>

View File

@ -12,7 +12,7 @@
<New class="org.eclipse.jetty.server.ssl.SslSocketConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="0"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="keystore"><Property name="test.resourcesdir" default="src/test/resources" />/keystore</Set>
@ -26,4 +26,4 @@
</Arg>
</Call>
</Configure>
</Configure>

View File

@ -28,21 +28,19 @@
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<New class="org.eclipse.jetty.server.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="0"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<!--<Set name="confidentialPort">8443</Set>-->
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
@ -60,7 +58,7 @@
</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->

View File

@ -9,16 +9,14 @@
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<New class="org.eclipse.jetty.server.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="0"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
</Configure>
</Configure>

View File

@ -12,11 +12,9 @@
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="0"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
<Set name="keystore"><Property name="test.resourcesdir" default="src/test/resources" />/keystore</Set>
<Set name="password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="keyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
@ -24,4 +22,4 @@
</Arg>
</Call>
</Configure>
</Configure>

View File

@ -31,24 +31,22 @@
<!-- NIOHttps.xml -->
<!-- =========================================================== -->
<!--
<!--
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<New class="org.eclipse.jetty.server.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="0"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="idleTimeout">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
</Call>
-->
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
@ -89,7 +87,7 @@
</Set>
</New>
</Set>
<Call name="addLifeCycle">
<Arg>
<New class="org.eclipse.jetty.deploy.ContextDeployer">
@ -104,7 +102,7 @@
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure the webapp deployer. -->
<!-- A webapp deployer will deploy standard webapps discovered -->
@ -118,7 +116,7 @@
<!-- Normally only one type of deployer need be used. -->
<!-- -->
<!-- =========================================================== -->
<!--
<!--
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.deploy.WebAppDeployer">
@ -136,7 +134,7 @@
</Arg>
</Call>
-->
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->