From 9678aad6e961c21be0972aa90bfef570e0d237dc Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 3 Oct 2011 18:21:28 +1100 Subject: [PATCH 01/92] Debug printlns plus commented out Deferred auth --- .../security/jaspi/JaspiAuthenticator.java | 97 +++++++++++-------- .../jaspi/JaspiAuthenticatorFactory.java | 4 + .../jaspi/modules/BaseAuthModule.java | 4 +- .../jaspi/modules/FormAuthModule.java | 23 ++++- .../jetty/security/SecurityHandler.java | 6 +- 5 files changed, 86 insertions(+), 48 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index dbdb0b4a840..1b065287658 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -42,36 +42,38 @@ import org.eclipse.jetty.server.Authentication.User; public class JaspiAuthenticator implements Authenticator { private final ServerAuthConfig _authConfig; + private final Map _authProperties; + private final ServletCallbackHandler _callbackHandler; + private final Subject _serviceSubject; + private final boolean _allowLazyAuthentication; + private final IdentityService _identityService; + private final DeferredAuthentication _deferred; - public JaspiAuthenticator(ServerAuthConfig authConfig, Map authProperties, ServletCallbackHandler callbackHandler, - Subject serviceSubject, boolean allowLazyAuthentication, IdentityService identityService) + public JaspiAuthenticator(ServerAuthConfig authConfig, Map authProperties, ServletCallbackHandler callbackHandler, Subject serviceSubject, + boolean allowLazyAuthentication, IdentityService identityService) { // TODO maybe pass this in via setConfiguration ? - if (callbackHandler == null) - throw new NullPointerException("No CallbackHandler"); - if (authConfig == null) - throw new NullPointerException("No AuthConfig"); + if (callbackHandler == null) throw new NullPointerException("No CallbackHandler"); + if (authConfig == null) throw new NullPointerException("No AuthConfig"); this._authConfig = authConfig; this._authProperties = authProperties; this._callbackHandler = callbackHandler; this._serviceSubject = serviceSubject; this._allowLazyAuthentication = allowLazyAuthentication; this._identityService = identityService; - this._deferred=new DeferredAuthentication(this); + this._deferred = new DeferredAuthentication(this); } - public void setConfiguration(AuthConfiguration configuration) { } - - + public String getAuthMethod() { return "JASPI"; @@ -79,56 +81,67 @@ public class JaspiAuthenticator implements Authenticator public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException { - if (_allowLazyAuthentication && !mandatory) - return _deferred; + System.err.println("JaspiAuthenticator.validateRequest, uri=" + ((javax.servlet.http.HttpServletRequest) request).getRequestURI() + + "lazy=" + + _allowLazyAuthentication + + " mandatory=" + + mandatory); + new Throwable().printStackTrace(); + JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); - request.setAttribute("org.eclipse.jetty.security.jaspi.info",info); + request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); + + /* if (_allowLazyAuthentication && !mandatory) + return _deferred;*/ + return validateRequest(info); } // most likely validatedUser is not needed here. public boolean secureResponse(ServletRequest req, ServletResponse res, boolean mandatory, User validatedUser) throws ServerAuthException { - JaspiMessageInfo info = (JaspiMessageInfo)req.getAttribute("org.eclipse.jetty.security.jaspi.info"); - if (info==null) throw new NullPointerException("MeesageInfo from request missing: " + req); - return secureResponse(info,validatedUser); + System.err.println("JaspiAuthenticator.secureResponse uri=" + ((javax.servlet.http.HttpServletRequest) req).getRequestURI()); + + JaspiMessageInfo info = (JaspiMessageInfo) req.getAttribute("org.eclipse.jetty.security.jaspi.info"); + if (info == null) throw new NullPointerException("MessageInfo from request missing: " + req); + return secureResponse(info, validatedUser); } - + public Authentication validateRequest(JaspiMessageInfo messageInfo) throws ServerAuthException { try { + System.err.println("jaspAuthenticator.validateRequest(info)"); String authContextId = _authConfig.getAuthContextID(messageInfo); - ServerAuthContext authContext = _authConfig.getAuthContext(authContextId,_serviceSubject,_authProperties); + ServerAuthContext authContext = _authConfig.getAuthContext(authContextId, _serviceSubject, _authProperties); Subject clientSubject = new Subject(); - AuthStatus authStatus = authContext.validateRequest(messageInfo,clientSubject,_serviceSubject); -// String authMethod = (String)messageInfo.getMap().get(JaspiMessageInfo.AUTH_METHOD_KEY); + AuthStatus authStatus = authContext.validateRequest(messageInfo, clientSubject, _serviceSubject); + // String authMethod = + // (String)messageInfo.getMap().get(JaspiMessageInfo.AUTH_METHOD_KEY); + + if (authStatus == AuthStatus.SEND_CONTINUE) return Authentication.SEND_CONTINUE; + if (authStatus == AuthStatus.SEND_FAILURE) return Authentication.SEND_FAILURE; - if (authStatus == AuthStatus.SEND_CONTINUE) - return Authentication.SEND_CONTINUE; - if (authStatus == AuthStatus.SEND_FAILURE) - return Authentication.SEND_FAILURE; - if (authStatus == AuthStatus.SUCCESS) { - Set ids = clientSubject.getPrivateCredentials(UserIdentity.class); + Set ids = clientSubject.getPrivateCredentials(UserIdentity.class); UserIdentity userIdentity; if (ids.size() > 0) { userIdentity = ids.iterator().next(); - } else { + } + else + { CallerPrincipalCallback principalCallback = _callbackHandler.getThreadCallerPrincipalCallback(); - if (principalCallback == null) - { - return Authentication.UNAUTHENTICATED; - } + if (principalCallback == null) { return Authentication.UNAUTHENTICATED; } Principal principal = principalCallback.getPrincipal(); - if (principal == null) { + if (principal == null) + { String principalName = principalCallback.getName(); Set principals = principalCallback.getSubject().getPrincipals(); - for (Principal p: principals) + for (Principal p : principals) { if (p.getName().equals(principalName)) { @@ -136,10 +149,7 @@ public class JaspiAuthenticator implements Authenticator break; } } - if (principal == null) - { - return Authentication.UNAUTHENTICATED; - } + if (principal == null) { return Authentication.UNAUTHENTICATED; } } GroupPrincipalCallback groupPrincipalCallback = _callbackHandler.getThreadGroupPrincipalCallback(); String[] groups = groupPrincipalCallback == null ? null : groupPrincipalCallback.getGroups(); @@ -149,10 +159,10 @@ public class JaspiAuthenticator implements Authenticator } if (authStatus == AuthStatus.SEND_SUCCESS) { - //we are processing a message in a secureResponse dialog. + // we are processing a message in a secureResponse dialog. return Authentication.SEND_SUCCESS; } - //should not happen + // should not happen throw new NullPointerException("No AuthStatus returned"); } catch (AuthException e) @@ -166,13 +176,16 @@ public class JaspiAuthenticator implements Authenticator try { String authContextId = _authConfig.getAuthContextID(messageInfo); - ServerAuthContext authContext = _authConfig.getAuthContext(authContextId,_serviceSubject,_authProperties); - // TODO authContext.cleanSubject(messageInfo,validatedUser.getUserIdentity().getSubject()); - AuthStatus status = authContext.secureResponse(messageInfo,_serviceSubject); + ServerAuthContext authContext = _authConfig.getAuthContext(authContextId, _serviceSubject, _authProperties); + // TODO + // authContext.cleanSubject(messageInfo,validatedUser.getUserIdentity().getSubject()); + AuthStatus status = authContext.secureResponse(messageInfo, _serviceSubject); return (AuthStatus.SEND_SUCCESS.equals(status)); } catch (AuthException e) { + System.err.println("Error in JaspiAuthenticator.secureResponse"); + e.printStackTrace(); throw new ServerAuthException(e); } } diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java index 35015090fb8..c645ffa85a2 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java @@ -98,9 +98,13 @@ public class JaspiAuthenticatorFactory extends DefaultAuthenticatorFactory Subject serviceSubject=findServiceSubject(server); String serverName=findServerName(server,serviceSubject); + System.err.println("authconfigfactory="+authConfigFactory+" serviceSubject="+serviceSubject+" serverName="+serverName); String appContext = serverName + " " + context.getContextPath(); + + System.err.println("appcontext="+appContext); AuthConfigProvider authConfigProvider = authConfigFactory.getConfigProvider(MESSAGE_LAYER,appContext,listener); + System.err.println("authconfigProvider="+authConfigProvider); if (authConfigProvider != null) { ServletCallbackHandler servletCallbackHandler = new ServletCallbackHandler(loginService); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java index bd66f60bf75..3908ec7064d 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java @@ -90,12 +90,12 @@ public class BaseAuthModule implements ServerAuthModule, ServerAuthContext public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException { // servlets do not need secured responses - return AuthStatus.SUCCESS; + return AuthStatus.SEND_SUCCESS; } public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException { - return AuthStatus.FAILURE; + return AuthStatus.SEND_FAILURE; } /** diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index ab46f0ab571..88ce65e3526 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -146,22 +146,25 @@ public class FormAuthModule extends BaseAuthModule @Override public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException { + System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject)"); HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage(); HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage(); HttpSession session = request.getSession(isMandatory(messageInfo)); - String uri = request.getPathInfo(); + String uri = request.getRequestURI(); // not mandatory and not authenticated if (session == null || isLoginOrErrorPage(uri)) return AuthStatus.SUCCESS; + System.err.println("FormAuthModule.validateRequest(info,subect,serviceSubject), uri="+uri); try { // Handle a request for authentication. // TODO perhaps j_securitycheck can be uri suffix? - if (uri.endsWith(__J_SECURITY_CHECK)) + if (uri != null && isJSecurityCheck(uri)) { final String username = request.getParameter(__J_USERNAME); final String password = request.getParameter(__J_PASSWORD); + System.err.println("Try login username="+username+" password="+password); boolean success = tryLogin(messageInfo, clientSubject, response, session, username, new Password(password)); if (success) { @@ -199,6 +202,7 @@ public class FormAuthModule extends BaseAuthModule if (form_cred != null) { + System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); boolean success = tryLogin(messageInfo, clientSubject, response, session, form_cred._jUserName, new Password(new String(form_cred._jPassword))); if (success) { return AuthStatus.SUCCESS; } // CallbackHandler loginCallbackHandler = new @@ -300,6 +304,7 @@ public class FormAuthModule extends BaseAuthModule return AuthStatus.SUCCESS; // redirect to login page + System.err.println("Redirecting to login page"); if (request.getQueryString() != null) uri += "?" + request.getQueryString(); session.setAttribute(__J_URI, request.getScheme() + "://" + request.getServerName() @@ -320,6 +325,20 @@ public class FormAuthModule extends BaseAuthModule } } + + /* ------------------------------------------------------------ */ + public boolean isJSecurityCheck(String uri) + { + int jsc = uri.indexOf(__J_SECURITY_CHECK); + + if (jsc<0) + return false; + int e=jsc+__J_SECURITY_CHECK.length(); + if (e==uri.length()) + return true; + char c = uri.charAt(e); + return c==';'||c=='#'||c=='/'||c=='?'; + } private boolean tryLogin(MessageInfo messageInfo, Subject clientSubject, HttpServletResponse response, HttpSession session, diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java index 5878381ec2e..6a4b837783f 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java @@ -318,11 +318,13 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti if (!_loginServiceShared && _loginService instanceof LifeCycle) ((LifeCycle)_loginService).start(); + System.err.println("authenticator="+_authenticator+" authenticatorFactory="+_authenticatorFactory+" identityService="+_identityService); if (_authenticator==null && _authenticatorFactory!=null && _identityService!=null) { _authenticator=_authenticatorFactory.getAuthenticator(getServer(),ContextHandler.getCurrentContext(),this, _identityService, _loginService); if (_authenticator!=null) _authMethod=_authenticator.getAuthMethod(); + System.err.println("Called auth factory, authenticator="+_authenticator); } if (_authenticator==null) @@ -477,7 +479,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti deferred.setIdentityService(_identityService); deferred.setLoginService(_loginService); baseRequest.setAuthentication(authentication); - +System.err.println("uri="+baseRequest.getUri()+" Auth is deferred"); try { handler.handle(pathInContext, baseRequest, request, response); @@ -487,7 +489,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti previousIdentity = deferred.getPreviousAssociation(); deferred.setIdentityService(null); } - + System.err.println("Securityhandler calling secureResponse, for Authentication.User"); Authentication auth=baseRequest.getAuthentication(); if (auth instanceof Authentication.User) { From 53fa6a04810f2cd4366d3821efd8497e2479d0f8 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 4 Oct 2011 14:31:34 +1100 Subject: [PATCH 02/92] Hooked up the LoginCallbackImpl inside ServletCallbackHandler as the FormAuthModule appears to expect to see it; made JaspiAuthenticator return Deferred IFF !mandatory && allowLazyAuth && auth module returned UNAUTHENTICATED. This hinges on the fact that an auth module who is prepared to skip doing authentication (because !mandatory) must return AuthStatus.SUCCESS, which JaspiAuthenticator turns into Authentication.UNAUTHENTICATED. --- .../security/jaspi/JaspiAuthenticator.java | 19 +- .../jaspi/ServletCallbackHandler.java | 3 +- .../jaspi/modules/BaseAuthModule.java | 1 + .../jaspi/modules/FormAuthModule.java | 173 ++++-------------- 4 files changed, 52 insertions(+), 144 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index 1b065287658..6d0e6963e9a 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -81,21 +81,27 @@ public class JaspiAuthenticator implements Authenticator public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException { - System.err.println("JaspiAuthenticator.validateRequest, uri=" + ((javax.servlet.http.HttpServletRequest) request).getRequestURI() - + "lazy=" + System.err.println("\nJaspiAuthenticator.validateRequest, uri=" + ((javax.servlet.http.HttpServletRequest) request).getRequestURI() + + " lazy=" + _allowLazyAuthentication + " mandatory=" + mandatory); - new Throwable().printStackTrace(); - - + JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); + //TODO janb - removed deferred authentication temporarily /* if (_allowLazyAuthentication && !mandatory) return _deferred;*/ - return validateRequest(info); + Authentication a = validateRequest(info); + + //if its not mandatory to authenticate, and the authenticator returned UNAUTHENTICATED, we treat it as authentication deferred + if (_allowLazyAuthentication && !info.isAuthMandatory() && a == Authentication.UNAUTHENTICATED) + a =_deferred; + + System.err.println("JaspiAuthenticator.validateRequest returning "+a); + return a; } // most likely validatedUser is not needed here. @@ -108,6 +114,7 @@ public class JaspiAuthenticator implements Authenticator return secureResponse(info, validatedUser); } + public Authentication validateRequest(JaspiMessageInfo messageInfo) throws ServerAuthException { try diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/ServletCallbackHandler.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/ServletCallbackHandler.java index d11a8d9bc84..44dbda13e3b 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/ServletCallbackHandler.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/ServletCallbackHandler.java @@ -90,8 +90,9 @@ public class ServletCallbackHandler implements CallbackHandler if (user!=null) { + loginCallback.setUserPrincipal(user.getUserPrincipal()); + credentialValidationCallback.getSubject().getPrivateCredentials().add(loginCallback); credentialValidationCallback.setResult(true); - credentialValidationCallback.getSubject().getPrincipals().addAll(user.getSubject().getPrincipals()); credentialValidationCallback.getSubject().getPrivateCredentials().add(user); } diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java index 3908ec7064d..7099661a4da 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java @@ -131,6 +131,7 @@ public class BaseAuthModule implements ServerAuthModule, ServerAuthContext if (credValidationCallback.getResult()) { Set loginCallbacks = clientSubject.getPrivateCredentials(LoginCallbackImpl.class); + System.err.println("LoginCallbackImpls.isEmpty="+loginCallbacks.isEmpty()); if (!loginCallbacks.isEmpty()) { LoginCallbackImpl loginCallback = loginCallbacks.iterator().next(); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index 88ce65e3526..fa2b5bb3a85 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -146,40 +146,50 @@ public class FormAuthModule extends BaseAuthModule @Override public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException { - System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject)"); + HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage(); HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage(); - HttpSession session = request.getSession(isMandatory(messageInfo)); String uri = request.getRequestURI(); - // not mandatory and not authenticated - if (session == null || isLoginOrErrorPage(uri)) return AuthStatus.SUCCESS; + if (uri==null) + uri=URIUtil.SLASH; + + boolean mandatory = isMandatory(messageInfo); + mandatory |= isJSecurityCheck(uri); + HttpSession session = request.getSession(mandatory); + + System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(uri)); + + // not mandatory or its the login or login error page don't authenticate + if (!mandatory || isLoginOrErrorPage(uri)) return AuthStatus.SUCCESS; - System.err.println("FormAuthModule.validateRequest(info,subect,serviceSubject), uri="+uri); try { // Handle a request for authentication. - // TODO perhaps j_securitycheck can be uri suffix? - if (uri != null && isJSecurityCheck(uri)) + if (isJSecurityCheck(uri)) { - final String username = request.getParameter(__J_USERNAME); final String password = request.getParameter(__J_PASSWORD); System.err.println("Try login username="+username+" password="+password); boolean success = tryLogin(messageInfo, clientSubject, response, session, username, new Password(password)); if (success) { - // Redirect to original request - String nuri = (String) session.getAttribute(__J_URI); + // Redirect to original request + String nuri=null; + synchronized(session) + { + nuri = (String) session.getAttribute(__J_URI); + } + if (nuri == null || nuri.length() == 0) { nuri = request.getContextPath(); - if (nuri.length() == 0) nuri = URIUtil.SLASH; + if (nuri.length() == 0) + nuri = URIUtil.SLASH; } - session.removeAttribute(__J_URI); // Remove popped return - // URI. - response.setContentLength(0); + + System.err.println("FormAuthModule succesful login, sending redirect to "+nuri); + response.setContentLength(0); response.sendRedirect(response.encodeRedirectURL(nuri)); - return AuthStatus.SEND_CONTINUE; } // not authenticated @@ -205,88 +215,6 @@ public class FormAuthModule extends BaseAuthModule System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); boolean success = tryLogin(messageInfo, clientSubject, response, session, form_cred._jUserName, new Password(new String(form_cred._jPassword))); if (success) { return AuthStatus.SUCCESS; } - // CallbackHandler loginCallbackHandler = new - // UserPasswordCallbackHandler(form_cred._jUserName, - // form_cred._jPassword); - // LoginResult loginResult = loginService.login(clientSubject, - // loginCallbackHandler); - // //TODO what should happen if !isMandatory but credentials - // exist and are wrong? - // if (loginResult.isSuccess()) - // { - // callbackHandler.handle(new - // Callback[]{loginResult.getCallerPrincipalCallback(), - // loginResult.getGroupPrincipalCallback()}); - // messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, - // Constraint.__FORM_AUTH); - // - // form_cred = new FormCredential(form_cred._jUserName, - // form_cred._jPassword, - // loginResult.getCallerPrincipalCallback().getPrincipal()); - // - // session.setAttribute(__J_AUTHENTICATED, form_cred); - // if (ssoSource != null && ssoSource.fetch(request) == null) - // { - // UserInfo userInfo = new UserInfo(form_cred._jUserName, - // form_cred._jPassword); - // ssoSource.store(userInfo, response); - // } - // messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, - // Constraint.__FORM_AUTH); - // return AuthStatus.SUCCESS; - // } - - // // We have a form credential. Has it been distributed? - // if (form_cred._userPrincipal==null) - // { - // // This form_cred appears to have been distributed. Need to - // reauth - // form_cred.authenticate(realm, request); - // - // // Sign-on to SSO mechanism - // if (form_cred._userPrincipal!=null && realm instanceof - // SSORealm) - // ((SSORealm)realm).setSingleSignOn(request,response,form_cred._userPrincipal,new - // Password(form_cred._jPassword)); - // - // } - // else if (!realm.reauthenticate(form_cred._userPrincipal)) - // // Else check that it is still authenticated. - // form_cred._userPrincipal=null; - // - // // If this credential is still authenticated - // if (form_cred._userPrincipal!=null) - // { - // if(LOG.isDebugEnabled())LOG.debug("FORM Authenticated for - // "+form_cred._userPrincipal.getName()); - // request.setAuthType(Constraint.__FORM_AUTH); - // //jaspi - // // request.setUserPrincipal(form_cred._userPrincipal); - // return form_cred._userPrincipal; - // } - // else - // session.setAttribute(__J_AUTHENTICATED,null); - // } - // else if (realm instanceof SSORealm) - // { - // // Try a single sign on. - // Credential cred = - // ((SSORealm)realm).getSingleSignOn(request,response); - // - // if (request.getUserPrincipal()!=null) - // { - // form_cred=new FormCredential(); - // form_cred._userPrincipal=request.getUserPrincipal(); - // form_cred._jUserName=form_cred._userPrincipal.getName(); - // if (cred!=null) - // form_cred._jPassword=cred.toString(); - // if(LOG.isDebugEnabled())LOG.debug("SSO for - // "+form_cred._userPrincipal); - // - // request.setAuthType(Constraint.__FORM_AUTH); - // session.setAttribute(__J_AUTHENTICATED,form_cred); - // return form_cred._userPrincipal; - // } } else if (ssoSource != null) { @@ -298,19 +226,17 @@ public class FormAuthModule extends BaseAuthModule } } - // Don't authenticate authform or errorpage - if (!isMandatory(messageInfo) || isLoginOrErrorPage(uri)) - // TODO verify this is correct action - return AuthStatus.SUCCESS; + // redirect to login page + StringBuffer buf = request.getRequestURL(); + if (request.getQueryString() != null) + buf.append("?").append(request.getQueryString()); - // redirect to login page - System.err.println("Redirecting to login page"); - if (request.getQueryString() != null) uri += "?" + request.getQueryString(); - session.setAttribute(__J_URI, request.getScheme() + "://" - + request.getServerName() - + ":" - + request.getServerPort() - + URIUtil.addPaths(request.getContextPath(), uri)); + synchronized (session) + { + session.setAttribute(__J_URI, buf.toString()); + } + + System.err.println("Redirecting to login page "+_formLoginPage+" and remembering juri="+buf.toString()); response.setContentLength(0); response.sendRedirect(response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(), _formLoginPage))); return AuthStatus.SEND_CONTINUE; @@ -349,6 +275,7 @@ public class FormAuthModule extends BaseAuthModule { char[] pwdChars = password.toString().toCharArray(); Set loginCallbacks = clientSubject.getPrivateCredentials(LoginCallbackImpl.class); + System.err.println("FormAuthModule, LoginCallbackImpl.isEmpty="+loginCallbacks.isEmpty()); if (!loginCallbacks.isEmpty()) { LoginCallbackImpl loginCallback = loginCallbacks.iterator().next(); @@ -366,34 +293,6 @@ public class FormAuthModule extends BaseAuthModule return true; } return false; - // LoginCallback loginCallback = new LoginCallback(clientSubject, - // username, password); - // loginService.login(loginCallback); - // if (loginCallback.isSuccess()) - // { - // CallerPrincipalCallback callerPrincipalCallback = new - // CallerPrincipalCallback(clientSubject, - // loginCallback.getUserPrincipal()); - // GroupPrincipalCallback groupPrincipalCallback = new - // GroupPrincipalCallback(clientSubject, - // loginCallback.getGroups().toArray(new - // String[loginCallback.getGroups().size()])); - // callbackHandler.handle(new Callback[] {callerPrincipalCallback, - // groupPrincipalCallback}); - // messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, - // Constraint.__FORM_AUTH); - // FormCredential form_cred = new FormCredential(username, password, - // loginCallback.getUserPrincipal()); - // - // session.setAttribute(__J_AUTHENTICATED, form_cred); - // // Sign-on to SSO mechanism - // if (ssoSource != null) - // { - // UserInfo userInfo = new UserInfo(username, password); - // ssoSource.store(userInfo, response); - // } - // } - // return loginCallback.isSuccess(); } public boolean isLoginOrErrorPage(String pathInContext) From 4c0a3001e5731052c8ea3f91173d7c8bffed212c Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 14 Oct 2011 14:39:46 +1100 Subject: [PATCH 03/92] Ensure login/error page matching is done against the path in context. --- .../eclipse/jetty/security/jaspi/modules/FormAuthModule.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index fa2b5bb3a85..52018e87c09 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -160,7 +160,7 @@ public class FormAuthModule extends BaseAuthModule System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(uri)); // not mandatory or its the login or login error page don't authenticate - if (!mandatory || isLoginOrErrorPage(uri)) return AuthStatus.SUCCESS; + if (!mandatory || isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo()))) return AuthStatus.SUCCESS; try { @@ -297,6 +297,7 @@ public class FormAuthModule extends BaseAuthModule public boolean isLoginOrErrorPage(String pathInContext) { + System.err.println("ISLOGINORERRORPAGE? "+pathInContext+" error: "+_formErrorPath+" login:"+_formLoginPath); return pathInContext != null && (pathInContext.equals(_formErrorPath) || pathInContext.equals(_formLoginPath)); } From d2e85010529e1209b2bf4852bc8283000ffa0090 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 14 Oct 2011 15:38:51 +1100 Subject: [PATCH 04/92] Remove some debug printlns; add a couple of comments --- .../jetty/security/jaspi/JaspiAuthenticator.java | 4 ---- .../jetty/security/jaspi/modules/FormAuthModule.java | 10 ++++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index 6d0e6963e9a..455cf28a4d4 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -89,10 +89,6 @@ public class JaspiAuthenticator implements Authenticator JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); - - //TODO janb - removed deferred authentication temporarily - /* if (_allowLazyAuthentication && !mandatory) - return _deferred;*/ Authentication a = validateRequest(info); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index 52018e87c09..3bb748a8614 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -213,6 +213,9 @@ public class FormAuthModule extends BaseAuthModule if (form_cred != null) { System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); + + //TODO: we would like the form auth module to be able to invoke the loginservice.validate() method to check the previously authed user + boolean success = tryLogin(messageInfo, clientSubject, response, session, form_cred._jUserName, new Password(new String(form_cred._jPassword))); if (success) { return AuthStatus.SUCCESS; } } @@ -279,7 +282,7 @@ public class FormAuthModule extends BaseAuthModule if (!loginCallbacks.isEmpty()) { LoginCallbackImpl loginCallback = loginCallbacks.iterator().next(); - FormCredential form_cred = new FormCredential(username, pwdChars, loginCallback.getUserPrincipal()); + FormCredential form_cred = new FormCredential(username, pwdChars, loginCallback.getUserPrincipal(), loginCallback.getSubject()); session.setAttribute(__J_AUTHENTICATED, form_cred); } @@ -312,12 +315,15 @@ public class FormAuthModule extends BaseAuthModule char[] _jPassword; transient Principal _userPrincipal; + + transient Subject _subject; - private FormCredential(String _jUserName, char[] _jPassword, Principal _userPrincipal) + private FormCredential(String _jUserName, char[] _jPassword, Principal _userPrincipal, Subject subject) { this._jUserName = _jUserName; this._jPassword = _jPassword; this._userPrincipal = _userPrincipal; + this._subject = subject; } public void valueBound(HttpSessionBindingEvent event) From e30622516a04def10824ccbd5d3cbf989dfd6408 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 18 Oct 2011 07:35:42 +1100 Subject: [PATCH 05/92] add more debug printlns and a stack trace --- .../org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java | 1 + .../eclipse/jetty/security/jaspi/modules/FormAuthModule.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index 455cf28a4d4..526f53a0101 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -86,6 +86,7 @@ public class JaspiAuthenticator implements Authenticator + _allowLazyAuthentication + " mandatory=" + mandatory); + new Throwable().printStackTrace(); JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index 3bb748a8614..c6441f4b526 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -157,7 +157,7 @@ public class FormAuthModule extends BaseAuthModule mandatory |= isJSecurityCheck(uri); HttpSession session = request.getSession(mandatory); - System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(uri)); + System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo()))); // not mandatory or its the login or login error page don't authenticate if (!mandatory || isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo()))) return AuthStatus.SUCCESS; From e8b8c659b0884d33c52949b7f30ce3b7ae05b4a1 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 18 Oct 2011 10:41:19 +1100 Subject: [PATCH 06/92] Add mechanism to indicate to FormAuthModule that a deferred authentication is being requested, but for a call to Request.getRemoteUser, where there is no opportunity to issue a challenge. --- .../jetty/security/jaspi/modules/FormAuthModule.java | 12 +++++++++++- .../authentication/DeferredAuthentication.java | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index c6441f4b526..72fc9b7f55f 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -36,7 +36,9 @@ import javax.servlet.http.HttpSessionBindingListener; import org.eclipse.jetty.http.security.Constraint; import org.eclipse.jetty.http.security.Password; import org.eclipse.jetty.security.CrossContextPsuedoSession; +import org.eclipse.jetty.security.authentication.DeferredAuthentication; import org.eclipse.jetty.security.authentication.LoginCallbackImpl; +import org.eclipse.jetty.server.Authentication; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.log.Log; @@ -207,9 +209,10 @@ public class FormAuthModule extends BaseAuthModule // that occur? return AuthStatus.SEND_FAILURE; } + + // Check if the session is already authenticated. FormCredential form_cred = (FormCredential) session.getAttribute(__J_AUTHENTICATED); - if (form_cred != null) { System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); @@ -228,6 +231,13 @@ public class FormAuthModule extends BaseAuthModule if (success) { return AuthStatus.SUCCESS; } } } + + + + // if we can't send challenge + if (DeferredAuthentication.isDeferred(response)) + return AuthStatus.SUCCESS; + // redirect to login page StringBuffer buf = request.getRequestURL(); diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java index e1aabf587ce..297d5beeff0 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java @@ -167,7 +167,7 @@ public class DeferredAuthentication implements Authentication.Deferred * @param response * @return true if this response is from a deferred call to {@link #authenticate(ServletRequest)} */ - public boolean isDeferred(HttpServletResponse response) + public static boolean isDeferred(HttpServletResponse response) { return response==__deferredResponse; } @@ -175,7 +175,7 @@ public class DeferredAuthentication implements Authentication.Deferred /* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */ - static HttpServletResponse __deferredResponse = new HttpServletResponse() + final static HttpServletResponse __deferredResponse = new HttpServletResponse() { public void addCookie(Cookie cookie) { From 5154f6fc2722e574dde1d5b181b0b98c46ac4b42 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 23 Dec 2011 00:42:11 +1100 Subject: [PATCH 07/92] fixed version from 7 --- jetty-aggregate/jetty-websocket/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index c650ef55103..4e810fad5d5 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 8.1.0-SNAPSHOT 4.0.0 jetty-websocket From 06882e3c5631fd001c5b54d4ffb43f1e5b71ceab Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 22 Dec 2011 12:51:44 -0600 Subject: [PATCH 08/92] Updating VERSION.txt top section --- VERSION.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 97a124abfa9..43110f23beb 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,22 @@ -jetty-7.6.0-SNAPSHOT +jetty-7.6.0.RC2 - 22 December 2011 + + 364638 HttpParser closes if data received while seeking EOF. Tests fixed to + cope + + 364921 Made test less time sensitive for ssl + + 364936 use Resource for opening URL streams + + 365267 NullPointerException in bad Address + + 365375 ResourceHandler should be a HandlerWrapper + + 365750 Support WebSocket over SSL, aka wss:// + + 365932 Produce jetty-websocket aggregate jar for android use + + 365947 Set headers for Auth failure and retry in http-spi + + 366316 Superfluous printStackTrace on 404 + + 366342 Dont persist DosFilter trackers in http session + + 366730 pass the time idle to onIdleExpire + + 367048 test harness for guard on suspended requests + + 367175 SSL 100% CPU spin in case of blocked write and RST. + + 367219 WebSocketClient.open() fails when URI uses default ports. + + JETTY-1460 suppress PrintWriter exceptions + + JETTY-1463 websocket D0 parser should return progress even if no fill done + + JETTY-1465 NPE in ContextHandler.toString jetty-7.6.0.RC1 - 04 December 2011 + 352565 cookie httponly flag ignored From f1ee596f1ed57829695632c04cbd137e81b31f6b Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 22 Dec 2011 13:15:53 -0600 Subject: [PATCH 09/92] [maven-release-plugin] prepare release jetty-7.6.0.RC2 --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 3eb95b0ea27..338f5a7e505 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 072ff23321e..d8ce66015a8 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 3a6eee3ac51..c015e2c6c54 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index e30ee5b160a..be101048037 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index ff9bf1f74c9..8ec347407df 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 8d3cdddcb2f..98cb07700b4 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index 2e4f9bd47ee..d757278e93e 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index 47090b07d8f..b1d1c2c4272 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index c650ef55103..c1b728dda69 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 7de1ac8d379..000a90a8668 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index c02155bea81..4d1930d46e6 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index a4b6c219f44..e26df74b4fe 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 02a0320bdd9..81b717bdd75 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 6c4c47b893a..f268c0b4ecb 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 528e7ce46c0..75cd1e1de11 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 173d546d426..66c0b0266db 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 856673b86eb..6261ab25bab 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 53d5c6e9641..93148c4d385 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 org.eclipse.jetty diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 8a5f69852a6..a5dc906441c 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 org.eclipse.jetty diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index f06938ce0f8..17f42fdf987 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 4b9a0dc2a9d..e0b46793c2a 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 5eaf6fef291..553dcc4130e 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-jndi diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index bfff477df54..cc8efbc813e 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index 40da79b3cfe..f2b5c24180b 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 75b77f019a9..a9f8598b63c 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index 76e530cde78..ab3279c35f5 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 595e77a4b24..32529e4fcad 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index a0463cc5643..f413332add6 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 87a7087125d..a90a9269bb1 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index fbb16968697..770b56e2673 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index e389254295d..460992fc946 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index ae30fdd313e..88f79b92184 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index f0ae38a1230..94e186813f0 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 75b8349308e..5df1b381f56 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 391eb9691c7..0d0d80fce8f 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 64548024678..3d1952df61b 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 org.eclipse.jetty jetty-policy diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index cdfe6d1c5b0..58d9ff409fc 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 397991f6299..2feb2b29fc1 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 8e71f15966d..e1783efe59e 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 70ab5daf8a3..cd1beae6be4 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 9e112abff9e..8180d140df1 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-servlets diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index 9fcfa2c2cc8..899560b607e 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 9e5dc45445a..5a3698120f4 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index eb1971c5043..20fe4dad77f 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index cfb4b91e581..218006bc847 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index b2a39954309..a4a68837d64 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 63315d4c21c..9132c88222e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 19 jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 498bf751457..53b1d548a71 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index 2f5b334f991..9bbf9158d8a 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 65f98aa0f62..203ff1fe9db 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 5c9fbf6c19b..c40a72609a5 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 org.eclipse.jetty diff --git a/tests/pom.xml b/tests/pom.xml index 28cee13d78b..c241c18be22 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index bf1daf62b96..730a67654f0 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index a5e08c91017..67e71aa6f7f 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index 8c829fa6935..a4088ae4417 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 1152f8a40e2..633714503fd 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index 567cfad6daa..3e908cd5f5a 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 2979f679288..0097b602363 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index c34dda4cdc9..1f20f4b2186 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index fcc140014f9..1ae1572ce79 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 30018a2bb43a46044c9cc5aef17b8632a0204b62 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 22 Dec 2011 13:32:58 -0600 Subject: [PATCH 10/92] [maven-release-plugin] rollback the release of jetty-7.6.0.RC2 --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 338f5a7e505..3eb95b0ea27 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index d8ce66015a8..072ff23321e 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index c015e2c6c54..3a6eee3ac51 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index be101048037..e30ee5b160a 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index 8ec347407df..ff9bf1f74c9 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 98cb07700b4..8d3cdddcb2f 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index d757278e93e..2e4f9bd47ee 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index b1d1c2c4272..47090b07d8f 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index c1b728dda69..c650ef55103 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 000a90a8668..7de1ac8d379 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index 4d1930d46e6..c02155bea81 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index e26df74b4fe..a4b6c219f44 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 81b717bdd75..02a0320bdd9 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index f268c0b4ecb..6c4c47b893a 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 75cd1e1de11..528e7ce46c0 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 66c0b0266db..173d546d426 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 6261ab25bab..856673b86eb 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 93148c4d385..53d5c6e9641 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index a5dc906441c..8a5f69852a6 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index 17f42fdf987..f06938ce0f8 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index e0b46793c2a..4b9a0dc2a9d 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 553dcc4130e..5eaf6fef291 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-jndi diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index cc8efbc813e..bfff477df54 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index f2b5c24180b..40da79b3cfe 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index a9f8598b63c..75b77f019a9 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index ab3279c35f5..76e530cde78 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 32529e4fcad..595e77a4b24 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index f413332add6..a0463cc5643 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index a90a9269bb1..87a7087125d 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index 770b56e2673..fbb16968697 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 460992fc946..e389254295d 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 88f79b92184..ae30fdd313e 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 94e186813f0..f0ae38a1230 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 5df1b381f56..75b8349308e 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 0d0d80fce8f..391eb9691c7 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 3d1952df61b..64548024678 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT org.eclipse.jetty jetty-policy diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index 58d9ff409fc..cdfe6d1c5b0 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 2feb2b29fc1..397991f6299 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index e1783efe59e..8e71f15966d 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index cd1beae6be4..70ab5daf8a3 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 8180d140df1..9e112abff9e 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlets diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index 899560b607e..9fcfa2c2cc8 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 5a3698120f4..9e5dc45445a 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index 20fe4dad77f..eb1971c5043 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index 218006bc847..cfb4b91e581 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index a4a68837d64..b2a39954309 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 9132c88222e..63315d4c21c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 19 jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 53b1d548a71..498bf751457 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index 9bbf9158d8a..2f5b334f991 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 203ff1fe9db..65f98aa0f62 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index c40a72609a5..5c9fbf6c19b 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/tests/pom.xml b/tests/pom.xml index c241c18be22..28cee13d78b 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 730a67654f0..bf1daf62b96 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index 67e71aa6f7f..a5e08c91017 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index a4088ae4417..8c829fa6935 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 633714503fd..1152f8a40e2 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index 3e908cd5f5a..567cfad6daa 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 0097b602363..2979f679288 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 1f20f4b2186..c34dda4cdc9 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 1ae1572ce79..fcc140014f9 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 80a367cd85043b254867f71f67a94924e556497f Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 22 Dec 2011 13:54:13 -0600 Subject: [PATCH 11/92] [maven-release-plugin] prepare release jetty-7.6.0.RC2 --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 3eb95b0ea27..338f5a7e505 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 072ff23321e..d8ce66015a8 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 3a6eee3ac51..c015e2c6c54 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index e30ee5b160a..be101048037 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index ff9bf1f74c9..8ec347407df 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 8d3cdddcb2f..98cb07700b4 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index 2e4f9bd47ee..d757278e93e 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index 47090b07d8f..b1d1c2c4272 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index c650ef55103..c1b728dda69 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 7de1ac8d379..000a90a8668 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index c02155bea81..4d1930d46e6 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index a4b6c219f44..e26df74b4fe 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 02a0320bdd9..81b717bdd75 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 6c4c47b893a..f268c0b4ecb 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 528e7ce46c0..75cd1e1de11 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 173d546d426..66c0b0266db 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 856673b86eb..6261ab25bab 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 53d5c6e9641..93148c4d385 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 org.eclipse.jetty diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 8a5f69852a6..a5dc906441c 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 org.eclipse.jetty diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index f06938ce0f8..17f42fdf987 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 4b9a0dc2a9d..e0b46793c2a 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 5eaf6fef291..553dcc4130e 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-jndi diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index bfff477df54..cc8efbc813e 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index 40da79b3cfe..f2b5c24180b 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 75b77f019a9..a9f8598b63c 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index 76e530cde78..ab3279c35f5 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 595e77a4b24..32529e4fcad 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index a0463cc5643..f413332add6 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 87a7087125d..a90a9269bb1 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index fbb16968697..770b56e2673 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index e389254295d..460992fc946 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index ae30fdd313e..88f79b92184 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index f0ae38a1230..94e186813f0 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 75b8349308e..5df1b381f56 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 391eb9691c7..0d0d80fce8f 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 64548024678..3d1952df61b 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 org.eclipse.jetty jetty-policy diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index cdfe6d1c5b0..58d9ff409fc 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 397991f6299..2feb2b29fc1 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 8e71f15966d..e1783efe59e 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 70ab5daf8a3..cd1beae6be4 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 9e112abff9e..8180d140df1 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-servlets diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index 9fcfa2c2cc8..899560b607e 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 9e5dc45445a..5a3698120f4 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index eb1971c5043..20fe4dad77f 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index cfb4b91e581..218006bc847 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index b2a39954309..a4a68837d64 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 63315d4c21c..9132c88222e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 19 jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 498bf751457..53b1d548a71 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index 2f5b334f991..9bbf9158d8a 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 65f98aa0f62..203ff1fe9db 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 5c9fbf6c19b..c40a72609a5 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 org.eclipse.jetty diff --git a/tests/pom.xml b/tests/pom.xml index 28cee13d78b..c241c18be22 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC2 org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index bf1daf62b96..730a67654f0 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index a5e08c91017..67e71aa6f7f 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index 8c829fa6935..a4088ae4417 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 1152f8a40e2..633714503fd 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index 567cfad6daa..3e908cd5f5a 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 2979f679288..0097b602363 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index c34dda4cdc9..1f20f4b2186 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index fcc140014f9..1ae1572ce79 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.0-SNAPSHOT + 7.6.0.RC2 test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From e5f84fc7a8629b81b05f6d347a8415e8139a26d2 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 22 Dec 2011 13:54:19 -0600 Subject: [PATCH 12/92] [maven-release-plugin] prepare for next development iteration --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 338f5a7e505..3eb95b0ea27 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index d8ce66015a8..072ff23321e 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index c015e2c6c54..3a6eee3ac51 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index be101048037..e30ee5b160a 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index 8ec347407df..ff9bf1f74c9 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 98cb07700b4..8d3cdddcb2f 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index d757278e93e..2e4f9bd47ee 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index b1d1c2c4272..47090b07d8f 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index c1b728dda69..c650ef55103 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 000a90a8668..7de1ac8d379 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index 4d1930d46e6..c02155bea81 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index e26df74b4fe..a4b6c219f44 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 81b717bdd75..02a0320bdd9 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index f268c0b4ecb..6c4c47b893a 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 75cd1e1de11..528e7ce46c0 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 66c0b0266db..173d546d426 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 6261ab25bab..856673b86eb 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 93148c4d385..53d5c6e9641 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index a5dc906441c..8a5f69852a6 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index 17f42fdf987..f06938ce0f8 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index e0b46793c2a..4b9a0dc2a9d 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 553dcc4130e..5eaf6fef291 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-jndi diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index cc8efbc813e..bfff477df54 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index f2b5c24180b..40da79b3cfe 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index a9f8598b63c..75b77f019a9 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index ab3279c35f5..76e530cde78 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 32529e4fcad..595e77a4b24 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index f413332add6..a0463cc5643 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index a90a9269bb1..87a7087125d 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index 770b56e2673..fbb16968697 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 460992fc946..e389254295d 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 88f79b92184..ae30fdd313e 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 94e186813f0..f0ae38a1230 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 5df1b381f56..75b8349308e 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 0d0d80fce8f..391eb9691c7 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 3d1952df61b..64548024678 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT org.eclipse.jetty jetty-policy diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index 58d9ff409fc..cdfe6d1c5b0 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 2feb2b29fc1..397991f6299 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index e1783efe59e..8e71f15966d 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index cd1beae6be4..70ab5daf8a3 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 8180d140df1..9e112abff9e 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlets diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index 899560b607e..9fcfa2c2cc8 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 5a3698120f4..9e5dc45445a 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index 20fe4dad77f..eb1971c5043 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index 218006bc847..cfb4b91e581 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index a4a68837d64..b2a39954309 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 9132c88222e..63315d4c21c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 19 jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 53b1d548a71..498bf751457 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index 9bbf9158d8a..2f5b334f991 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 203ff1fe9db..65f98aa0f62 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index c40a72609a5..5c9fbf6c19b 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/tests/pom.xml b/tests/pom.xml index c241c18be22..28cee13d78b 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC2 + 7.6.0-SNAPSHOT org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 730a67654f0..bf1daf62b96 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index 67e71aa6f7f..a5e08c91017 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index a4088ae4417..8c829fa6935 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 633714503fd..1152f8a40e2 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index 3e908cd5f5a..567cfad6daa 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 0097b602363..2979f679288 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 1f20f4b2186..c34dda4cdc9 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 1ae1572ce79..fcc140014f9 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.0.RC2 + 7.6.0-SNAPSHOT test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 64b42a1f0c3de99308706e6d1befb5a90d3dec46 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 22 Dec 2011 14:40:32 -0600 Subject: [PATCH 13/92] updating version.txt --- VERSION.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VERSION.txt b/VERSION.txt index 43110f23beb..eb6e1de36f0 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,3 +1,5 @@ +jetty-7.6.0-SNAPSHOT + jetty-7.6.0.RC2 - 22 December 2011 + 364638 HttpParser closes if data received while seeking EOF. Tests fixed to cope From 34dc926c599732965cfa6ad2cc89281d31e0f88f Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 23 Dec 2011 19:19:20 +1100 Subject: [PATCH 14/92] 367433 added tests to investigate --- .../WebSocketMessageRFC6455Test.java | 64 ++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java index 113fc830122..6c017e93175 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; +import java.net.SocketException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -32,6 +33,8 @@ import java.util.zip.Inflater; import javax.servlet.http.HttpServletRequest; +import junit.framework.Assert; + import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.server.Connector; @@ -1314,7 +1317,7 @@ public class WebSocketMessageRFC6455Test } @Test - public void testClose() throws Exception + public void testTCPClose() throws Exception { Socket socket = new Socket("localhost", __connector.getLocalPort()); OutputStream output = socket.getOutputStream(); @@ -1350,7 +1353,6 @@ public class WebSocketMessageRFC6455Test socket.close(); assertTrue(__serverWebSocket.awaitDisconnected(500)); - try { @@ -1362,6 +1364,64 @@ public class WebSocketMessageRFC6455Test assertTrue(true); } } + + @Test + public void testTCPHalfClose() throws Exception + { + Socket socket = new Socket("localhost", __connector.getLocalPort()); + OutputStream output = socket.getOutputStream(); + output.write( + ("GET /chat HTTP/1.1\r\n"+ + "Host: server.example.com\r\n"+ + "Upgrade: websocket\r\n"+ + "Connection: Upgrade\r\n"+ + "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"+ + "Sec-WebSocket-Origin: http://example.com\r\n"+ + "Sec-WebSocket-Protocol: onConnect\r\n" + + "Sec-WebSocket-Version: "+WebSocketConnectionRFC6455.VERSION+"\r\n"+ + "\r\n").getBytes("ISO-8859-1")); + output.flush(); + + // Make sure the read times out if there are problems with the implementation + socket.setSoTimeout(1000); + + InputStream input = socket.getInputStream(); + + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); + skipTo("Sec-WebSocket-Accept: ",input); + lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); + skipTo("\r\n\r\n",input); + + + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.connection); + + assertEquals(0x81,input.read()); + assertEquals(0x0f,input.read()); + lookFor("sent on connect",input); + + socket.shutdownOutput(); + + assertTrue(__serverWebSocket.awaitDisconnected(500)); + + assertEquals(0x88,input.read()); + assertEquals(0x00,input.read()); + assertEquals(-1,input.read()); + + // look for broken pipe + try + { + for (int i=0;i<1000;i++) + output.write(0); + Assert.fail(); + } + catch(SocketException e) + { + // expected + } + } + + @Test public void testParserAndGenerator() throws Exception From 371e998b6232174489c42029b75f90f3cb1d0ef5 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 23 Dec 2011 11:51:14 +0100 Subject: [PATCH 15/92] 367485 - HttpExchange canceled before response do not release connection. --- .../jetty/client/AbstractHttpConnection.java | 8 +++- .../AbstractHttpExchangeCancelTest.java | 39 +++++++++++++------ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java index 00571cad0b0..a032b38b17b 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java @@ -179,7 +179,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen _generator.setVersion(_exchange.getVersion()); String method=_exchange.getMethod(); - String uri = _exchange.getURI(); + String uri = _exchange.getRequestURI(); if (_destination.isProxied() && !HttpMethods.CONNECT.equals(method) && uri.startsWith("/")) { boolean secure = _destination.isSecure(); @@ -394,7 +394,11 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen } } - _endp.close(); + if (_endp.isOpen()) + { + _endp.close(); + _destination.returnConnection(this, true); + } } public void setIdleTimeout() diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java index 923d6867664..c65525583d8 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java @@ -14,15 +14,8 @@ package org.eclipse.jetty.client; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - import java.io.IOException; import java.net.SocketTimeoutException; - import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; @@ -36,18 +29,22 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.StdErrLog; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + /** */ public abstract class AbstractHttpExchangeCancelTest { - private static final Logger LOG = Log.getLogger(AbstractHttpExchangeCancelTest.TestHttpExchange.class); - private Server server; private Connector connector; @@ -362,7 +359,7 @@ public abstract class AbstractHttpExchangeCancelTest int status = exchange.waitForDone(); long end = System.currentTimeMillis(); - + assertTrue(HttpExchange.STATUS_EXPIRED==status||HttpExchange.STATUS_EXCEPTED==status); assertFalse(exchange.isResponseCompleted()); assertTrue(end-start<4000); @@ -371,6 +368,26 @@ public abstract class AbstractHttpExchangeCancelTest assertFalse(exchange.isAssociated()); } + @Test + public void testHttpExchangeCancelReturnsConnection() throws Exception + { + TestHttpExchange exchange = new TestHttpExchange(); + Address address = newAddress(); + exchange.setAddress(address); + long delay = 5000; + exchange.setRequestURI("/?action=wait" + delay); + + HttpClient httpClient = getHttpClient(); + HttpDestination destination = httpClient.getDestination(address, false); + int connections = destination.getConnections(); + httpClient.send(exchange); + Thread.sleep(delay / 2); + Assert.assertEquals(connections + 1, destination.getConnections()); + + exchange.cancel(); + Assert.assertEquals(connections, destination.getConnections()); + } + /* ------------------------------------------------------------ */ protected abstract HttpClient getHttpClient(); From 62f47e0617ce677bac480a1a80b0c67f5cc5e9b2 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 23 Dec 2011 17:20:57 +0100 Subject: [PATCH 16/92] 367502 - WebSocket connections should be closed when application context is stopped. --- .../jetty/websocket/WebSocketConnection.java | 8 +- .../websocket/WebSocketConnectionD00.java | 7 +- .../websocket/WebSocketConnectionD06.java | 11 +- .../websocket/WebSocketConnectionD08.java | 7 + .../websocket/WebSocketConnectionRFC6455.java | 9 +- .../jetty/websocket/WebSocketFactory.java | 77 +++++++---- .../jetty/websocket/WebSocketServlet.java | 69 +++++++--- .../WebSocketServletConnectionD00.java | 14 +- .../WebSocketServletConnectionD06.java | 12 +- .../WebSocketServletConnectionD08.java | 16 ++- .../WebSocketServletConnectionRFC6455.java | 16 ++- .../websocket/WebSocketRedeployTest.java | 129 ++++++++++++++++++ 12 files changed, 302 insertions(+), 73 deletions(-) create mode 100644 jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java index 6ff89910629..67bfb37e651 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java @@ -24,8 +24,10 @@ import org.eclipse.jetty.io.nio.AsyncConnection; public interface WebSocketConnection extends AsyncConnection { void fillBuffersFrom(Buffer buffer); - + List getExtensions(); - + WebSocket.Connection getConnection(); -} \ No newline at end of file + + void shutdown(); +} diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java index b634bba1f92..12ec1101444 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java @@ -293,6 +293,11 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc } } + public void shutdown() + { + close(); + } + /* ------------------------------------------------------------ */ public void fillBuffersFrom(Buffer buffer) { @@ -389,7 +394,7 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc { return _protocol; } - + protected void onFrameHandshake() { if (_websocket instanceof OnFrame) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD06.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD06.java index f9e699fa570..c7c5f2b0a76 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD06.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD06.java @@ -274,6 +274,13 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc } } + public void shutdown() + { + final WebSocket.Connection connection = _connection; + if (connection != null) + connection.close(CLOSE_SHUTDOWN, null); + } + /* ------------------------------------------------------------ */ public void fillBuffersFrom(Buffer buffer) { @@ -294,7 +301,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc { return Collections.emptyList(); } - + protected void onFrameHandshake() { if (_onFrame!=null) @@ -302,7 +309,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc _onFrame.onHandshake(_connection); } } - + protected void onWebSocketOpen() { _webSocket.onOpen(_connection); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD08.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD08.java index dc342ab4e61..9b282d6f6da 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD08.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD08.java @@ -370,6 +370,13 @@ public class WebSocketConnectionD08 extends AbstractConnection implements WebSoc } } + public void shutdown() + { + final WebSocket.Connection connection = _connection; + if (connection != null) + connection.close(CLOSE_SHUTDOWN, null); + } + /* ------------------------------------------------------------ */ public void fillBuffersFrom(Buffer buffer) { diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java index 47c45a5922b..7f693751be0 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java @@ -400,6 +400,13 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We } } + public void shutdown() + { + final WebSocket.Connection connection = _connection; + if (connection != null) + connection.close(CLOSE_SHUTDOWN, null); + } + /* ------------------------------------------------------------ */ public void fillBuffersFrom(Buffer buffer) { @@ -431,7 +438,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We /* ------------------------------------------------------------ */ private class WSFrameConnection implements WebSocket.FrameConnection { - volatile boolean _disconnecting; + private volatile boolean _disconnecting; /* ------------------------------------------------------------ */ public void sendMessage(String content) throws IOException diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java index 25f58c1ef06..fcd74a43fcf 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java @@ -30,12 +30,12 @@ package org.eclipse.jetty.websocket; import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; - +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -45,15 +45,17 @@ import org.eclipse.jetty.io.ConnectedEndPoint; import org.eclipse.jetty.server.AbstractHttpConnection; import org.eclipse.jetty.server.BlockingHttpConnection; import org.eclipse.jetty.util.QuotedStringTokenizer; +import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; /** * Factory to create WebSocket connections */ -public class WebSocketFactory +public class WebSocketFactory extends AbstractLifeCycle { private static final Logger LOG = Log.getLogger(WebSocketFactory.class); + private final Queue connections = new ConcurrentLinkedQueue(); public interface Acceptor { @@ -87,21 +89,15 @@ public class WebSocketFactory private final Acceptor _acceptor; private WebSocketBuffers _buffers; private int _maxIdleTime = 300000; - private int _maxTextMessageSize = 16*1024; + private int _maxTextMessageSize = 16 * 1024; private int _maxBinaryMessageSize = -1; - public WebSocketFactory(Acceptor acceptor) - { - this(acceptor, 64 * 1024); - } - public WebSocketFactory(Acceptor acceptor, int bufferSize) { _buffers = new WebSocketBuffers(bufferSize); _acceptor = acceptor; } - /** * @return A modifiable map of extension name to extension class */ @@ -187,6 +183,12 @@ public class WebSocketFactory _maxBinaryMessageSize = maxBinaryMessageSize; } + @Override + protected void doStop() throws Exception + { + closeConnections(); + } + /** * Upgrade the request/response to a WebSocket Connection. *

This method will not normally return, but will instead throw a @@ -230,44 +232,53 @@ public class WebSocketFactory } final WebSocketServletConnection connection; - final List extensions; switch (draft) { case -1: // unspecified draft/version case 0: // Old school draft/version - extensions=Collections.emptyList(); - connection = new WebSocketServletConnectionD00(websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol); + { + connection = new WebSocketServletConnectionD00(this, websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol); break; + } case 1: case 2: case 3: case 4: case 5: case 6: - extensions=Collections.emptyList(); - connection = new WebSocketServletConnectionD06(websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol); + { + connection = new WebSocketServletConnectionD06(this, websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol); break; + } case 7: case 8: - extensions= initExtensions(extensions_requested,8-WebSocketConnectionD08.OP_EXT_DATA, 16-WebSocketConnectionD08.OP_EXT_CTRL,3); - connection = new WebSocketServletConnectionD08(websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol,extensions,draft); + { + List extensions = initExtensions(extensions_requested, 8 - WebSocketConnectionD08.OP_EXT_DATA, 16 - WebSocketConnectionD08.OP_EXT_CTRL, 3); + connection = new WebSocketServletConnectionD08(this, websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol, extensions, draft); break; + } case WebSocketConnectionRFC6455.VERSION: // RFC 6455 Version - extensions= initExtensions(extensions_requested,8-WebSocketConnectionRFC6455.OP_EXT_DATA, 16-WebSocketConnectionRFC6455.OP_EXT_CTRL,3); - connection = new WebSocketServletConnectionRFC6455(websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol,extensions,draft); + { + List extensions = initExtensions(extensions_requested, 8 - WebSocketConnectionRFC6455.OP_EXT_DATA, 16 - WebSocketConnectionRFC6455.OP_EXT_CTRL, 3); + connection = new WebSocketServletConnectionRFC6455(this, websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol, extensions, draft); break; + } default: - LOG.warn("Unsupported Websocket version: "+draft); + { + LOG.warn("Unsupported Websocket version: " + draft); // Per RFC 6455 - 4.4 - Supporting Multiple Versions of WebSocket Protocol // Using the examples as outlined - response.setHeader("Sec-WebSocket-Version","13, 8, 6, 0"); + response.setHeader("Sec-WebSocket-Version", "13, 8, 6, 0"); throw new HttpException(400, "Unsupported websocket version specification: " + draft); + } } // Set the defaults connection.getConnection().setMaxBinaryMessageSize(_maxBinaryMessageSize); connection.getConnection().setMaxTextMessageSize(_maxTextMessageSize); + addConnection(connection); + // Let the connection finish processing the handshake connection.handshake(request, response, protocol); response.flushBuffer(); @@ -281,8 +292,6 @@ public class WebSocketFactory request.setAttribute("org.eclipse.jetty.io.Connection", connection); } - /** - */ protected String[] parseProtocols(String protocol) { if (protocol == null) @@ -296,8 +305,6 @@ public class WebSocketFactory return protocols; } - /** - */ public boolean acceptWebSocket(HttpServletRequest request, HttpServletResponse response) throws IOException { @@ -353,8 +360,6 @@ public class WebSocketFactory return false; } - /** - */ public List initExtensions(List requested,int maxDataOpcodes,int maxControlOpcodes,int maxReservedBits) { List extensions = new ArrayList(); @@ -386,8 +391,6 @@ public class WebSocketFactory return extensions; } - /** - */ private Extension newExtension(String name) { try @@ -403,4 +406,20 @@ public class WebSocketFactory return null; } + + protected boolean addConnection(WebSocketServletConnection connection) + { + return isRunning() && connections.add(connection); + } + + protected boolean removeConnection(WebSocketServletConnection connection) + { + return connections.remove(connection); + } + + protected void closeConnections() + { + for (WebSocketServletConnection connection : connections) + connection.shutdown(); + } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServlet.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServlet.java index ce9edc5c8e7..1e765263e62 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServlet.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServlet.java @@ -34,31 +34,33 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ /** * Servlet to upgrade connections to WebSocket - *

+ *

* The request must have the correct upgrade headers, else it is * handled as a normal servlet request. - *

+ *

* The initParameter "bufferSize" can be used to set the buffer size, * which is also the max frame byte size (default 8192). - *

+ *

* The initParameter "maxIdleTime" can be used to set the time in ms * that a websocket may be idle before closing. - *

+ *

* The initParameter "maxTextMessagesSize" can be used to set the size in characters * that a websocket may be accept before closing. - *

+ *

* The initParameter "maxBinaryMessagesSize" can be used to set the size in bytes * that a websocket may be accept before closing. - * */ @SuppressWarnings("serial") public abstract class WebSocketServlet extends HttpServlet implements WebSocketFactory.Acceptor { - WebSocketFactory _webSocketFactory; + private final Logger LOG = Log.getLogger(getClass()); + private WebSocketFactory _webSocketFactory; /* ------------------------------------------------------------ */ /** @@ -67,20 +69,32 @@ public abstract class WebSocketServlet extends HttpServlet implements WebSocketF @Override public void init() throws ServletException { - String bs=getInitParameter("bufferSize"); - _webSocketFactory = new WebSocketFactory(this,bs==null?8192:Integer.parseInt(bs)); - String max=getInitParameter("maxIdleTime"); - if (max!=null) - _webSocketFactory.setMaxIdleTime(Integer.parseInt(max)); + try + { + String bs = getInitParameter("bufferSize"); + _webSocketFactory = new WebSocketFactory(this, bs == null ? 8192 : Integer.parseInt(bs)); + _webSocketFactory.start(); - max=getInitParameter("maxTextMessageSize"); - if (max!=null) - _webSocketFactory.setMaxTextMessageSize(Integer.parseInt(max)); + String max = getInitParameter("maxIdleTime"); + if (max != null) + _webSocketFactory.setMaxIdleTime(Integer.parseInt(max)); - max=getInitParameter("maxBinaryMessageSize"); - if (max!=null) - _webSocketFactory.setMaxBinaryMessageSize(Integer.parseInt(max)); + max = getInitParameter("maxTextMessageSize"); + if (max != null) + _webSocketFactory.setMaxTextMessageSize(Integer.parseInt(max)); + max = getInitParameter("maxBinaryMessageSize"); + if (max != null) + _webSocketFactory.setMaxBinaryMessageSize(Integer.parseInt(max)); + } + catch (ServletException x) + { + throw x; + } + catch (Exception x) + { + throw new ServletException(x); + } } /* ------------------------------------------------------------ */ @@ -90,9 +104,9 @@ public abstract class WebSocketServlet extends HttpServlet implements WebSocketF @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - if (_webSocketFactory.acceptWebSocket(request,response) || response.isCommitted()) + if (_webSocketFactory.acceptWebSocket(request, response) || response.isCommitted()) return; - super.service(request,response); + super.service(request, response); } /* ------------------------------------------------------------ */ @@ -101,6 +115,17 @@ public abstract class WebSocketServlet extends HttpServlet implements WebSocketF return true; } - - + /* ------------------------------------------------------------ */ + @Override + public void destroy() + { + try + { + _webSocketFactory.stop(); + } + catch (Exception x) + { + LOG.ignore(x); + } + } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD00.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD00.java index aa2a65f745e..72632beddbb 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD00.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD00.java @@ -25,10 +25,13 @@ import org.eclipse.jetty.util.QuotedStringTokenizer; public class WebSocketServletConnectionD00 extends WebSocketConnectionD00 implements WebSocketServletConnection { - public WebSocketServletConnectionD00(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol) + private final WebSocketFactory factory; + + public WebSocketServletConnectionD00(WebSocketFactory factory, WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol) throws IOException { super(websocket,endpoint,buffers,timestamp,maxIdleTime,protocol); + this.factory = factory; } public void handshake(HttpServletRequest request, HttpServletResponse response, String subprotocol) throws IOException @@ -70,7 +73,7 @@ public class WebSocketServletConnectionD00 extends WebSocketConnectionD00 implem { response.addHeader("Sec-WebSocket-Protocol",subprotocol); } - response.sendError(101,"WebSocket Protocol Handshake"); + response.sendError(101, "WebSocket Protocol Handshake"); } else { @@ -89,4 +92,11 @@ public class WebSocketServletConnectionD00 extends WebSocketConnectionD00 implem onWebsocketOpen(); } } + + @Override + public void onClose() + { + super.onClose(); + factory.removeConnection(this); + } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD06.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD06.java index 741abe69672..d75e153f414 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD06.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD06.java @@ -23,10 +23,13 @@ import org.eclipse.jetty.io.EndPoint; public class WebSocketServletConnectionD06 extends WebSocketConnectionD06 implements WebSocketServletConnection { - public WebSocketServletConnectionD06(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol) + private final WebSocketFactory factory; + + public WebSocketServletConnectionD06(WebSocketFactory factory, WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol) throws IOException { super(websocket,endpoint,buffers,timestamp,maxIdleTime,protocol); + this.factory = factory; } /* ------------------------------------------------------------ */ @@ -47,4 +50,11 @@ public class WebSocketServletConnectionD06 extends WebSocketConnectionD06 implem onFrameHandshake(); onWebSocketOpen(); } + + @Override + public void onClose() + { + super.onClose(); + factory.removeConnection(this); + } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD08.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD08.java index ba2f97eb6a3..daa54334c33 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD08.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionD08.java @@ -24,16 +24,13 @@ import org.eclipse.jetty.io.EndPoint; public class WebSocketServletConnectionD08 extends WebSocketConnectionD08 implements WebSocketServletConnection { - public WebSocketServletConnectionD08(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, - List extensions, int draft, MaskGen maskgen) throws IOException - { - super(websocket,endpoint,buffers,timestamp,maxIdleTime,protocol,extensions,draft,maskgen); - } + private final WebSocketFactory factory; - public WebSocketServletConnectionD08(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, + public WebSocketServletConnectionD08(WebSocketFactory factory, WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, List extensions, int draft) throws IOException { super(websocket,endpoint,buffers,timestamp,maxIdleTime,protocol,extensions,draft); + this.factory = factory; } /* ------------------------------------------------------------ */ @@ -59,4 +56,11 @@ public class WebSocketServletConnectionD08 extends WebSocketConnectionD08 implem onFrameHandshake(); onWebSocketOpen(); } + + @Override + public void onClose() + { + super.onClose(); + factory.removeConnection(this); + } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionRFC6455.java index c93b41c2679..b6e44fcbec0 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServletConnectionRFC6455.java @@ -24,16 +24,13 @@ import org.eclipse.jetty.io.EndPoint; public class WebSocketServletConnectionRFC6455 extends WebSocketConnectionRFC6455 implements WebSocketServletConnection { - public WebSocketServletConnectionRFC6455(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, - List extensions, int draft, MaskGen maskgen) throws IOException - { - super(websocket,endpoint,buffers,timestamp,maxIdleTime,protocol,extensions,draft,maskgen); - } + private final WebSocketFactory factory; - public WebSocketServletConnectionRFC6455(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, + public WebSocketServletConnectionRFC6455(WebSocketFactory factory, WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, List extensions, int draft) throws IOException { super(websocket,endpoint,buffers,timestamp,maxIdleTime,protocol,extensions,draft); + this.factory = factory; } /* ------------------------------------------------------------ */ @@ -59,4 +56,11 @@ public class WebSocketServletConnectionRFC6455 extends WebSocketConnectionRFC645 onFrameHandshake(); onWebSocketOpen(); } + + @Override + public void onClose() + { + super.onClose(); + factory.removeConnection(this); + } } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java new file mode 100644 index 00000000000..b3a856de44d --- /dev/null +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2011 Intalio, Inc. + * ====================================================================== + * 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.websocket; + +import java.net.URI; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.servlet.http.HttpServletRequest; + +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.HandlerCollection; +import org.eclipse.jetty.server.nio.SelectChannelConnector; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; + +public class WebSocketRedeployTest +{ + private Server server; + private ServletContextHandler context; + private String uri; + private WebSocketClientFactory wsFactory; + + public void init(final WebSocket webSocket) throws Exception + { + server = new Server(); + SelectChannelConnector connector = new SelectChannelConnector(); + connector.setPort(8080); + server.addConnector(connector); + + HandlerCollection handlers = new HandlerCollection(); + server.setHandler(handlers); + + String contextPath = "/test_context"; + context = new ServletContextHandler(handlers, contextPath, ServletContextHandler.SESSIONS); + + WebSocketServlet servlet = new WebSocketServlet() + { + public WebSocket doWebSocketConnect(HttpServletRequest request, String protocol) + { + return webSocket; + } + }; + String servletPath = "/websocket"; + context.addServlet(new ServletHolder(servlet), servletPath); + + server.start(); + + uri = "ws://localhost:" + connector.getLocalPort() + contextPath + servletPath; + + wsFactory = new WebSocketClientFactory(); + wsFactory.start(); + } + + @After + public void destroy() throws Exception + { + if (wsFactory != null) + wsFactory.stop(); + if (server != null) + { + server.stop(); + server.join(); + } + } + + @Test + public void testStoppingContextClosesConnections() throws Exception + { + final CountDownLatch openLatch = new CountDownLatch(2); + final CountDownLatch closeLatch = new CountDownLatch(2); + init(new WebSocket.OnTextMessage() + { + public void onOpen(Connection connection) + { + openLatch.countDown(); + } + + public void onMessage(String data) + { + } + + public void onClose(int closeCode, String message) + { + closeLatch.countDown(); + } + }); + + WebSocketClient client = wsFactory.newWebSocketClient(); + client.open(new URI(uri), new WebSocket.OnTextMessage() + { + public void onOpen(Connection connection) + { + openLatch.countDown(); + } + + public void onMessage(String data) + { + } + + public void onClose(int closeCode, String message) + { + closeLatch.countDown(); + } + }, 5, TimeUnit.SECONDS); + + Assert.assertTrue(openLatch.await(5, TimeUnit.SECONDS)); + + context.stop(); + + Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS)); + } +} From 3cda41248e85b59735a9a2231cbe8495efbe8f73 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 23 Dec 2011 23:43:02 +0100 Subject: [PATCH 17/92] 367502 - WebSocket connections should be closed when application context is stopped. --- .../jetty/websocket/WebSocketClient.java | 42 ++++------ .../websocket/WebSocketClientFactory.java | 76 +++++++++++++++---- .../jetty/websocket/WebSocketFactory.java | 4 +- .../websocket/WebSocketRedeployTest.java | 47 ++++++++++++ 4 files changed, 126 insertions(+), 43 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java index cc5db438838..743bdc38b64 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java @@ -348,8 +348,8 @@ public class WebSocketClient return holder; } - - public static final InetSocketAddress toSocketAddress(URI uri) + + public static InetSocketAddress toSocketAddress(URI uri) { String scheme = uri.getScheme(); if (!("ws".equalsIgnoreCase(scheme) || "wss".equalsIgnoreCase(scheme))) @@ -360,8 +360,7 @@ public class WebSocketClient if (port < 0) port = "ws".equals(scheme) ? 80 : 443; - InetSocketAddress address = new InetSocketAddress(uri.getHost(), port); - return address; + return new InetSocketAddress(uri.getHost(), port); } /* ------------------------------------------------------------ */ @@ -371,16 +370,8 @@ public class WebSocketClient { final WebSocket _websocket; final URI _uri; - final String _protocol; - final String _origin; - final MaskGen _maskGen; - final int _maxIdleTime; - final int _maxTextMessageSize; - final int _maxBinaryMessageSize; - final Map _cookies; - final List _extensions; + final WebSocketClient _client; final CountDownLatch _done = new CountDownLatch(1); - ByteChannel _channel; WebSocketConnection _connection; Throwable _exception; @@ -389,14 +380,7 @@ public class WebSocketClient { _websocket=websocket; _uri=uri; - _protocol=client._protocol; - _origin=client._origin; - _maskGen=client._maskGen; - _maxIdleTime=client._maxIdleTime; - _maxTextMessageSize=client._maxTextMessageSize; - _maxBinaryMessageSize=client._maxBinaryMessageSize; - _cookies=client._cookies; - _extensions=client._extensions; + _client=client; _channel=channel; } @@ -404,8 +388,10 @@ public class WebSocketClient { try { - connection.getConnection().setMaxTextMessageSize(_maxTextMessageSize); - connection.getConnection().setMaxBinaryMessageSize(_maxBinaryMessageSize); + _client.getFactory().addConnection(connection); + + connection.getConnection().setMaxTextMessageSize(_client.getMaxTextMessageSize()); + connection.getConnection().setMaxBinaryMessageSize(_client.getMaxBinaryMessageSize()); WebSocketConnection con; synchronized (this) @@ -460,12 +446,12 @@ public class WebSocketClient public Map getCookies() { - return _cookies; + return _client.getCookies(); } public String getProtocol() { - return _protocol; + return _client.getProtocol(); } public WebSocket getWebSocket() @@ -480,17 +466,17 @@ public class WebSocketClient public int getMaxIdleTime() { - return _maxIdleTime; + return _client.getMaxIdleTime(); } public String getOrigin() { - return _origin; + return _client.getOrigin(); } public MaskGen getMaskGen() { - return _maskGen; + return _client.getMaskGen(); } @Override diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 35a1f39479c..4b250ab1b2d 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -20,8 +20,11 @@ import java.io.IOException; import java.net.ProtocolException; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; +import java.util.List; import java.util.Map; +import java.util.Queue; import java.util.Random; +import java.util.concurrent.ConcurrentLinkedQueue; import javax.net.ssl.SSLEngine; import org.eclipse.jetty.http.HttpFields; @@ -33,6 +36,7 @@ import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ConnectedEndPoint; import org.eclipse.jetty.io.Connection; +import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.SimpleBuffers; import org.eclipse.jetty.io.nio.AsyncConnection; import org.eclipse.jetty.io.nio.SelectChannelEndPoint; @@ -60,8 +64,8 @@ public class WebSocketClientFactory extends AggregateLifeCycle { private final static Logger __log = org.eclipse.jetty.util.log.Log.getLogger(WebSocketClientFactory.class.getName()); private final static ByteArrayBuffer __ACCEPT = new ByteArrayBuffer.CaseInsensitive("Sec-WebSocket-Accept"); - - private SslContextFactory _sslContextFactory = new SslContextFactory(); + private final Queue connections = new ConcurrentLinkedQueue(); + private final SslContextFactory _sslContextFactory = new SslContextFactory(); private final ThreadPool _threadPool; private final WebSocketClientSelector _selector; private MaskGen _maskGen; @@ -200,6 +204,12 @@ public class WebSocketClientFactory extends AggregateLifeCycle return _buffers.getBufferSize(); } + @Override + protected void doStop() throws Exception + { + closeConnections(); + } + /* ------------------------------------------------------------ */ /** *

Creates and returns a new instance of a {@link WebSocketClient}, configured with this @@ -231,6 +241,22 @@ public class WebSocketClientFactory extends AggregateLifeCycle return sslEngine; } + protected boolean addConnection(WebSocketConnection connection) + { + return isRunning() && connections.add(connection); + } + + protected boolean removeConnection(WebSocketConnection connection) + { + return connections.remove(connection); + } + + protected void closeConnections() + { + for (WebSocketConnection connection : connections) + connection.shutdown(); + } + /* ------------------------------------------------------------ */ /** * WebSocket Client Selector Manager @@ -457,18 +483,9 @@ public class WebSocketClientFactory extends AggregateLifeCycle } else { - Buffer header = _parser.getHeaderBuffer(); - MaskGen maskGen = _future.getMaskGen(); - WebSocketConnectionRFC6455 connection = - new WebSocketConnectionRFC6455(_future.getWebSocket(), - _endp, - _buffers, System.currentTimeMillis(), - _future.getMaxIdleTime(), - _future.getProtocol(), - null, - WebSocketConnectionRFC6455.VERSION, - maskGen); + WebSocketConnection connection = newWebSocketConnection(); + Buffer header = _parser.getHeaderBuffer(); if (header.hasContent()) connection.fillBuffersFrom(header); _buffers.returnBuffer(header); @@ -483,6 +500,21 @@ public class WebSocketClientFactory extends AggregateLifeCycle return this; } + private WebSocketConnection newWebSocketConnection() throws IOException + { + return new WebSocketClientConnection( + _future._client.getFactory(), + _future.getWebSocket(), + _endp, + _buffers, + System.currentTimeMillis(), + _future.getMaxIdleTime(), + _future.getProtocol(), + null, + WebSocketConnectionRFC6455.VERSION, + _future.getMaskGen()); + } + public void onInputShutdown() throws IOException { _endp.close(); @@ -506,4 +538,22 @@ public class WebSocketClientFactory extends AggregateLifeCycle _future.handshakeFailed(new EOFException()); } } + + private static class WebSocketClientConnection extends WebSocketConnectionRFC6455 + { + private final WebSocketClientFactory factory; + + public WebSocketClientConnection(WebSocketClientFactory factory, WebSocket webSocket, EndPoint endPoint, WebSocketBuffers buffers, long timeStamp, int maxIdleTime, String protocol, List extensions, int draftVersion, MaskGen maskGen) throws IOException + { + super(webSocket, endPoint, buffers, timeStamp, maxIdleTime, protocol, extensions, draftVersion, maskGen); + this.factory = factory; + } + + @Override + public void onClose() + { + super.onClose(); + factory.removeConnection(this); + } + } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java index fcd74a43fcf..9b76e07bfba 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java @@ -273,12 +273,12 @@ public class WebSocketFactory extends AbstractLifeCycle } } + addConnection(connection); + // Set the defaults connection.getConnection().setMaxBinaryMessageSize(_maxBinaryMessageSize); connection.getConnection().setMaxTextMessageSize(_maxTextMessageSize); - addConnection(connection); - // Let the connection finish processing the handshake connection.handshake(request, response, protocol); response.flushBuffer(); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java index b3a856de44d..7d5d91b29e5 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java @@ -126,4 +126,51 @@ public class WebSocketRedeployTest Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS)); } + + @Test + public void testStoppingClientFactoryClosesConnections() throws Exception + { + final CountDownLatch openLatch = new CountDownLatch(2); + final CountDownLatch closeLatch = new CountDownLatch(2); + init(new WebSocket.OnTextMessage() + { + public void onOpen(Connection connection) + { + openLatch.countDown(); + } + + public void onMessage(String data) + { + } + + public void onClose(int closeCode, String message) + { + closeLatch.countDown(); + } + }); + + WebSocketClient client = wsFactory.newWebSocketClient(); + client.open(new URI(uri), new WebSocket.OnTextMessage() + { + public void onOpen(Connection connection) + { + openLatch.countDown(); + } + + public void onMessage(String data) + { + } + + public void onClose(int closeCode, String message) + { + closeLatch.countDown(); + } + }, 5, TimeUnit.SECONDS); + + Assert.assertTrue(openLatch.await(5, TimeUnit.SECONDS)); + + wsFactory.stop(); + + Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS)); + } } From 9e6dcc1c11d96fdb21741c8f2734802d75052976 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 23 Dec 2011 23:54:55 +0100 Subject: [PATCH 18/92] Restored constructor that was removed, used in CometD. --- .../java/org/eclipse/jetty/websocket/WebSocketFactory.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java index 9b76e07bfba..28dd23f2962 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java @@ -92,6 +92,11 @@ public class WebSocketFactory extends AbstractLifeCycle private int _maxTextMessageSize = 16 * 1024; private int _maxBinaryMessageSize = -1; + public WebSocketFactory(Acceptor acceptor) + { + this(acceptor, 64 * 1024); + } + public WebSocketFactory(Acceptor acceptor, int bufferSize) { _buffers = new WebSocketBuffers(bufferSize); From 3a1aff9221ffc50f7f70dac24e3fbd88c1a0ac4a Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 23 Dec 2011 23:59:05 +0100 Subject: [PATCH 19/92] Using a random port for the tests. --- .../java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java index 7d5d91b29e5..39f218085d9 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketRedeployTest.java @@ -41,7 +41,7 @@ public class WebSocketRedeployTest { server = new Server(); SelectChannelConnector connector = new SelectChannelConnector(); - connector.setPort(8080); +// connector.setPort(8080); server.addConnector(connector); HandlerCollection handlers = new HandlerCollection(); From 4f8cff8ccd29efb891aa43b57f01852db86b0b76 Mon Sep 17 00:00:00 2001 From: hmalphettes Date: Tue, 27 Dec 2011 07:59:13 +0800 Subject: [PATCH 20/92] bug 367548 the nested package must not be imported twice in jetty-osgi-boot --- VERSION.txt | 1 + jetty-osgi/jetty-osgi-boot/META-INF/MANIFEST.MF | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index fccd9bdb518..95f45237a37 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,5 @@ jetty-8.1.0-SNAPSHOT + + 367548 jetty-osgi-boot must not import the nested package twice jetty-8.1.0.RC2 - 22 December 2011 + 359329 jetty-jaspi must exports its packages. jetty-plus must import diff --git a/jetty-osgi/jetty-osgi-boot/META-INF/MANIFEST.MF b/jetty-osgi/jetty-osgi-boot/META-INF/MANIFEST.MF index d586e1cc310..07532c1284c 100644 --- a/jetty-osgi/jetty-osgi-boot/META-INF/MANIFEST.MF +++ b/jetty-osgi/jetty-osgi-boot/META-INF/MANIFEST.MF @@ -14,7 +14,6 @@ Import-Package: javax.mail;version="1.4.0";resolution:=optional, javax.servlet.http;version="2.6", javax.transaction;version="1.1.0";resolution:=optional, javax.transaction.xa;version="1.1.0";resolution:=optional, - org.eclipse.jetty.nested;version="8.0.0";resolution:=optional, org.eclipse.jetty.annotations;version="8.0.0";resolution:=optional, org.eclipse.jetty.deploy;version="8.0.0", org.eclipse.jetty.deploy.providers;version="8.0.0", From b35b3ec668386edcfb5aa243b302a56b7caa72a8 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 28 Dec 2011 11:13:15 +1100 Subject: [PATCH 21/92] 367591 Added Env element to XmlConfiguration --- .../eclipse/jetty/xml/XmlConfiguration.java | 37 ++- .../org/eclipse/jetty/xml/configure_6_0.dtd | 20 +- .../org/eclipse/jetty/xml/configure_7_1.dtd | 265 ++++++++++++++++++ .../jetty/xml/XmlConfigurationTest.java | 2 + .../org/eclipse/jetty/xml/configure.xml | 1 + 5 files changed, 311 insertions(+), 14 deletions(-) create mode 100644 jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_7_1.dtd diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index 6da0355acf8..d5f4df3915c 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -110,20 +110,22 @@ public class XmlConfiguration __parser = new XmlParser(); try { - URL configURL = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_6_0.dtd",true); - __parser.redirectEntity("configure.dtd",configURL); - __parser.redirectEntity("configure_1_0.dtd",configURL); - __parser.redirectEntity("configure_1_1.dtd",configURL); - __parser.redirectEntity("configure_1_2.dtd",configURL); - __parser.redirectEntity("configure_1_3.dtd",configURL); - __parser.redirectEntity("configure_6_0.dtd",configURL); + URL config60 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_6_0.dtd",true); + URL config71 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_7_1.dtd",true); + __parser.redirectEntity("configure.dtd",config71); + __parser.redirectEntity("configure_1_0.dtd",config60); + __parser.redirectEntity("configure_1_1.dtd",config60); + __parser.redirectEntity("configure_1_2.dtd",config60); + __parser.redirectEntity("configure_1_3.dtd",config60); + __parser.redirectEntity("configure_6_0.dtd",config60); + __parser.redirectEntity("configure_7_1.dtd",config71); - __parser.redirectEntity("http://jetty.mortbay.org/configure.dtd",configURL); - __parser.redirectEntity("http://jetty.eclipse.org/configure.dtd",configURL); - __parser.redirectEntity("http://www.eclipse.org/jetty/configure.dtd",configURL); + __parser.redirectEntity("http://jetty.mortbay.org/configure.dtd",config71); + __parser.redirectEntity("http://jetty.eclipse.org/configure.dtd",config71); + __parser.redirectEntity("http://www.eclipse.org/jetty/configure.dtd",config71); - __parser.redirectEntity("-//Mort Bay Consulting//DTD Configure//EN",configURL); - __parser.redirectEntity("-//Jetty//Configure//EN",configURL); + __parser.redirectEntity("-//Mort Bay Consulting//DTD Configure//EN",config71); + __parser.redirectEntity("-//Jetty//Configure//EN",config71); } catch (ClassNotFoundException e) { @@ -902,7 +904,7 @@ public class XmlConfiguration /* ------------------------------------------------------------ */ /* - * Create a new value object. + * Get a Property. * * @param obj @param node @return @exception Exception */ @@ -922,6 +924,7 @@ public class XmlConfiguration configure(prop,node,0); return prop; } + /* ------------------------------------------------------------ */ /* @@ -1091,6 +1094,14 @@ public class XmlConfiguration String defaultValue = node.getAttribute("default"); return System.getProperty(name,defaultValue); } + + if ("Env".equals(tag)) + { + String name = node.getAttribute("name"); + String defaultValue = node.getAttribute("default"); + String value=System.getenv(name); + return value==null?defaultValue:value; + } LOG.warn("Unknown value tag: " + node,new Throwable()); return null; diff --git a/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_6_0.dtd b/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_6_0.dtd index f79d4b7f003..e2139c162ed 100644 --- a/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_6_0.dtd +++ b/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_6_0.dtd @@ -19,7 +19,7 @@ my be specified if a match is not achieved. --> - + @@ -245,6 +245,24 @@ This is equivalent to: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java index 6608b1639c8..700d7508805 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java @@ -63,6 +63,8 @@ public class XmlConfigurationTest assertEquals( "ObjectsWhiteString", "-1\n String",tc.get("ObjectsWhiteString")); assertEquals( "SystemProperty", System.getProperty("user.dir")+"/stuff",tc.get("SystemProperty")); + assertEquals( "Env", System.getenv("HOME"),tc.get("Env")); + assertEquals( "Property", "xxx", tc.get("Property")); diff --git a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configure.xml b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configure.xml index ec26b3ea944..fd0316bff67 100644 --- a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configure.xml +++ b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configure.xml @@ -81,6 +81,7 @@ True 2.3 + From ed5059bddc3587c75de992914271ae60f866fa1c Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 28 Dec 2011 11:22:08 +1100 Subject: [PATCH 22/92] 367591 corrected configuration.xml version to 7.6 --- .../eclipse/jetty/xml/{configure_7_1.dtd => configure_7_6.dtd} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jetty-xml/src/main/resources/org/eclipse/jetty/xml/{configure_7_1.dtd => configure_7_6.dtd} (100%) diff --git a/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_7_1.dtd b/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_7_6.dtd similarity index 100% rename from jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_7_1.dtd rename to jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_7_6.dtd From 2b54d452801f262b792fe05be530972ad3d0de15 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 28 Dec 2011 13:35:44 +1100 Subject: [PATCH 23/92] 367435 improved D00 test harness --- .../websocket/WebSocketMessageD00Test.java | 598 +++++++++++++++++- 1 file changed, 570 insertions(+), 28 deletions(-) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD00Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD00Test.java index 0bcd6ce4b7b..fd2c02cbf2e 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD00Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD00Test.java @@ -25,57 +25,80 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.Socket; +import java.net.SocketException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; import javax.servlet.http.HttpServletRequest; +import junit.framework.Assert; + import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.util.Utf8StringBuilder; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.StdErrLog; import org.junit.AfterClass; +import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; public class WebSocketMessageD00Test { - private static Server _server; - private static Connector _connector; - private static TestWebSocket _serverWebSocket; + private static Server __server; + private static Connector __connector; + private static TestWebSocket __serverWebSocket; + private static CountDownLatch __latch; + private static AtomicInteger __textCount = new AtomicInteger(0); + @BeforeClass public static void startServer() throws Exception { - _server = new Server(); - _connector = new SelectChannelConnector(); - _server.addConnector(_connector); + __server = new Server(); + __connector = new SelectChannelConnector(); + __server.addConnector(__connector); WebSocketHandler wsHandler = new WebSocketHandler() { public WebSocket doWebSocketConnect(HttpServletRequest request, String protocol) { - _serverWebSocket = new TestWebSocket(); - _serverWebSocket.onConnect=("onConnect".equals(protocol)); - return _serverWebSocket; + __serverWebSocket = new TestWebSocket(); + __serverWebSocket._onConnect=("onConnect".equals(protocol)); + __serverWebSocket._echo=("echo".equals(protocol)); + __serverWebSocket._latch=("latch".equals(protocol)); + if (__serverWebSocket._latch) + __latch=new CountDownLatch(1); + return __serverWebSocket; } }; wsHandler.setHandler(new DefaultHandler()); - _server.setHandler(wsHandler); - _server.start(); + __server.setHandler(wsHandler); + __server.start(); } @AfterClass public static void stopServer() throws Exception { - _server.stop(); - _server.join(); + __server.stop(); + __server.join(); } + @Before + public void reset() + { + __textCount.set(0); + } + @Test public void testServerSendBigStringMessage() throws Exception { - Socket socket = new Socket("localhost", _connector.getLocalPort()); + Socket socket = new Socket("localhost", __connector.getLocalPort()); OutputStream output = socket.getOutputStream(); output.write( ("GET /test HTTP/1.1\r\n" + @@ -94,7 +117,6 @@ public class WebSocketMessageD00Test InputStream input = socket.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(input, "ISO-8859-1")); String responseLine = reader.readLine(); - System.err.println(responseLine); assertTrue(responseLine.startsWith("HTTP/1.1 101 WebSocket Protocol Handshake")); // Read until we find an empty line, which signals the end of the http response String line; @@ -102,8 +124,8 @@ public class WebSocketMessageD00Test if (line.length() == 0) break; - assertTrue(_serverWebSocket.awaitConnected(1000)); - assertNotNull(_serverWebSocket.outbound); + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.outbound); // read the hixie bytes char[] hixie=new char[16]; // should be bytes, but we know this example is all ascii @@ -125,7 +147,7 @@ public class WebSocketMessageD00Test String text = "0123456789ABCDEF"; for (int i = 0; i < 64 * 1024 / text.length(); ++i) message.append(text); - _serverWebSocket.outbound.sendMessage(message.toString()); + __serverWebSocket.outbound.sendMessage(message.toString()); // Read until we get 0xFF ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -147,7 +169,7 @@ public class WebSocketMessageD00Test @Test public void testServerSendOnConnect() throws Exception { - Socket socket = new Socket("localhost", _connector.getLocalPort()); + Socket socket = new Socket("localhost", __connector.getLocalPort()); OutputStream output = socket.getOutputStream(); output.write( ("GET /test HTTP/1.1\r\n" + @@ -200,8 +222,8 @@ public class WebSocketMessageD00Test } - assertTrue(_serverWebSocket.awaitConnected(1000)); - assertNotNull(_serverWebSocket.outbound); + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.outbound); looking_for="8jKS'y:G*Co,Wxa-"; while(true) @@ -232,17 +254,498 @@ public class WebSocketMessageD00Test assertEquals(0xff,input.read()); } + - private static class TestWebSocket implements WebSocket + @Test + public void testServerEcho() throws Exception + { + // Log.getLogger("org.eclipse.jetty.websocket").setDebugEnabled(true); + + Socket socket = new Socket("localhost", __connector.getLocalPort()); + socket.setSoTimeout(1000); + OutputStream output = socket.getOutputStream(); + InputStream input = socket.getInputStream(); + output.write( + ("GET /test HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Upgrade: WebSocket\r\n" + + "Connection: Upgrade\r\n" + + "Sec-WebSocket-Protocol: echo\r\n" + + "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" + + "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" + + "\r\n"+ + "^n:ds[4U").getBytes("ISO-8859-1")); + output.flush(); + + lookFor("HTTP/1.1 101 WebSocket Protocol Handshake\r\n",input); + skipTo("\r\n\r\n",input); + lookFor("8jKS'y:G*Co,Wxa-",input); + + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.connection); + + + output.write(0x00); + byte[] bytes="this is an echo".getBytes(StringUtil.__ISO_8859_1); + for (int i=0;i>> "+i); + output.flush(); + + long now=System.currentTimeMillis(); + long duration=now-start; + start=now; + if (max2000); // was blocked + } + + @Test + public void testBlockedProducer() throws Exception + { + // Log.getLogger("org.eclipse.jetty.websocket").setDebugEnabled(true); + + final Socket socket = new Socket("localhost", __connector.getLocalPort()); + socket.setSoTimeout(60000); + OutputStream output = socket.getOutputStream(); + InputStream input = socket.getInputStream(); + output.write( + ("GET /test HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Upgrade: WebSocket\r\n" + + "Connection: Upgrade\r\n" + + "Sec-WebSocket-Protocol: latch\r\n" + + "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" + + "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" + + "\r\n"+ + "^n:ds[4U").getBytes("ISO-8859-1")); + output.flush(); + + lookFor("HTTP/1.1 101 WebSocket Protocol Handshake\r\n",input); + skipTo("\r\n\r\n",input); + lookFor("8jKS'y:G*Co,Wxa-",input); + + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.connection); + + + final int count = 100000; + + __serverWebSocket.connection.setMaxIdleTime(60000); + __latch.countDown(); + + // wait 2s and then consume messages + final AtomicLong totalB=new AtomicLong(); + new Thread() + { + @Override + public void run() + { + try + { + Thread.sleep(2000); + + byte[] recv = new byte[32*1024]; + + int len=0; + while (len>=0) + { + totalB.addAndGet(len); + len=socket.getInputStream().read(recv,0,recv.length); + Thread.sleep(10); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } + }.start(); + + + // Send enough messages to fill receive buffer + long max=0; + long start=System.currentTimeMillis(); + String mesg="How Now Brown Cow"; + for (int i=0;i1000); // was blocked + } + + + + @Test + public void testIdle() throws Exception + { + // Log.getLogger("org.eclipse.jetty.websocket").setDebugEnabled(true); + + final Socket socket = new Socket("localhost", __connector.getLocalPort()); + socket.setSoTimeout(10000); + OutputStream output = socket.getOutputStream(); + InputStream input = socket.getInputStream(); + output.write( + ("GET /test HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Upgrade: WebSocket\r\n" + + "Connection: Upgrade\r\n" + + "Sec-WebSocket-Protocol: onConnect\r\n" + + "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" + + "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" + + "\r\n"+ + "^n:ds[4U").getBytes("ISO-8859-1")); + output.flush(); + + lookFor("HTTP/1.1 101 WebSocket Protocol Handshake\r\n",input); + skipTo("\r\n\r\n",input); + lookFor("8jKS'y:G*Co,Wxa-",input); + + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.connection); + __serverWebSocket.connection.setMaxIdleTime(250); + assertEquals(0x00,input.read()); + lookFor("sent on connect",input); + assertEquals(0xff,input.read()); + + assertEquals(-1,input.read()); + socket.close(); + + assertTrue(__serverWebSocket.awaitDisconnected(100)); + } + + @Test + public void testIdleBadClient() throws Exception + { + // Log.getLogger("org.eclipse.jetty.websocket").setDebugEnabled(true); + + final Socket socket = new Socket("localhost", __connector.getLocalPort()); + socket.setSoTimeout(10000); + OutputStream output = socket.getOutputStream(); + InputStream input = socket.getInputStream(); + output.write( + ("GET /test HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Upgrade: WebSocket\r\n" + + "Connection: Upgrade\r\n" + + "Sec-WebSocket-Protocol: onConnect\r\n" + + "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" + + "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" + + "\r\n"+ + "^n:ds[4U").getBytes("ISO-8859-1")); + output.flush(); + + lookFor("HTTP/1.1 101 WebSocket Protocol Handshake\r\n",input); + skipTo("\r\n\r\n",input); + lookFor("8jKS'y:G*Co,Wxa-",input); + + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.connection); + __serverWebSocket.connection.setMaxIdleTime(250); + assertEquals(0x00,input.read()); + lookFor("sent on connect",input); + assertEquals(0xff,input.read()); + + assertEquals(-1,input.read()); + + assertTrue(__serverWebSocket.disconnected.getCount()>0); + assertTrue(__serverWebSocket.awaitDisconnected(1000)); + } + + @Test + public void testTCPClose() throws Exception + { + // Log.getLogger("org.eclipse.jetty.websocket").setDebugEnabled(true); + + final Socket socket = new Socket("localhost", __connector.getLocalPort()); + socket.setSoTimeout(10000); + OutputStream output = socket.getOutputStream(); + InputStream input = socket.getInputStream(); + output.write( + ("GET /test HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Upgrade: WebSocket\r\n" + + "Connection: Upgrade\r\n" + + "Sec-WebSocket-Protocol: onConnect\r\n" + + "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" + + "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" + + "\r\n"+ + "^n:ds[4U").getBytes("ISO-8859-1")); + output.flush(); + + lookFor("HTTP/1.1 101 WebSocket Protocol Handshake\r\n",input); + skipTo("\r\n\r\n",input); + lookFor("8jKS'y:G*Co,Wxa-",input); + + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.connection); + __serverWebSocket.connection.setMaxIdleTime(250); + assertEquals(0x00,input.read()); + lookFor("sent on connect",input); + assertEquals(0xff,input.read()); + + + + socket.close(); + + assertTrue(__serverWebSocket.awaitDisconnected(500)); + + try + { + __serverWebSocket.connection.sendMessage("Don't send"); + assertTrue(false); + } + catch(IOException e) + { + assertTrue(true); + } + } + + @Test + public void testTCPHalfClose() throws Exception + { + // Log.getLogger("org.eclipse.jetty.websocket").setDebugEnabled(true); + + final Socket socket = new Socket("localhost", __connector.getLocalPort()); + socket.setSoTimeout(10000); + OutputStream output = socket.getOutputStream(); + InputStream input = socket.getInputStream(); + output.write( + ("GET /test HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Upgrade: WebSocket\r\n" + + "Connection: Upgrade\r\n" + + "Sec-WebSocket-Protocol: onConnect\r\n" + + "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" + + "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" + + "\r\n"+ + "^n:ds[4U").getBytes("ISO-8859-1")); + output.flush(); + + lookFor("HTTP/1.1 101 WebSocket Protocol Handshake\r\n",input); + skipTo("\r\n\r\n",input); + lookFor("8jKS'y:G*Co,Wxa-",input); + + assertTrue(__serverWebSocket.awaitConnected(1000)); + assertNotNull(__serverWebSocket.connection); + __serverWebSocket.connection.setMaxIdleTime(250); + assertEquals(0x00,input.read()); + lookFor("sent on connect",input); + assertEquals(0xff,input.read()); + + + socket.shutdownOutput(); + + assertTrue(__serverWebSocket.awaitDisconnected(500)); + + assertEquals(-1,input.read()); + + // look for broken pipe + try + { + for (int i=0;i<1000;i++) + output.write(0); + Assert.fail(); + } + catch(SocketException e) + { + // expected + } + } + + + + + + + + + + + + + + private void lookFor(String string,InputStream in) + throws IOException + { + String orig=string; + Utf8StringBuilder scanned=new Utf8StringBuilder(); + try + { + while(true) + { + int b = in.read(); + if (b<0) + throw new EOFException(); + scanned.append((byte)b); + assertEquals("looking for\""+orig+"\" in '"+scanned+"'",(int)string.charAt(0),b); + if (string.length()==1) + break; + string=string.substring(1); + } + } + catch(IOException e) + { + System.err.println("IOE while looking for \""+orig+"\" in '"+scanned+"'"); + throw e; + } + } + + private void skipTo(String string,InputStream in) + throws IOException + { + int state=0; + + while(true) + { + int b = in.read(); + if (b<0) + throw new EOFException(); + + if (b==string.charAt(state)) + { + state++; + if (state==string.length()) + break; + } + else + state=0; + } + } + + + + private static class TestWebSocket implements WebSocket.OnFrame, WebSocket, WebSocket.OnTextMessage + { + protected boolean _latch; + boolean _echo=true; + boolean _onConnect=false; + private volatile Connection outbound; + private final CountDownLatch connected = new CountDownLatch(1); + private final CountDownLatch disconnected = new CountDownLatch(1); + private volatile FrameConnection connection; + + public FrameConnection getConnection() + { + return connection; + } + + public void onHandshake(FrameConnection connection) + { + this.connection = connection; + } + public void onOpen(Connection outbound) { this.outbound = outbound; - if (onConnect) + if (_onConnect) { try { @@ -253,16 +756,55 @@ public class WebSocketMessageD00Test e.printStackTrace(); } } - latch.countDown(); + connected.countDown(); } private boolean awaitConnected(long time) throws InterruptedException { - return latch.await(time, TimeUnit.MILLISECONDS); + return connected.await(time, TimeUnit.MILLISECONDS); + } + + private boolean awaitDisconnected(long time) throws InterruptedException + { + return disconnected.await(time, TimeUnit.MILLISECONDS); } public void onClose(int code,String message) { + disconnected.countDown(); + } + + public boolean onFrame(byte flags, byte opcode, byte[] data, int offset, int length) + { + return true; + } + + public void onMessage(String data) + { + __textCount.incrementAndGet(); + if (_latch) + { + try + { + __latch.await(); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + if (_echo) + { + try + { + outbound.sendMessage(data); + } + catch (IOException e) + { + e.printStackTrace(); + } + } } } } From 009f8176a189dba9f783a00217a0b1ffc44ff554 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 28 Dec 2011 23:09:33 +1100 Subject: [PATCH 24/92] JETTY-1467 close half closed when idle --- .../org/eclipse/jetty/embedded/LikeJettyXml.java | 8 ++++++++ .../jetty/server/BlockingHttpConnection.java | 7 +++++++ .../server/nio/BlockingChannelConnector.java | 16 ++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java index 899c682bc08..778c9b0b234 100644 --- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java +++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java @@ -29,6 +29,7 @@ import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.RequestLogHandler; import org.eclipse.jetty.server.handler.StatisticsHandler; +import org.eclipse.jetty.server.nio.BlockingChannelConnector; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; import org.eclipse.jetty.server.ssl.SslSocketConnector; @@ -68,6 +69,13 @@ public class LikeJettyXml server.setConnectors(new Connector[] { connector }); + + BlockingChannelConnector bConnector = new BlockingChannelConnector(); + bConnector.setPort(8888); + bConnector.setMaxIdleTime(30000); + bConnector.setConfidentialPort(8443); + bConnector.setAcceptors(1); + server.addConnector(bConnector); SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector(); ssl_connector.setPort(8443); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/BlockingHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/BlockingHttpConnection.java index ec15289f914..6b5c8284da4 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/BlockingHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/BlockingHttpConnection.java @@ -110,6 +110,13 @@ public class BlockingHttpConnection extends AbstractHttpConnection _endp.shutdownOutput(); } } + + // If we don't have a committed response and we are not suspended + if (_endp.isInputShutdown() && _generator.isIdle() && !_request.getAsyncContinuation().isSuspended()) + { + // then no more can happen, so close. + _endp.close(); + } } } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java index 98716285b71..8e331142e6a 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.nio.channels.ByteChannel; +import java.nio.channels.SelectionKey; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.Set; @@ -341,5 +342,20 @@ public class BlockingChannelConnector extends AbstractNIOConnector } } } + + /* ------------------------------------------------------------ */ + @Override + public String toString() + { + return String.format("BCEP@%x{l(%s)<->r(%s),open=%b,ishut=%b,oshut=%b}-{%s}", + hashCode(), + _socket.getRemoteSocketAddress(), + _socket.getLocalSocketAddress(), + isOpen(), + isInputShutdown(), + isOutputShutdown(), + _connection); + } + } } From f62c6edcb9592fac2b2e5c9b8fcb395719c25717 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 30 Dec 2011 09:43:20 +1100 Subject: [PATCH 25/92] 367635 Added support for start.d directory --- .../java/org/eclipse/jetty/start/Main.java | 630 +++++++++--------- .../org/eclipse/jetty/start/usage.txt | 9 +- .../org/eclipse/jetty/start/MainTest.java | 76 +++ .../resources/jetty.home/start.d/10-jmx.ini | 22 + .../jetty.home/start.d/20-websocket.ini | 13 + .../jetty.home/start.d/90-testrealm.ini | 1 + .../src/test/resources/jetty.home/start.ini | 65 ++ 7 files changed, 513 insertions(+), 303 deletions(-) create mode 100644 jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java create mode 100644 jetty-start/src/test/resources/jetty.home/start.d/10-jmx.ini create mode 100644 jetty-start/src/test/resources/jetty.home/start.d/20-websocket.ini create mode 100644 jetty-start/src/test/resources/jetty.home/start.d/90-testrealm.ini create mode 100644 jetty-start/src/test/resources/jetty.home/start.ini diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 4e2d6115f9c..c42b93d7106 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -20,6 +20,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; +import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -30,7 +31,6 @@ import java.lang.reflect.Method; import java.net.ConnectException; import java.net.InetAddress; import java.net.Socket; -import java.security.Policy; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -40,17 +40,15 @@ import java.util.List; import java.util.Properties; import java.util.Set; - /*-------------------------------------------*/ /** *

- * Main start class. This class is intended to be the main class listed in the MANIFEST.MF of the start.jar archive. It - * allows an application to be started with the command "java -jar start.jar". + * Main start class. This class is intended to be the main class listed in the MANIFEST.MF of the start.jar archive. It allows an application to be started with + * the command "java -jar start.jar". *

- * + * *

- * The behaviour of Main is controlled by the parsing of the {@link Config} "org/eclipse/start/start.config" file - * obtained as a resource or file. + * The behaviour of Main is controlled by the parsing of the {@link Config} "org/eclipse/start/start.config" file obtained as a resource or file. *

*/ public class Main @@ -67,257 +65,240 @@ public class Main private boolean _dryRun = false; private boolean _exec = false; private final Config _config = new Config(); - private Set _sysProps = new HashSet(); - private List _jvmArgs = new ArrayList(); + private final Set _sysProps = new HashSet(); + private final List _jvmArgs = new ArrayList(); private String _startConfig = null; private String _jettyHome; - public static void main(String[] args) - { - Main main = new Main(); - main.parseCommandLine(args); - } - - public void parseCommandLine(String[] args) + public static void main(String[] args) { try { - List arguments = new ArrayList(); - - // add the command line args and look for start.ini args - boolean ini=false; - for (String arg : args) - { - if (arg.startsWith("--ini=")||arg.equals("--ini")) - { - ini=true; - if (arg.length()>6) - { - arguments.addAll(loadStartIni(arg.substring(6))); - continue; - } - } - else if (arg.startsWith("--config=")) - { - _startConfig=arg.substring(9); - } - else - { - arguments.add(arg); - } - } - - // if no non-option inis, add the start.ini - if (!ini) - { - arguments.addAll(0,loadStartIni(null)); - } - - // The XML Configuration Files to initialize with - List xmls = new ArrayList(); - - // Process the arguments - int startup=0; - for (String arg : arguments) - { - if ("--help".equals(arg) || "-?".equals(arg)) - { - _showUsage = true; - continue; - } - - if ("--stop".equals(arg)) - { - int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1")); - String key = Config.getProperty("STOP.KEY",null); - stop(port,key); - return; - } - - if ("--version".equals(arg) || "-v".equals(arg) || "--info".equals(arg)) - { - _dumpVersions = true; - continue; - } - - if ("--list-modes".equals(arg) || "--list-options".equals(arg)) - { - _listOptions = true; - continue; - } - - if ("--list-config".equals(arg)) - { - _listConfig=true; - continue; - } - - if ("--exec-print".equals(arg)||"--dry-run".equals(arg)) - { - _dryRun = true; - continue; - } - - if ("--exec".equals(arg)) - { - _exec = true; - continue; - } - - // Special internal indicator that jetty was started by the jetty.sh Daemon - if ("--daemon".equals(arg)) - { - File startDir = new File(System.getProperty("jetty.logs","logs")); - if (!startDir.exists() || !startDir.canWrite() ) - startDir = new File("."); - File startLog = new File(startDir,"start.log"); - if (!startLog.exists() && !startLog.createNewFile()) - { - // Output about error is lost in majority of cases. - System.err.println("Unable to create: " + startLog.getAbsolutePath()); - // Toss a unique exit code indicating this failure. - usageExit(ERR_LOGGING); - } - - if (!startLog.canWrite()) - { - // Output about error is lost in majority of cases. - System.err.println("Unable to write to: " + startLog.getAbsolutePath()); - // Toss a unique exit code indicating this failure. - usageExit(ERR_LOGGING); - } - PrintStream logger = new PrintStream(new FileOutputStream(startLog,false)); - System.setOut(logger); - System.setErr(logger); - System.out.println("Establishing start.log on " + new Date()); - continue; - } - - if (arg.startsWith("--pre=")) - { - xmls.add(startup++,arg.substring(6)); - continue; - } - - if (arg.startsWith("-D")) - { - String[] assign = arg.substring(2).split("=",2); - _sysProps.add(assign[0]); - switch(assign.length) - { - case 2: - System.setProperty(assign[0],assign[1]); - break; - case 1: - System.setProperty(assign[0],""); - break; - default: - break; - } - continue; - } - - if (arg.startsWith("-")) - { - _jvmArgs.add(arg); - continue; - } - - // Is this a Property? - if (arg.indexOf('=') >= 0) - { - String[] assign = arg.split("=",2); - - switch(assign.length) - { - case 2: - if ("OPTIONS".equals(assign[0])) - { - String opts[] = assign[1].split(","); - for (String opt : opts) - _config.addActiveOption(opt); - } - else - { - this._config.setProperty(assign[0],assign[1]); - } - break; - case 1: - this._config.setProperty(assign[0],null); - break; - default: - break; - } - - continue; - } - - // Anything else is considered an XML file. - if (xmls.contains(arg)) - { - System.out.println("WARN: Argument '"+arg+"' specified multiple times. Check start.ini?"); - System.out.println("Use \"java -jar start.jar --help\" for more information."); - } - xmls.add(arg); - } - - start(xmls); + Main main = new Main(); + List arguments = main.expandCommandLine(args); + List xmls = main.processCommandLine(arguments); + if (xmls!=null) + main.start(xmls); } - catch (Throwable t) - { - usageExit(t,ERR_UNKNOWN); - } - } - - /** - * If a start.ini is present in the CWD, then load it into the argument list. - */ - private List loadStartIni(String ini) - { - String jettyHome=System.getProperty("jetty.home"); - File startIniFile = ini==null?((jettyHome!=null)? new File(jettyHome,"start.ini"):new File("start.ini")):new File(ini); - if (!startIniFile.exists()) - { - if (ini != null) - { - System.err.println("Warning - can't find ini file: " + ini); - } - // No start.ini found, skip load. - return Collections.emptyList(); - } - - List args = new ArrayList(); - - FileReader reader = null; - BufferedReader buf = null; - try - { - reader = new FileReader(startIniFile); - buf = new BufferedReader(reader); - - String arg; - while ((arg = buf.readLine()) != null) - { - arg = arg.trim(); - if (arg.length() == 0 || arg.startsWith("#")) - { - continue; - } - args.add(arg); - } - } - catch (IOException e) + catch (Throwable e) { usageExit(e,ERR_UNKNOWN); } - finally + } + + Main() throws IOException + { + _jettyHome = System.getProperty("jetty.home","."); + _jettyHome = new File(_jettyHome).getCanonicalPath(); + } + + public List expandCommandLine(String[] args) throws Exception + { + List arguments = new ArrayList(); + + // add the command line args and look for start.ini args + boolean ini = false; + for (String arg : args) { - close(buf); - close(reader); + if (arg.startsWith("--ini=") || arg.equals("--ini")) + { + ini = true; + if (arg.length() > 6) + { + arguments.addAll(loadStartIni(new File(arg.substring(6)))); + continue; + } + } + else if (arg.startsWith("--config=")) + { + _startConfig = arg.substring(9); + } + else + { + arguments.add(arg); + } } - return args; + // if no non-option inis, add the start.ini and start.d + if (!ini) + { + List ini_args=new ArrayList(); + File start_ini = new File(_jettyHome,"start.ini"); + if (start_ini.exists()) + ini_args.addAll(loadStartIni(start_ini)); + + File start_d = new File(_jettyHome,"start.d"); + if (start_d.isDirectory()) + { + File[] inis = start_d.listFiles(new FilenameFilter() + { + public boolean accept(File dir, String name) + { + return name.toLowerCase().endsWith(".ini"); + } + }); + Arrays.sort(inis); + for (File i : inis) + ini_args.addAll(loadStartIni(i)); + } + arguments.addAll(0,ini_args); + } + + return arguments; + } + + public List processCommandLine(List arguments) throws Exception + { + // The XML Configuration Files to initialize with + List xmls = new ArrayList(); + + // Process the arguments + int startup = 0; + for (String arg : arguments) + { + if ("--help".equals(arg) || "-?".equals(arg)) + { + _showUsage = true; + continue; + } + + if ("--stop".equals(arg)) + { + int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1")); + String key = Config.getProperty("STOP.KEY",null); + stop(port,key); + return null; + } + + if ("--version".equals(arg) || "-v".equals(arg) || "--info".equals(arg)) + { + _dumpVersions = true; + continue; + } + + if ("--list-modes".equals(arg) || "--list-options".equals(arg)) + { + _listOptions = true; + continue; + } + + if ("--list-config".equals(arg)) + { + _listConfig = true; + continue; + } + + if ("--exec-print".equals(arg) || "--dry-run".equals(arg)) + { + _dryRun = true; + continue; + } + + if ("--exec".equals(arg)) + { + _exec = true; + continue; + } + + // Special internal indicator that jetty was started by the jetty.sh Daemon + if ("--daemon".equals(arg)) + { + File startDir = new File(System.getProperty("jetty.logs","logs")); + if (!startDir.exists() || !startDir.canWrite()) + startDir = new File("."); + File startLog = new File(startDir,"start.log"); + if (!startLog.exists() && !startLog.createNewFile()) + { + // Output about error is lost in majority of cases. + System.err.println("Unable to create: " + startLog.getAbsolutePath()); + // Toss a unique exit code indicating this failure. + usageExit(ERR_LOGGING); + } + + if (!startLog.canWrite()) + { + // Output about error is lost in majority of cases. + System.err.println("Unable to write to: " + startLog.getAbsolutePath()); + // Toss a unique exit code indicating this failure. + usageExit(ERR_LOGGING); + } + PrintStream logger = new PrintStream(new FileOutputStream(startLog,false)); + System.setOut(logger); + System.setErr(logger); + System.out.println("Establishing start.log on " + new Date()); + continue; + } + + if (arg.startsWith("--pre=")) + { + xmls.add(startup++,arg.substring(6)); + continue; + } + + if (arg.startsWith("-D")) + { + String[] assign = arg.substring(2).split("=",2); + _sysProps.add(assign[0]); + switch (assign.length) + { + case 2: + System.setProperty(assign[0],assign[1]); + break; + case 1: + System.setProperty(assign[0],""); + break; + default: + break; + } + continue; + } + + if (arg.startsWith("-")) + { + _jvmArgs.add(arg); + continue; + } + + // Is this a Property? + if (arg.indexOf('=') >= 0) + { + String[] assign = arg.split("=",2); + + switch (assign.length) + { + case 2: + if ("OPTIONS".equals(assign[0])) + { + String opts[] = assign[1].split(","); + for (String opt : opts) + _config.addActiveOption(opt); + } + else + { + this._config.setProperty(assign[0],assign[1]); + } + break; + case 1: + this._config.setProperty(assign[0],null); + break; + default: + break; + } + + continue; + } + + // Anything else is considered an XML file. + if (xmls.contains(arg)) + { + System.out.println("WARN: Argument '" + arg + "' specified multiple times. Check start.ini?"); + System.out.println("Use \"java -jar start.jar --help\" for more information."); + } + xmls.add(arg); + } + + return xmls; } private void usage() @@ -339,10 +320,10 @@ public class Main while ((line = buf.readLine()) != null) { - if (line.endsWith("@") && line.indexOf('@')!=line.lastIndexOf('@')) + if (line.endsWith("@") && line.indexOf('@') != line.lastIndexOf('@')) { - String indent=line.substring(0,line.indexOf("@")); - String info=line.substring(line.indexOf('@'),line.lastIndexOf('@')); + String indent = line.substring(0,line.indexOf("@")); + String info = line.substring(line.indexOf('@'),line.lastIndexOf('@')); if (info.equals("@OPTIONS")) { @@ -352,7 +333,7 @@ public class Main for (String option : sortedOptions) { - if ("*".equals(option) || option.trim().length()==0) + if ("*".equals(option) || option.trim().length() == 0) continue; System.out.print(indent); System.out.println(option); @@ -396,7 +377,7 @@ public class Main else if (info.equals("@STARTINI")) { List ini = loadStartIni(null); - if (ini!=null && ini.size()>0) + if (ini != null && ini.size() > 0) { for (String a : ini) { @@ -429,7 +410,7 @@ public class Main } public void invokeMain(ClassLoader classloader, String classname, List args) throws IllegalAccessException, InvocationTargetException, - NoSuchMethodException, ClassNotFoundException + NoSuchMethodException, ClassNotFoundException { Class invoked_class = null; @@ -462,10 +443,12 @@ public class Main String argArray[] = args.toArray(new String[0]); - Class[] method_param_types = new Class[] { argArray.getClass() }; + Class[] method_param_types = new Class[] + { argArray.getClass() }; Method main = invoked_class.getDeclaredMethod("main",method_param_types); - Object[] method_params = new Object[] { argArray }; + Object[] method_params = new Object[] + { argArray }; main.invoke(null,method_params); } @@ -492,13 +475,12 @@ public class Main // Setup Start / Stop Monitoring int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1")); String key = Config.getProperty("STOP.KEY",null); - Monitor monitor=new Monitor(port,key); - + Monitor monitor = new Monitor(port,key); // Load potential Config (start.config) List configuredXmls = loadConfig(xmls); - // No XML defined in start.config or command line. Can't execute. + // No XML defined in start.config or command line. Can't execute. if (configuredXmls.isEmpty()) { throw new FileNotFoundException("No XML configuration files specified in start.config or command line."); @@ -523,7 +505,7 @@ public class Main System.err.println("classloader.parent=" + cl.getParent()); System.err.println("properties=" + Config.getProperties()); } - + // Show the usage information and return if (_showUsage) { @@ -544,7 +526,7 @@ public class Main showAllOptionsWithVersions(classpath); return; } - + if (_listConfig) { listConfig(); @@ -557,7 +539,7 @@ public class Main System.out.println(buildCommandLine(classpath,configuredXmls)); return; } - + // execute Jetty in another JVM if (_exec) { @@ -565,11 +547,12 @@ public class Main final Process process = Runtime.getRuntime().exec(cmd); Runtime.getRuntime().addShutdownHook(new Thread() { + @Override public void run() { Config.debug("Destroying " + process); process.destroy(); - } + } }); copyInThread(process.getErrorStream(),System.err); copyInThread(process.getInputStream(),System.out); @@ -578,7 +561,7 @@ public class Main process.waitFor(); return; } - + if (_jvmArgs.size() > 0 || _sysProps.size() > 0) { System.err.println("WARNING: System properties and/or JVM args set. Consider using --dry-run or --exec"); @@ -617,7 +600,7 @@ public class Main } } - private void copyInThread(final InputStream in,final OutputStream out) + private void copyInThread(final InputStream in, final OutputStream out) { new Thread(new Runnable() { @@ -625,23 +608,23 @@ public class Main { try { - byte[] buf=new byte[1024]; - int len=in.read(buf); - while(len>0) + byte[] buf = new byte[1024]; + int len = in.read(buf); + while (len > 0) { out.write(buf,0,len); - len=in.read(buf); + len = in.read(buf); } } - catch(IOException e) + catch (IOException e) { // e.printStackTrace(); } } - + }).start(); } - + private String resolveXmlConfig(String xmlFilename) throws FileNotFoundException { if (!xmlFilename.toLowerCase().endsWith(".xml")) @@ -675,22 +658,22 @@ public class Main { StringBuilder cmd = new StringBuilder(); cmd.append(findJavaBin()); - for (String x:_jvmArgs) + for (String x : _jvmArgs) cmd.append(' ').append(x); cmd.append(" -Djetty.home=").append(_jettyHome); - for (String p:_sysProps) + for (String p : _sysProps) { cmd.append(" -D").append(p); - String v=System.getProperty(p); - if (v!=null && v.length()>0) + String v = System.getProperty(p); + if (v != null && v.length() > 0) cmd.append('=').append(v); } cmd.append(" -cp ").append(classpath.toString()); cmd.append(" ").append(_config.getMainClassname()); - + // Check if we need to pass properties as a file Properties properties = Config.getProperties(); - if (properties.size()>0) + if (properties.size() > 0) { File prop_file = File.createTempFile("start",".properties"); if (!_dryRun) @@ -698,7 +681,7 @@ public class Main properties.store(new FileOutputStream(prop_file),"start.jar properties"); cmd.append(" ").append(prop_file.getAbsolutePath()); } - + for (String xml : xmls) { cmd.append(' ').append(xml); @@ -875,11 +858,10 @@ public class Main private String getZipVersion(File element) { - // TODO - find version in zip file. Look for META-INF/MANIFEST.MF ? + // TODO - find version in zip file. Look for META-INF/MANIFEST.MF ? return ""; } - private List resolveXmlConfigs(List xmls) throws FileNotFoundException { List ret = new ArrayList(); @@ -896,15 +878,15 @@ public class Main InputStream cfgstream = null; try { - cfgstream=getConfigStream(); - byte[] buf=new byte[4096]; - - int len=0; - - while (len>=0) + cfgstream = getConfigStream(); + byte[] buf = new byte[4096]; + + int len = 0; + + while (len >= 0) { - len=cfgstream.read(buf); - if (len>0) + len = cfgstream.read(buf); + if (len > 0) System.out.write(buf,0,len); } } @@ -917,13 +899,13 @@ public class Main close(cfgstream); } } - + /** * Load Configuration. - * - * No specific configuration is real until a {@link Config#getCombinedClasspath(java.util.Collection)} is used to - * execute the {@link Class} specified by {@link Config#getMainClassname()} is executed. - * + * + * No specific configuration is real until a {@link Config#getCombinedClasspath(java.util.Collection)} is used to execute the {@link Class} specified by + * {@link Config#getMainClassname()} is executed. + * * @param xmls * the command line specified xml configuration options. * @return the list of xml configurations arriving via command line and start.config choices. @@ -935,13 +917,13 @@ public class Main { // Pass in xmls.size into Config so that conditions based on "nargs" work. _config.setArgCount(xmls.size()); - - cfgstream=getConfigStream(); - + + cfgstream = getConfigStream(); + // parse the config _config.parse(cfgstream); - - _jettyHome = Config.getProperty("jetty.home"); + + _jettyHome = Config.getProperty("jetty.home",_jettyHome); if (_jettyHome != null) { _jettyHome = new File(_jettyHome).getCanonicalPath(); @@ -975,12 +957,12 @@ public class Main private InputStream getConfigStream() throws FileNotFoundException { - String config=_startConfig; + String config = _startConfig; if (config == null || config.length() == 0) { config = System.getProperty("START","org/eclipse/jetty/start/start.config"); } - + Config.debug("config=" + config); // Look up config as resource first. @@ -991,11 +973,10 @@ public class Main { cfgstream = new FileInputStream(config); } - + return cfgstream; } - /** * Stop a running jetty instance. */ @@ -1038,7 +1019,6 @@ public class Main usageExit(e,ERR_UNKNOWN); } } - static void usageExit(Throwable t, int exit) { @@ -1048,6 +1028,7 @@ public class Main System.err.println(" java -jar start.jar --help # for more information"); System.exit(exit); } + static void usageExit(int exit) { System.err.println(); @@ -1055,4 +1036,53 @@ public class Main System.err.println(" java -jar start.jar --help # for more information"); System.exit(exit); } + + /** + * Convert a start.ini format file into an argument list. + */ + static List loadStartIni(File ini) + { + File startIniFile = ini; + if (!startIniFile.exists()) + { + if (ini != null) + { + System.err.println("Warning - can't find ini file: " + ini); + } + // No start.ini found, skip load. + return Collections.emptyList(); + } + + List args = new ArrayList(); + + FileReader reader = null; + BufferedReader buf = null; + try + { + reader = new FileReader(ini); + buf = new BufferedReader(reader); + + String arg; + while ((arg = buf.readLine()) != null) + { + arg = arg.trim(); + if (arg.length() == 0 || arg.startsWith("#")) + { + continue; + } + args.add(arg); + } + } + catch (IOException e) + { + // usageExit(e,ERR_UNKNOWN); + } + finally + { + Main.close(buf); + Main.close(reader); + } + + return args; + } } diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt index 7371be3f997..c4c85c4523d 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt @@ -116,8 +116,11 @@ Available Configurations: Defaults: A start.ini file may be used to specify default arguments to start.jar, which are used if no command line arguments are provided and override - the defaults in the start.config file. If --ini options are provided on - the command line, then start.ini will no be read. The current start.ini - arguments are: + the defaults in the start.config file. If the directory start.d exists, + then multiple *.ini files will be read from that directory in alphabetical + order. If --ini options are provided on the command line, then start.ini + and start.d will not be read. + + The current start.ini arguments are: @STARTINI@ diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java new file mode 100644 index 00000000000..246771b4da6 --- /dev/null +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java @@ -0,0 +1,76 @@ +// ======================================================================== +// Copyright (c) 2009-2009 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.start; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.net.URL; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +/* ------------------------------------------------------------ */ +/** + */ +public class MainTest +{ + /* ------------------------------------------------------------ */ + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception + { + System.setProperty("jetty.home",this.getClass().getResource("/jetty.home").getFile()); + } + + /** + * Test method for {@link org.eclipse.jetty.start.StartIniParser#loadStartIni(java.lang.String)}. + */ + @Test + public void testLoadStartIni() + { + URL startIni = this.getClass().getResource("/jetty.home/start.ini"); + String startIniFileName = startIni.getFile(); + List args = Main.loadStartIni(new File(startIniFileName)); + assertEquals("Expected 5 uncommented lines in start.ini",5,args.size()); + assertEquals("First uncommented line in start.ini doesn't match expected result","OPTIONS=Server,jsp,resources,websocket,ext",args.get(0)); + } + + @Test + public void testExpandCommandLine() throws Exception + { + Main main = new Main(); + List args = main.expandCommandLine(new String[]{}); + assertEquals("start.ini OPTIONS","OPTIONS=Server,jsp,resources,websocket,ext",args.get(0)); + assertEquals("start.d/jmx OPTIONS","OPTIONS=jmx",args.get(5)); + assertEquals("start.d/jmx XML","--pre=etc/jetty-jmx.xml",args.get(6)); + assertEquals("start.d/websocket OPTIONS","OPTIONS=websocket",args.get(7)); + } + + @Test + public void testProcessCommandLine() throws Exception + { + Main main = new Main(); + List args = main.expandCommandLine(new String[]{}); + List xmls = main.processCommandLine(args); + + assertEquals("jmx --pre","etc/jetty-jmx.xml",xmls.get(0)); + assertEquals("start.ini","etc/jetty.xml",xmls.get(1)); + assertEquals("start.d","etc/jetty-testrealm.xml",xmls.get(5)); + } + +} diff --git a/jetty-start/src/test/resources/jetty.home/start.d/10-jmx.ini b/jetty-start/src/test/resources/jetty.home/start.d/10-jmx.ini new file mode 100644 index 00000000000..827e41bf43c --- /dev/null +++ b/jetty-start/src/test/resources/jetty.home/start.d/10-jmx.ini @@ -0,0 +1,22 @@ +#=========================================================== +# Additional Jetty start.jar arguments +# Each line of this file is prepended to the command line +# arguments # of a call to: +# java -jar start.jar [arg...] +#=========================================================== + + + +#=========================================================== +#----------------------------------------------------------- +OPTIONS=jmx +#----------------------------------------------------------- + + +#=========================================================== +# Configuration files. +# For a full list of available configuration files do +# java -jar start.jar --help +#----------------------------------------------------------- +--pre=etc/jetty-jmx.xml +#=========================================================== diff --git a/jetty-start/src/test/resources/jetty.home/start.d/20-websocket.ini b/jetty-start/src/test/resources/jetty.home/start.d/20-websocket.ini new file mode 100644 index 00000000000..679a221dd71 --- /dev/null +++ b/jetty-start/src/test/resources/jetty.home/start.d/20-websocket.ini @@ -0,0 +1,13 @@ +#=========================================================== +# Additional Jetty start.jar arguments +# Each line of this file is prepended to the command line +# arguments # of a call to: +# java -jar start.jar [arg...] +#=========================================================== + + + +#=========================================================== +#----------------------------------------------------------- +OPTIONS=websocket +#----------------------------------------------------------- \ No newline at end of file diff --git a/jetty-start/src/test/resources/jetty.home/start.d/90-testrealm.ini b/jetty-start/src/test/resources/jetty.home/start.d/90-testrealm.ini new file mode 100644 index 00000000000..59313d3b994 --- /dev/null +++ b/jetty-start/src/test/resources/jetty.home/start.d/90-testrealm.ini @@ -0,0 +1 @@ +etc/jetty-testrealm.xml \ No newline at end of file diff --git a/jetty-start/src/test/resources/jetty.home/start.ini b/jetty-start/src/test/resources/jetty.home/start.ini new file mode 100644 index 00000000000..a9b724988ef --- /dev/null +++ b/jetty-start/src/test/resources/jetty.home/start.ini @@ -0,0 +1,65 @@ +#=========================================================== +# Jetty start.jar arguments +# Each line of this file is prepended to the command line +# arguments # of a call to: +# java -jar start.jar [arg...] +#=========================================================== + + + +#=========================================================== +# If the arguements in this file include JVM arguments +# (eg -Xmx512m) or JVM System properties (eg com.sun.???), +# then these will not take affect unless the --exec +# parameter is included or if the output from --dry-run +# is executed like: +# eval $(java -jar start.jar --dry-run) +# +# Below are some recommended options for Sun's JRE +#----------------------------------------------------------- +# --exec +# -Dorg.apache.jasper.compiler.disablejsr199=true +# -Dcom.sun.management.jmxremote +# -Dorg.eclipse.jetty.util.log.IGNORED=true +# -Dorg.eclipse.jetty.util.log.stderr.DEBUG=true +# -Dorg.eclipse.jetty.util.log.stderr.SOURCE=true +# -Xmx2000m +# -Xmn512m +# -verbose:gc +# -XX:+PrintGCDateStamps +# -XX:+PrintGCTimeStamps +# -XX:+PrintGCDetails +# -XX:+PrintTenuringDistribution +# -XX:+PrintCommandLineFlags +# -XX:+DisableExplicitGC +# -XX:+UseConcMarkSweepGC +# -XX:ParallelCMSThreads=2 +# -XX:+CMSClassUnloadingEnabled +# -XX:+UseCMSCompactAtFullCollection +# -XX:CMSInitiatingOccupancyFraction=80 +#----------------------------------------------------------- + + +#=========================================================== +# Start classpath OPTIONS. +# These control what classes are on the classpath +# for a full listing do +# java -jar start.jar --list-options +#----------------------------------------------------------- +OPTIONS=Server,jsp,resources,websocket,ext +#----------------------------------------------------------- + + +#=========================================================== +# Configuration files. +# For a full list of available configuration files do +# java -jar start.jar --help +#----------------------------------------------------------- +etc/jetty.xml +# etc/jetty-ssl.xml +# etc/jetty-requestlog.xml +etc/jetty-deploy.xml +#etc/jetty-overlay.xml +etc/jetty-webapps.xml +etc/jetty-contexts.xml +#=========================================================== From 085c79d7d6cfbccc02821ffdb64968593df3e0bf Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 30 Dec 2011 12:00:18 +1100 Subject: [PATCH 26/92] 637638 limit number of form parameters to avoid DOS --- .../org/eclipse/jetty/server/Request.java | 25 ++++++-- .../jetty/server/handler/ContextHandler.java | 21 +++++++ .../org/eclipse/jetty/server/RequestTest.java | 62 +++++++++++++++++- .../org/eclipse/jetty/util/UrlEncoded.java | 63 ++++++++++++------- .../eclipse/jetty/util/URLEncodedTest.java | 4 +- 5 files changed, 144 insertions(+), 31 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 84ec0e24495..ca8789de207 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -101,6 +101,14 @@ import org.eclipse.jetty.util.log.Logger; * to avoid reparsing headers and cookies that are likely to be the same for * requests from the same connection. * + *

+ * The form content that a request can process is limited to protect from Denial of Service + * attacks. The size in bytes is limited by {@link ContextHandler#getMaxFormContentSize()} or if there is no + * context then the "org.eclipse.jetty.server.Request.maxFormContentSize" {@link Server} attribute. + * The number of parameters keys is limited by {@link ContextHandler#getMaxFormKeys()} or if there is no + * context then the "org.eclipse.jetty.server.Request.maxFormKeys" {@link Server} attribute. + * + * */ public class Request implements HttpServletRequest { @@ -231,7 +239,7 @@ public class Request implements HttpServletRequest if (content_type != null && content_type.length() > 0) { content_type = HttpFields.valueParameters(content_type, null); - + if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(content_type) && _inputState==__NONE && (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod()))) { @@ -241,16 +249,21 @@ public class Request implements HttpServletRequest try { int maxFormContentSize=-1; + int maxFormKeys=-1; if (_context!=null) + { maxFormContentSize=_context.getContextHandler().getMaxFormContentSize(); + maxFormKeys=_context.getContextHandler().getMaxFormKeys(); + } else { - Integer size = (Integer)_connection.getConnector().getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormContentSize"); - if (size!=null) - maxFormContentSize =size.intValue(); + Number size = (Number)_connection.getConnector().getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormContentSize"); + maxFormContentSize=size==null?200000:size.intValue(); + Number keys = (Number)_connection.getConnector().getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormKeys"); + maxFormKeys =keys==null?1000:keys.intValue(); } - + if (content_length>maxFormContentSize && maxFormContentSize > 0) { throw new IllegalStateException("Form too large"+content_length+">"+maxFormContentSize); @@ -258,7 +271,7 @@ public class Request implements HttpServletRequest InputStream in = getInputStream(); // Add form params to query params - UrlEncoded.decodeTo(in, _baseParameters, encoding,content_length<0?maxFormContentSize:-1); + UrlEncoded.decodeTo(in, _baseParameters, encoding,content_length<0?maxFormContentSize:-1,maxFormKeys); } catch (IOException e) { diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index 5bab60df0e3..3538d75f96d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -120,6 +120,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. private EventListener[] _eventListeners; private Logger _logger; private boolean _allowNullPathInfo; + private int _maxFormKeys = Integer.getInteger("org.eclipse.jetty.server.Request.maxFormKeys",1000).intValue(); private int _maxFormContentSize = Integer.getInteger("org.eclipse.jetty.server.Request.maxFormContentSize",200000).intValue(); private boolean _compactPath = false; private boolean _aliases = false; @@ -1348,11 +1349,31 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. } /* ------------------------------------------------------------ */ + /** + * Set the maximum size of a form post, to protect against DOS attacks from large forms. + * @param maxSize + */ public void setMaxFormContentSize(int maxSize) { _maxFormContentSize = maxSize; } + /* ------------------------------------------------------------ */ + public int getMaxFormKeys() + { + return _maxFormKeys; + } + + /* ------------------------------------------------------------ */ + /** + * Set the maximum number of form Keys to protect against DOS attack from crafted hash keys. + * @param max + */ + public void setMaxFormKeys(int max) + { + _maxFormKeys = max; + } + /* ------------------------------------------------------------ */ /** * @return True if URLs are compacted to replace multiple '/'s with a single '/' diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index 71cfdcd236f..bc4cbff2cdc 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -19,12 +19,16 @@ import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; +import java.util.HashMap; import java.util.Map; import javax.servlet.ServletException; @@ -34,9 +38,11 @@ import javax.servlet.http.HttpServletResponse; import junit.framework.Assert; +import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.util.log.Log; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -740,6 +746,56 @@ public class RequestTest assertEquals(null,cookie[1]); } + + @Test + public void testHashDOS() throws Exception + { + _server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize",-1); + _server.setAttribute("org.eclipse.jetty.server.Request.maxFormKeys",1000); + + // This file is not distributed - as it is dangerous + File evil_keys = new File("/tmp/keys_mapping_to_zero_2m"); + if (!evil_keys.exists()) + { + Log.info("testHashDOS skipped"); + return; + } + + BufferedReader in = new BufferedReader(new FileReader(evil_keys)); + StringBuilder buf = new StringBuilder(4000000); + + String key=null; + buf.append("a=b"); + while((key=in.readLine())!=null) + { + buf.append("&").append(key).append("=").append("x"); + } + buf.append("&c=d"); + + _handler._checker = new RequestTester() + { + public boolean check(HttpServletRequest request,HttpServletResponse response) + { + return "b".equals(request.getParameter("a")) && request.getParameter("c")==null; + } + }; + + String request="POST / HTTP/1.1\r\n"+ + "Host: whatever\r\n"+ + "Content-Type: "+MimeTypes.FORM_ENCODED+"\r\n"+ + "Content-Length: "+buf.length()+"\r\n"+ + "Connection: close\r\n"+ + "\r\n"+ + buf; + + long start=System.currentTimeMillis(); + String response = _connector.getResponses(request); + assertTrue(response.contains("200 OK")); + long now=System.currentTimeMillis(); + assertTrue((now-start)<5000); + } + + interface RequestTester { boolean check(HttpServletRequest request,HttpServletResponse response) throws IOException; @@ -754,13 +810,15 @@ public class RequestTest { ((Request)request).setHandled(true); - if (request.getContentLength()>0) + if (request.getContentLength()>0 && !MimeTypes.FORM_ENCODED.equals(request.getContentType())) _content=IO.toString(request.getInputStream()); - + if (_checker!=null && _checker.check(request,response)) response.setStatus(200); else response.sendError(500); + + } } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java b/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java index e0ed56cbaf7..06741c0a130 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java @@ -16,6 +16,7 @@ package org.eclipse.jetty.util; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.util.Iterator; import java.util.Map; @@ -78,13 +79,13 @@ public class UrlEncoded extends MultiMap implements Cloneable /* ----------------------------------------------------------------- */ public void decode(String query) { - decodeTo(query,this,ENCODING); + decodeTo(query,this,ENCODING,-1); } /* ----------------------------------------------------------------- */ public void decode(String query,String charset) { - decodeTo(query,this,charset); + decodeTo(query,this,charset,-1); } /* -------------------------------------------------------------- */ @@ -177,6 +178,15 @@ public class UrlEncoded extends MultiMap implements Cloneable * @param content the string containing the encoded parameters */ public static void decodeTo(String content, MultiMap map, String charset) + { + decodeTo(content,map,charset,-1); + } + + /* -------------------------------------------------------------- */ + /** Decoded parameters to Map. + * @param content the string containing the encoded parameters + */ + public static void decodeTo(String content, MultiMap map, String charset, int maxKeys) { if (charset==null) charset=ENCODING; @@ -208,6 +218,11 @@ public class UrlEncoded extends MultiMap implements Cloneable } key = null; value=null; + if (maxKeys>0 && map.size()>maxKeys) + { + LOG.warn("maxFormKeys limit exceeded keys>{}",maxKeys); + return; + } break; case '=': if (key!=null) @@ -343,9 +358,10 @@ public class UrlEncoded extends MultiMap implements Cloneable /** Decoded parameters to Map. * @param in InputSteam to read * @param map MultiMap to add parameters to - * @param maxLength maximum length of content to read 0r -1 for no limit + * @param maxLength maximum length of content to read or -1 for no limit + * @param maxLength maximum number of keys to read or -1 for no limit */ - public static void decode88591To(InputStream in, MultiMap map, int maxLength) + public static void decode88591To(InputStream in, MultiMap map, int maxLength, int maxKeys) throws IOException { synchronized(map) @@ -375,6 +391,11 @@ public class UrlEncoded extends MultiMap implements Cloneable } key = null; value=null; + if (maxKeys>0 && map.size()>maxKeys) + { + LOG.warn("maxFormKeys limit exceeded keys>{}",maxKeys); + return; + } break; case '=': @@ -423,9 +444,10 @@ public class UrlEncoded extends MultiMap implements Cloneable /** Decoded parameters to Map. * @param in InputSteam to read * @param map MultiMap to add parameters to - * @param maxLength maximum length of content to read 0r -1 for no limit + * @param maxLength maximum length of content to read or -1 for no limit + * @param maxLength maximum number of keys to read or -1 for no limit */ - public static void decodeUtf8To(InputStream in, MultiMap map, int maxLength) + public static void decodeUtf8To(InputStream in, MultiMap map, int maxLength, int maxKeys) throws IOException { synchronized(map) @@ -455,6 +477,11 @@ public class UrlEncoded extends MultiMap implements Cloneable } key = null; value=null; + if (maxKeys>0 && map.size()>maxKeys) + { + LOG.warn("maxFormKeys limit exceeded keys>{}",maxKeys); + return; + } break; case '=': @@ -500,25 +527,20 @@ public class UrlEncoded extends MultiMap implements Cloneable } /* -------------------------------------------------------------- */ - public static void decodeUtf16To(InputStream in, MultiMap map, int maxLength) throws IOException + public static void decodeUtf16To(InputStream in, MultiMap map, int maxLength, int maxKeys) throws IOException { InputStreamReader input = new InputStreamReader(in,StringUtil.__UTF16); - StringBuffer buf = new StringBuffer(); - - int c; - int length=0; - if (maxLength<0) - maxLength=Integer.MAX_VALUE; - while ((c=input.read())>0 && length++ Date: Mon, 2 Jan 2012 08:26:29 +1100 Subject: [PATCH 27/92] Fix build. --- .../providers/ScanningAppProviderRuntimeUpdatesTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java index d0611fa6923..f2535c20d33 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java @@ -111,6 +111,7 @@ public class ScanningAppProviderRuntimeUpdatesTest jetty.copyWebapp("foo-webapp-1.war","foo.war"); jetty.copyContext("foo.xml","foo.xml"); + waitForDirectoryScan(); waitForDirectoryScan(); jetty.assertWebAppContextsExists("/foo"); @@ -125,12 +126,14 @@ public class ScanningAppProviderRuntimeUpdatesTest jetty.copyWebapp("foo-webapp-1.war","foo.war"); jetty.copyContext("foo.xml","foo.xml"); + waitForDirectoryScan(); waitForDirectoryScan(); jetty.assertWebAppContextsExists("/foo"); jetty.removeContext("foo.xml"); + waitForDirectoryScan(); waitForDirectoryScan(); // FIXME: hot undeploy with removal not working! - jetty.assertNoWebAppContexts(); @@ -151,6 +154,7 @@ public class ScanningAppProviderRuntimeUpdatesTest jetty.copyWebapp("foo-webapp-1.war","foo.war"); jetty.copyContext("foo.xml","foo.xml"); + waitForDirectoryScan(); waitForDirectoryScan(); jetty.assertWebAppContextsExists("/foo"); @@ -165,6 +169,7 @@ public class ScanningAppProviderRuntimeUpdatesTest // This should result in the existing foo.war being replaced with the new foo.war waitForDirectoryScan(); + waitForDirectoryScan(); jetty.assertWebAppContextsExists("/foo"); // Test that webapp response contains "-2" From 06f0498a480991b9512df4f6792b5ec32f2eabda Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 3 Jan 2012 12:15:51 +0100 Subject: [PATCH 28/92] Made tests more reliable by waiting for the websocket connection to be established and for onOpen() to be called. --- .../websocket/SafariWebsocketDraft0Test.java | 18 +++++++++--------- .../jetty/websocket/WebSocketCommTest.java | 11 ++++++----- .../jetty/websocket/helper/CaptureSocket.java | 19 ++++++++----------- .../jetty/websocket/helper/SafariD00.java | 10 ++++++---- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java index 0afb1dfae64..9b4af2d27c9 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.hamcrest.Matchers.*; - import java.net.URI; import java.util.concurrent.TimeUnit; @@ -24,7 +22,6 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.websocket.helper.CaptureSocket; import org.eclipse.jetty.websocket.helper.SafariD00; import org.eclipse.jetty.websocket.helper.WebSocketCaptureServlet; @@ -32,9 +29,11 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; + public class SafariWebsocketDraft0Test { private Server server; @@ -76,7 +75,7 @@ public class SafariWebsocketDraft0Test serverUri = new URI(String.format("ws://%s:%d/",host,port)); // System.out.printf("Server URI: %s%n",serverUri); } - + @Test public void testSendTextMessages() throws Exception { @@ -96,10 +95,11 @@ public class SafariWebsocketDraft0Test CaptureSocket socket = servlet.captures.get(0); Assert.assertThat("CaptureSocket",socket,notNullValue()); - Assert.assertThat("CaptureSocket.isConnected", socket.isConnected(), is(true)); + Assert.assertThat("CaptureSocket.isConnected", socket.awaitConnected(1000), is(true)); - // Give servlet 500 millisecond to process messages + // Give servlet time to process messages threadSleep(1,TimeUnit.SECONDS); + // Should have captured 5 messages. Assert.assertThat("CaptureSocket.messages.size",socket.messages.size(),is(5)); } @@ -109,13 +109,13 @@ public class SafariWebsocketDraft0Test safari.disconnect(); } } - + public static void threadSleep(int dur, TimeUnit unit) throws InterruptedException { long ms = TimeUnit.MILLISECONDS.convert(dur,unit); Thread.sleep(ms); } - + @After public void stopServer() throws Exception { diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketCommTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketCommTest.java index 0e91ffaa0e9..1668d13b5ad 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketCommTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketCommTest.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.hamcrest.Matchers.*; - import java.net.URI; import java.util.concurrent.TimeUnit; @@ -32,6 +30,9 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; + /** * WebSocketCommTest - to test reported undelivered messages in bug JETTY-1463 @@ -109,11 +110,11 @@ public class WebSocketCommTest CaptureSocket socket = servlet.captures.get(0); Assert.assertThat("CaptureSocket",socket,notNullValue()); - Assert.assertThat("CaptureSocket.isConnected",socket.isConnected(),is(true)); + Assert.assertThat("CaptureSocket.isConnected",socket.awaitConnected(1000),is(true)); - // Give servlet 500 millisecond to process messages + // Give servlet time to process messages TimeUnit.MILLISECONDS.sleep(500); - + // Should have captured 5 messages. Assert.assertThat("CaptureSocket.messages.size",socket.messages.size(),is(5)); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/CaptureSocket.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/CaptureSocket.java index 19233d4d297..de969280a34 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/CaptureSocket.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/CaptureSocket.java @@ -17,12 +17,14 @@ package org.eclipse.jetty.websocket.helper; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import org.eclipse.jetty.websocket.WebSocket; -public class CaptureSocket implements WebSocket, WebSocket.OnTextMessage +public class CaptureSocket implements WebSocket.OnTextMessage { - private Connection conn; + private final CountDownLatch latch = new CountDownLatch(1); public List messages; public CaptureSocket() @@ -30,13 +32,9 @@ public class CaptureSocket implements WebSocket, WebSocket.OnTextMessage messages = new ArrayList(); } - public boolean isConnected() + public boolean awaitConnected(long timeout) throws InterruptedException { - if (conn == null) - { - return false; - } - return conn.isOpen(); + return latch.await(timeout, TimeUnit.MILLISECONDS); } public void onMessage(String data) @@ -47,11 +45,10 @@ public class CaptureSocket implements WebSocket, WebSocket.OnTextMessage public void onOpen(Connection connection) { - this.conn = connection; + latch.countDown(); } public void onClose(int closeCode, String message) { - this.conn = null; } -} \ No newline at end of file +} diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java index 244e71cdc2d..85ab83c2ae4 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket.helper; -import static org.hamcrest.Matchers.*; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -32,6 +30,8 @@ import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.util.TypeUtil; import org.junit.Assert; +import static org.hamcrest.Matchers.is; + public class SafariD00 { private URI uri; @@ -48,7 +48,7 @@ public class SafariD00 /** * Open the Socket to the destination endpoint and - * + * * @return the open java Socket. * @throws IOException */ @@ -65,7 +65,7 @@ public class SafariD00 /** * Issue an Http websocket (Draft-0) upgrade request using the Safari particulars. - * + * * @throws UnsupportedEncodingException */ public void issueHandshake() throws IOException @@ -96,6 +96,8 @@ public class SafariD00 InputStreamReader reader = new InputStreamReader(in); BufferedReader br = new BufferedReader(reader); + socket.setSoTimeout(5000); + boolean foundEnd = false; String line; while (!foundEnd) From d6e841beaebf81e080ca48273cefb5c119f47fd8 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Wed, 4 Jan 2012 17:13:59 +0100 Subject: [PATCH 29/92] 367716: maxIdleTime fixes for async http and new maxIdleTime tests Signed-off-by: Simone Bordet --- .../jetty/server/AsyncHttpConnection.java | 11 +- .../org/eclipse/jetty/server/Request.java | 12 ++ .../jetty/server/LocalAsyncContextTest.java | 151 +----------------- .../server/SelectChannelTimeoutTest.java | 83 +++++++++- 4 files changed, 100 insertions(+), 157 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index 1ddedf015aa..ed45cb75809 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -56,7 +56,8 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async setCurrentConnection(this); // don't check for idle while dispatched (unless blocking IO is done). - _asyncEndp.setCheckForIdle(false); + if(!_request.isAsyncCompleted()) + _asyncEndp.setCheckForIdle(false); // While progress and the connection has not changed @@ -144,11 +145,13 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async // return buffers _parser.returnBuffers(); _generator.returnBuffers(); - - // resuming checking for idle + } + + if (_request.isAsyncCompleted() || _request.isAsyncInitial()) + { _asyncEndp.setCheckForIdle(true); } - + // Safety net to catch spinning if (some_progress) _total_no_progress=0; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index ca8789de207..4c16fec280b 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1265,6 +1265,18 @@ public class Request implements HttpServletRequest return _async.isAsyncStarted(); } + /* ------------------------------------------------------------ */ + public boolean isAsyncInitial() + { + return _async.isInitial(); + } + + /* ------------------------------------------------------------ */ + public boolean isAsyncCompleted() + { + return _async.isComplete(); + } + /* ------------------------------------------------------------ */ public boolean isAsyncSupported() { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java index e5b13f6dc52..3042c767e98 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java @@ -16,16 +16,10 @@ package org.eclipse.jetty.server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.IOException; -import java.io.InputStream; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationListener; -import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.server.session.SessionHandler; import org.junit.After; import org.junit.Before; @@ -151,149 +145,8 @@ public class LocalAsyncContextTest return ((LocalConnector)_connector).getResponses(request); } - private static class SuspendHandler extends HandlerWrapper - { - private int _read; - private long _suspendFor=-1; - private long _resumeAfter=-1; - private long _completeAfter=-1; - - public SuspendHandler() - { - } - - public int getRead() - { - return _read; - } - - public void setRead(int read) - { - _read = read; - } - - public long getSuspendFor() - { - return _suspendFor; - } - - public void setSuspendFor(long suspendFor) - { - _suspendFor = suspendFor; - } - - public long getResumeAfter() - { - return _resumeAfter; - } - - public void setResumeAfter(long resumeAfter) - { - _resumeAfter = resumeAfter; - } - - public long getCompleteAfter() - { - return _completeAfter; - } - - public void setCompleteAfter(long completeAfter) - { - _completeAfter = completeAfter; - } - - @Override - public void handle(String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException - { - if (DispatcherType.REQUEST.equals(baseRequest.getDispatcherType())) - { - if (_read>0) - { - byte[] buf=new byte[_read]; - request.getInputStream().read(buf); - } - else if (_read<0) - { - InputStream in = request.getInputStream(); - int b=in.read(); - while(b!=-1) - b=in.read(); - } - - final AsyncContext asyncContext = baseRequest.startAsync(); - asyncContext.addContinuationListener(__asyncListener); - if (_suspendFor>0) - asyncContext.setTimeout(_suspendFor); - - if (_completeAfter>0) - { - new Thread() { - @Override - public void run() - { - try - { - Thread.sleep(_completeAfter); - response.getOutputStream().print("COMPLETED"); - response.setStatus(200); - baseRequest.setHandled(true); - asyncContext.complete(); - } - catch(Exception e) - { - e.printStackTrace(); - } - } - }.start(); - } - else if (_completeAfter==0) - { - response.getOutputStream().print("COMPLETED"); - response.setStatus(200); - baseRequest.setHandled(true); - asyncContext.complete(); - } - - if (_resumeAfter>0) - { - new Thread() { - @Override - public void run() - { - try - { - Thread.sleep(_resumeAfter); - if(((HttpServletRequest)asyncContext.getRequest()).getSession(true).getId()!=null) - asyncContext.dispatch(); - } - catch(Exception e) - { - e.printStackTrace(); - } - } - }.start(); - } - else if (_resumeAfter==0) - { - asyncContext.dispatch(); - } - } - else if (request.getAttribute("TIMEOUT")!=null) - { - response.setStatus(200); - response.getOutputStream().print("TIMEOUT"); - baseRequest.setHandled(true); - } - else - { - response.setStatus(200); - response.getOutputStream().print("RESUMED"); - baseRequest.setHandled(true); - } - } - } - - private static ContinuationListener __asyncListener = new ContinuationListener() + + static ContinuationListener __asyncListener = new ContinuationListener() { public void onComplete(Continuation continuation) { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java index ece6ae77b9f..9a5aeb0e1f1 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java @@ -13,17 +13,92 @@ package org.eclipse.jetty.server; +import java.io.InputStream; +import java.net.Socket; +import java.net.SocketException; + import org.eclipse.jetty.server.nio.SelectChannelConnector; -import org.junit.BeforeClass; +import org.eclipse.jetty.server.session.SessionHandler; +import org.eclipse.jetty.util.IO; +import org.junit.Before; +import org.junit.Test; public class SelectChannelTimeoutTest extends ConnectorTimeoutTest { - @BeforeClass - public static void init() throws Exception + + @Before + public void init() throws Exception { SelectChannelConnector connector = new SelectChannelConnector(); - connector.setMaxIdleTime(MAX_IDLE_TIME); //250 msec max idle + connector.setMaxIdleTime(MAX_IDLE_TIME); // 250 msec max idle startServer(connector); } + @Test(expected=SocketException.class) + public void testIdleTimeoutAfterSuspend() throws Exception + { + SuspendHandler _handler = new SuspendHandler(); + _server.stop(); + SessionHandler session = new SessionHandler(); + session.setHandler(_handler); + _server.setHandler(session); + _server.start(); + + _handler.setSuspendFor(100); + _handler.setResumeAfter(25); + process(null); + } + + @Test(expected=SocketException.class) + public void testIdleTimeoutAfterTimeout() throws Exception + { + SuspendHandler _handler = new SuspendHandler(); + _server.stop(); + SessionHandler session = new SessionHandler(); + session.setHandler(_handler); + _server.setHandler(session); + _server.start(); + + _handler.setSuspendFor(50); + System.out.println(process(null)); + } + + @Test(expected=SocketException.class) + public void testIdleTimeoutAfterComplete() throws Exception + { + SuspendHandler _handler = new SuspendHandler(); + _server.stop(); + SessionHandler session = new SessionHandler(); + session.setHandler(_handler); + _server.setHandler(session); + _server.start(); + + _handler.setSuspendFor(100); + _handler.setCompleteAfter(25); + System.out.println(process(null)); + } + + // TODO: remove code duplication to LocalAsyncContextTest.java + private synchronized String process(String content) throws Exception + { + String request = "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + "Connection: close\r\n"; + + if (content == null) + request += "\r\n"; + else + request += "Content-Length: " + content.length() + "\r\n" + "\r\n" + content; + return getResponse(request); + } + + protected String getResponse(String request) throws Exception + { + SelectChannelConnector connector = (SelectChannelConnector)_connector; + Socket socket = new Socket((String)null,connector.getLocalPort()); + socket.getOutputStream().write(request.getBytes("UTF-8")); + InputStream inputStream = socket.getInputStream(); + Thread.sleep(500); + socket.getOutputStream().write(10); + return IO.toString(inputStream); + } + } From 07afebafe53e3b041ecd1940bf4c0c7533b04869 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Thu, 5 Jan 2012 13:18:41 +0100 Subject: [PATCH 30/92] 367716: maxIdleTime fixes Signed-off-by: Simone Bordet --- .../jetty/server/AsyncHttpConnection.java | 7 +- .../org/eclipse/jetty/server/Request.java | 27 +--- .../server/SelectChannelTimeoutTest.java | 30 ++-- .../eclipse/jetty/server/SuspendHandler.java | 153 ++++++++++++++++++ 4 files changed, 178 insertions(+), 39 deletions(-) create mode 100644 jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index ed45cb75809..031ad11e8d0 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -56,8 +56,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async setCurrentConnection(this); // don't check for idle while dispatched (unless blocking IO is done). - if(!_request.isAsyncCompleted()) - _asyncEndp.setCheckForIdle(false); + _asyncEndp.setCheckForIdle(false); // While progress and the connection has not changed @@ -140,14 +139,14 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async setCurrentConnection(null); // If we are not suspended - if (!_request.isAsyncStarted()) + if (!_request.getAsyncContinuation().isAsyncStarted()) { // return buffers _parser.returnBuffers(); _generator.returnBuffers(); } - if (_request.isAsyncCompleted() || _request.isAsyncInitial()) + if (_request.getAsyncContinuation().isComplete() || _request.getAsyncContinuation().isInitial()) { _asyncEndp.setCheckForIdle(true); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 4c16fec280b..4fc8c5934d5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -308,10 +308,11 @@ public class Request implements HttpServletRequest } } + /* ------------------------------------------------------------ */ public AsyncContext getAsyncContext() { - if (_async.isInitial() && !isAsyncStarted()) + if (_async.isInitial() && !_async.isAsyncStarted()) throw new IllegalStateException(_async.getStatusString()); return _async; } @@ -1260,34 +1261,16 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - public boolean isAsyncStarted() + public boolean isHandled() { - return _async.isAsyncStarted(); + return _handled; } - - /* ------------------------------------------------------------ */ - public boolean isAsyncInitial() - { - return _async.isInitial(); - } - - /* ------------------------------------------------------------ */ - public boolean isAsyncCompleted() - { - return _async.isComplete(); - } - + /* ------------------------------------------------------------ */ public boolean isAsyncSupported() { return _asyncSupported; } - - /* ------------------------------------------------------------ */ - public boolean isHandled() - { - return _handled; - } /* ------------------------------------------------------------ */ /* diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java index 9a5aeb0e1f1..c3479cb4d4a 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java @@ -13,9 +13,13 @@ package org.eclipse.jetty.server; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.net.Socket; -import java.net.SocketException; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.session.SessionHandler; @@ -34,7 +38,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest startServer(connector); } - @Test(expected=SocketException.class) + @Test public void testIdleTimeoutAfterSuspend() throws Exception { SuspendHandler _handler = new SuspendHandler(); @@ -46,10 +50,10 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setSuspendFor(100); _handler.setResumeAfter(25); - process(null); + assertTrue(process(null).toUpperCase().contains("RESUMED")); } - @Test(expected=SocketException.class) + @Test public void testIdleTimeoutAfterTimeout() throws Exception { SuspendHandler _handler = new SuspendHandler(); @@ -60,11 +64,11 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _server.start(); _handler.setSuspendFor(50); - System.out.println(process(null)); + assertTrue(process(null).toUpperCase().contains("TIMEOUT")); } - @Test(expected=SocketException.class) - public void testIdleTimeoutAfterComplete() throws Exception + @Test + public void testIdleTimeoutAfterComplete() throws Exception { SuspendHandler _handler = new SuspendHandler(); _server.stop(); @@ -75,11 +79,10 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setSuspendFor(100); _handler.setCompleteAfter(25); - System.out.println(process(null)); + assertTrue(process(null).toUpperCase().contains("COMPLETED")); } - // TODO: remove code duplication to LocalAsyncContextTest.java - private synchronized String process(String content) throws Exception + private synchronized String process(String content) throws UnsupportedEncodingException, IOException, InterruptedException { String request = "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + "Connection: close\r\n"; @@ -90,15 +93,16 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest return getResponse(request); } - protected String getResponse(String request) throws Exception + private String getResponse(String request) throws UnsupportedEncodingException, IOException, InterruptedException { SelectChannelConnector connector = (SelectChannelConnector)_connector; Socket socket = new Socket((String)null,connector.getLocalPort()); socket.getOutputStream().write(request.getBytes("UTF-8")); InputStream inputStream = socket.getInputStream(); + String response = IO.toString(inputStream); Thread.sleep(500); - socket.getOutputStream().write(10); - return IO.toString(inputStream); + assertEquals("Socket should be closed and return -1 on reading",-1,socket.getInputStream().read()); + return response; } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java new file mode 100644 index 00000000000..f5ea64c3bd1 --- /dev/null +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java @@ -0,0 +1,153 @@ +package org.eclipse.jetty.server; + +import java.io.IOException; +import java.io.InputStream; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.server.handler.HandlerWrapper; + +class SuspendHandler extends HandlerWrapper +{ + private int _read; + private long _suspendFor=-1; + private long _resumeAfter=-1; + private long _completeAfter=-1; + + public SuspendHandler() + { + } + + public int getRead() + { + return _read; + } + + public void setRead(int read) + { + _read = read; + } + + public long getSuspendFor() + { + return _suspendFor; + } + + public void setSuspendFor(long suspendFor) + { + _suspendFor = suspendFor; + } + + public long getResumeAfter() + { + return _resumeAfter; + } + + public void setResumeAfter(long resumeAfter) + { + _resumeAfter = resumeAfter; + } + + public long getCompleteAfter() + { + return _completeAfter; + } + + public void setCompleteAfter(long completeAfter) + { + _completeAfter = completeAfter; + } + + @Override + public void handle(String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException + { + if (DispatcherType.REQUEST.equals(baseRequest.getDispatcherType())) + { + if (_read>0) + { + byte[] buf=new byte[_read]; + request.getInputStream().read(buf); + } + else if (_read<0) + { + InputStream in = request.getInputStream(); + int b=in.read(); + while(b!=-1) + b=in.read(); + } + + final AsyncContext asyncContext = baseRequest.startAsync(); + asyncContext.addContinuationListener(LocalAsyncContextTest.__asyncListener); + if (_suspendFor>0) + asyncContext.setTimeout(_suspendFor); + + if (_completeAfter>0) + { + new Thread() { + @Override + public void run() + { + try + { + Thread.sleep(_completeAfter); + response.getOutputStream().print("COMPLETED"); + response.setStatus(200); + baseRequest.setHandled(true); + asyncContext.complete(); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + }.start(); + } + else if (_completeAfter==0) + { + response.getOutputStream().print("COMPLETED"); + response.setStatus(200); + baseRequest.setHandled(true); + asyncContext.complete(); + } + + if (_resumeAfter>0) + { + new Thread() { + @Override + public void run() + { + try + { + Thread.sleep(_resumeAfter); + if(((HttpServletRequest)asyncContext.getRequest()).getSession(true).getId()!=null) + asyncContext.dispatch(); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + }.start(); + } + else if (_resumeAfter==0) + { + asyncContext.dispatch(); + } + } + else if (request.getAttribute("TIMEOUT")!=null) + { + response.setStatus(200); + response.getOutputStream().print("TIMEOUT"); + baseRequest.setHandled(true); + } + else + { + response.setStatus(200); + response.getOutputStream().print("RESUMED"); + baseRequest.setHandled(true); + } + } + +} \ No newline at end of file From bbe48ddfbbc38dd8c7eca079c669236470804271 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 5 Jan 2012 09:26:44 -0700 Subject: [PATCH 31/92] Updating version jetty-7.6.0.RC3 in VERSION.txt --- VERSION.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index eb6e1de36f0..fc47f1ba50c 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,13 @@ -jetty-7.6.0-SNAPSHOT +jetty-7.6.0.RC3 - 05 January 2012 + + 367433 added tests to investigate + + 367435 improved D00 test harness + + 367485 HttpExchange canceled before response do not release connection. + + 367502 WebSocket connections should be closed when application context is + stopped. + + 367591 corrected configuration.xml version to 7.6 + + 367635 Added support for start.d directory + + 637638 limit number of form parameters to avoid DOS + + JETTY-1467 close half closed when idle jetty-7.6.0.RC2 - 22 December 2011 + 364638 HttpParser closes if data received while seeking EOF. Tests fixed to From 10d751fed834dd522f79c5f58fee990e8f3bd42d Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 5 Jan 2012 09:49:31 -0700 Subject: [PATCH 32/92] [maven-release-plugin] prepare release jetty-7.6.0.RC3 --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 3eb95b0ea27..b7ce672ca77 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 072ff23321e..1614450e6a1 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 3a6eee3ac51..3e2b87f2249 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index e30ee5b160a..ae0af26f0d9 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index ff9bf1f74c9..b8c3b4e792c 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 8d3cdddcb2f..95b721d3c62 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index 2e4f9bd47ee..c57674f08c4 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index 47090b07d8f..4eef2f2284f 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index c650ef55103..55f9991ac1d 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 7de1ac8d379..59b959c1c82 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index c02155bea81..02328ee43f8 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index a4b6c219f44..9eb9ef70c66 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 02a0320bdd9..7593a5a1e34 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 6c4c47b893a..df1c6cb5a58 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 528e7ce46c0..4dddd4e102b 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 173d546d426..a29ec58fedc 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 856673b86eb..8234a14d5f8 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 53d5c6e9641..17496bc94b2 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 org.eclipse.jetty diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 8a5f69852a6..2acc47bd96b 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 org.eclipse.jetty diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index f06938ce0f8..2fceec06534 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 4b9a0dc2a9d..60fb9b6ce59 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 5eaf6fef291..a4526e33694 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-jndi diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index bfff477df54..ed3a957ada2 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index 40da79b3cfe..f60b6caad00 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 75b77f019a9..06d909fe6c6 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index 76e530cde78..c24780b5bee 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 595e77a4b24..216a0c9852c 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index a0463cc5643..ac2daad4649 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 87a7087125d..6eb494efcc0 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index fbb16968697..e39ecae8b7c 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index e389254295d..098cbee1234 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index ae30fdd313e..1b6e19ca932 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index f0ae38a1230..4981ca2f40e 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 75b8349308e..59516ca7399 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 391eb9691c7..608ca3c2abc 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 64548024678..8281dd66789 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 org.eclipse.jetty jetty-policy diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index cdfe6d1c5b0..c245d1f176c 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 397991f6299..97ddadab69a 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 8e71f15966d..de1d69a0794 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 70ab5daf8a3..7e58d15ef31 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 9e112abff9e..95e7262559c 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-servlets diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index 9fcfa2c2cc8..c113d9ddbec 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 9e5dc45445a..021e7382130 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index eb1971c5043..e0add50cedf 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index cfb4b91e581..8c115c24a53 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index b2a39954309..4e5e019e493 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 63315d4c21c..d7d88cc7780 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 19 jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 498bf751457..a863188bb1c 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index 2f5b334f991..d2a93c99496 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 65f98aa0f62..bad4d38e7ff 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 5c9fbf6c19b..542c82afaf8 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 org.eclipse.jetty diff --git a/tests/pom.xml b/tests/pom.xml index 28cee13d78b..2e6dc08761e 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index bf1daf62b96..9a6d5636dee 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index a5e08c91017..8519a127617 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index 8c829fa6935..80a21e7dfa6 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 1152f8a40e2..8903cb3c52b 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index 567cfad6daa..e1ed5aaf848 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 2979f679288..2c59d59b2cf 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index c34dda4cdc9..00a3b0cbcfd 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index fcc140014f9..3a46350b438 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 51e3af89b8dd57b7bd41a2701c865371ff50302c Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 5 Jan 2012 09:49:38 -0700 Subject: [PATCH 33/92] [maven-release-plugin] prepare for next development iteration --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index b7ce672ca77..3eb95b0ea27 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 1614450e6a1..072ff23321e 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 3e2b87f2249..3a6eee3ac51 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index ae0af26f0d9..e30ee5b160a 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index b8c3b4e792c..ff9bf1f74c9 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 95b721d3c62..8d3cdddcb2f 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index c57674f08c4..2e4f9bd47ee 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index 4eef2f2284f..47090b07d8f 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index 55f9991ac1d..c650ef55103 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 59b959c1c82..7de1ac8d379 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index 02328ee43f8..c02155bea81 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index 9eb9ef70c66..a4b6c219f44 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 7593a5a1e34..02a0320bdd9 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index df1c6cb5a58..6c4c47b893a 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 4dddd4e102b..528e7ce46c0 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index a29ec58fedc..173d546d426 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 8234a14d5f8..856673b86eb 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 17496bc94b2..53d5c6e9641 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 2acc47bd96b..8a5f69852a6 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index 2fceec06534..f06938ce0f8 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 60fb9b6ce59..4b9a0dc2a9d 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index a4526e33694..5eaf6fef291 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-jndi diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index ed3a957ada2..bfff477df54 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index f60b6caad00..40da79b3cfe 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 06d909fe6c6..75b77f019a9 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index c24780b5bee..76e530cde78 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 216a0c9852c..595e77a4b24 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index ac2daad4649..a0463cc5643 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 6eb494efcc0..87a7087125d 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index e39ecae8b7c..fbb16968697 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 098cbee1234..e389254295d 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 1b6e19ca932..ae30fdd313e 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 4981ca2f40e..f0ae38a1230 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 59516ca7399..75b8349308e 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 608ca3c2abc..391eb9691c7 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 8281dd66789..64548024678 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT org.eclipse.jetty jetty-policy diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index c245d1f176c..cdfe6d1c5b0 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 97ddadab69a..397991f6299 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index de1d69a0794..8e71f15966d 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 7e58d15ef31..70ab5daf8a3 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 95e7262559c..9e112abff9e 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlets diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index c113d9ddbec..9fcfa2c2cc8 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 021e7382130..9e5dc45445a 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index e0add50cedf..eb1971c5043 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index 8c115c24a53..cfb4b91e581 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index 4e5e019e493..b2a39954309 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index d7d88cc7780..63315d4c21c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 19 jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index a863188bb1c..498bf751457 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index d2a93c99496..2f5b334f991 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index bad4d38e7ff..65f98aa0f62 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 542c82afaf8..5c9fbf6c19b 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/tests/pom.xml b/tests/pom.xml index 2e6dc08761e..28cee13d78b 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 9a6d5636dee..bf1daf62b96 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index 8519a127617..a5e08c91017 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index 80a21e7dfa6..8c829fa6935 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 8903cb3c52b..1152f8a40e2 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index e1ed5aaf848..567cfad6daa 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 2c59d59b2cf..2979f679288 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 00a3b0cbcfd..c34dda4cdc9 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 3a46350b438..fcc140014f9 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 505a76df059a638334bf94eab7b3f734352ee943 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 5 Jan 2012 10:54:42 -0700 Subject: [PATCH 34/92] Updating VERSION.txt top section --- VERSION.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VERSION.txt b/VERSION.txt index fc47f1ba50c..c2b8cbdd157 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,3 +1,5 @@ +jetty-7.6.0-SNAPSHOT + jetty-7.6.0.RC3 - 05 January 2012 + 367433 added tests to investigate + 367435 improved D00 test harness From e666ed67cbdc41c9700ea729eecbddb3771f60f1 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 6 Jan 2012 15:41:55 +0100 Subject: [PATCH 35/92] 368035 - WebSocketClientFactory does not invoke super.doStop(). --- .../java/org/eclipse/jetty/websocket/WebSocketClientFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 4b250ab1b2d..92407cd2eab 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -208,6 +208,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle protected void doStop() throws Exception { closeConnections(); + super.doStop(); } /* ------------------------------------------------------------ */ From 5e181308540fe80879392cab7fa51341db511b34 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Mon, 12 Dec 2011 10:32:23 +0100 Subject: [PATCH 36/92] 365411: Removed static logger from ProxyServlet Signed-off-by: Simone Bordet --- .../java/org/eclipse/jetty/servlets/ProxyServlet.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java index 2b186b49677..784710db93a 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java @@ -84,8 +84,6 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; */ public class ProxyServlet implements Servlet { - private static final Logger LOG = Log.getLogger(ProxyServlet.class); - protected Logger _log; protected HttpClient _client; protected String _hostHeader; @@ -497,7 +495,7 @@ public class ProxyServlet implements Servlet { if (ex instanceof EofException) { - LOG.ignore(ex); + _log.ignore(ex); return; } handleOnException(ex,request,response); @@ -732,8 +730,8 @@ public class ProxyServlet implements Servlet */ protected void handleOnException(Throwable ex, HttpServletRequest request, HttpServletResponse response) { - LOG.warn(ex.toString()); - LOG.debug(ex); + _log.warn(ex.toString()); + _log.debug(ex); if (!response.isCommitted()) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); From 9e4fd4d3856b00ab387d08e2c1e40ad88b7a6d11 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Thu, 5 Jan 2012 19:43:07 +0100 Subject: [PATCH 37/92] 365411: removed trailing whitespaces in ProxyServlet Signed-off-by: Simone Bordet --- .../eclipse/jetty/servlets/ProxyServlet.java | 134 ++++++++++-------- 1 file changed, 72 insertions(+), 62 deletions(-) diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java index 784710db93a..48bfcf391c0 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java @@ -57,7 +57,7 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; /** * Asynchronous Proxy Servlet. - * + * * Forward requests to another server either as a standard web proxy (as defined by RFC2616) or as a transparent proxy. *

* This servlet needs the jetty-util and jetty-client classes to be available to the web application. @@ -75,11 +75,11 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; *

  • requestBufferSize - the size of the request buffer (d. 12,288) *
  • responseHeaderSize - the size of the response header buffer (d. 6,144) *
  • responseBufferSize - the size of the response buffer (d. 32,768) - *
  • HostHeader - Force the host header to a particular value + *
  • HostHeader - Force the host header to a particular value *
  • whiteList - comma-separated list of allowed proxy destinations *
  • blackList - comma-separated list of forbidden proxy destinations * - * + * * @see org.eclipse.jetty.server.handler.ConnectHandler */ public class ProxyServlet implements Servlet @@ -109,22 +109,22 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /* * (non-Javadoc) - * + * * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig) */ public void init(ServletConfig config) throws ServletException { _config = config; _context = config.getServletContext(); - + _hostHeader = config.getInitParameter("HostHeader"); try { - _log = createLogger(config); + _log = createLogger(config); _client = createHttpClient(config); - + if (_context != null) { _context.setAttribute(config.getServletName() + ".Logger",_log); @@ -160,12 +160,12 @@ public class ProxyServlet implements Servlet _log.debug(x); } } - - + + /** - * Create and return a logger based on the ServletConfig for use in the + * Create and return a logger based on the ServletConfig for use in the * proxy servlet - * + * * @param config * @return Logger */ @@ -173,24 +173,24 @@ public class ProxyServlet implements Servlet { return Log.getLogger("org.eclipse.jetty.servlets." + config.getServletName()); } - + /** * Create and return an HttpClient based on ServletConfig - * - * By default this implementation will create an instance of the + * + * By default this implementation will create an instance of the * HttpClient for use by this proxy servlet. - * - * @param config - * @return HttpClient + * + * @param config + * @return HttpClient * @throws Exception */ protected HttpClient createHttpClient(ServletConfig config) throws Exception { HttpClient client = new HttpClient(); client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); - + String t = config.getInitParameter("maxThreads"); - + if (t != null) { client.setThreadPool(new QueuedThreadPool(Integer.parseInt(t))); @@ -199,67 +199,67 @@ public class ProxyServlet implements Servlet { client.setThreadPool(new QueuedThreadPool()); } - - ((QueuedThreadPool)client.getThreadPool()).setName(config.getServletName()); + + ((QueuedThreadPool)client.getThreadPool()).setName(config.getServletName()); t = config.getInitParameter("maxConnections"); - + if (t != null) { client.setMaxConnectionsPerAddress(Integer.parseInt(t)); } - + t = config.getInitParameter("timeout"); - + if ( t != null ) { client.setTimeout(Long.parseLong(t)); } - + t = config.getInitParameter("idleTimeout"); - + if ( t != null ) { client.setIdleTimeout(Long.parseLong(t)); } - + t = config.getInitParameter("requestHeaderSize"); - + if ( t != null ) { client.setRequestHeaderSize(Integer.parseInt(t)); } - + t = config.getInitParameter("requestBufferSize"); - + if ( t != null ) { client.setRequestBufferSize(Integer.parseInt(t)); } - + t = config.getInitParameter("responseHeaderSize"); - + if ( t != null ) { client.setResponseHeaderSize(Integer.parseInt(t)); } - + t = config.getInitParameter("responseBufferSize"); - + if ( t != null ) { client.setResponseBufferSize(Integer.parseInt(t)); } - + client.start(); - + return client; } - + /* ------------------------------------------------------------ */ /** * Helper function to process a parameter value containing a list of new entries and initialize the specified host map. - * + * * @param list * comma-separated list of new entries * @param hostMap @@ -299,7 +299,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /** * Check the request hostname and path against white- and blacklist. - * + * * @param host * hostname to check * @param path @@ -351,7 +351,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /* * (non-Javadoc) - * + * * @see javax.servlet.Servlet#getServletConfig() */ public ServletConfig getServletConfig() @@ -362,7 +362,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /** * Get the hostHeader. - * + * * @return the hostHeader */ public String getHostHeader() @@ -373,7 +373,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /** * Set the hostHeader. - * + * * @param hostHeader * the hostHeader to set */ @@ -385,7 +385,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /* * (non-Javadoc) - * + * * @see javax.servlet.Servlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) */ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException @@ -410,7 +410,7 @@ public class ProxyServlet implements Servlet response.sendError(HttpServletResponse.SC_GATEWAY_TIMEOUT); // Need better test that isInitial else { - + String uri = request.getRequestURI(); if (request.getQueryString() != null) uri += "?" + request.getQueryString(); @@ -428,14 +428,17 @@ public class ProxyServlet implements Servlet HttpExchange exchange = new HttpExchange() { + @Override protected void onRequestCommitted() throws IOException { } + @Override protected void onRequestComplete() throws IOException { } + @Override protected void onResponseComplete() throws IOException { if (debug != 0) @@ -443,6 +446,7 @@ public class ProxyServlet implements Servlet continuation.complete(); } + @Override protected void onResponseContent(Buffer content) throws IOException { if (debug != 0) @@ -450,10 +454,12 @@ public class ProxyServlet implements Servlet content.writeTo(out); } + @Override protected void onResponseHeaderComplete() throws IOException { } + @Override protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException { if (debug != 0) @@ -465,6 +471,7 @@ public class ProxyServlet implements Servlet response.setStatus(status); } + @Override protected void onResponseHeader(Buffer name, Buffer value) throws IOException { String s = name.toString().toLowerCase(); @@ -479,11 +486,12 @@ public class ProxyServlet implements Servlet _log.debug(debug + " " + name + "! " + value); } + @Override protected void onConnectionFailed(Throwable ex) { handleOnConnectionFailed(ex,request,response); - - // it is possible this might trigger before the + + // it is possible this might trigger before the // continuation.suspend() if (!continuation.isInitial()) { @@ -491,6 +499,7 @@ public class ProxyServlet implements Servlet } } + @Override protected void onException(Throwable ex) { if (ex instanceof EofException) @@ -499,8 +508,8 @@ public class ProxyServlet implements Servlet return; } handleOnException(ex,request,response); - - // it is possible this might trigger before the + + // it is possible this might trigger before the // continuation.suspend() if (!continuation.isInitial()) { @@ -508,6 +517,7 @@ public class ProxyServlet implements Servlet } } + @Override protected void onExpire() { handleOnExpire(request,response); @@ -595,14 +605,14 @@ public class ProxyServlet implements Servlet if (hasContent) exchange.setRequestContentSource(in); - customizeExchange(exchange, request); - + customizeExchange(exchange, request); + /* * we need to set the timeout on the continuation to take into * account the timeout of the HttpClient and the HttpExchange */ long ctimeout = (_client.getTimeout() > exchange.getTimeout()) ? _client.getTimeout() : exchange.getTimeout(); - + // continuation fudge factor of 1000, underlying components // should fail/expire first from exchange if ( ctimeout == 0 ) @@ -610,12 +620,12 @@ public class ProxyServlet implements Servlet continuation.setTimeout(0); // ideally never times out } else - { + { continuation.setTimeout(ctimeout + 1000); } - + customizeContinuation(continuation); - + continuation.suspend(response); _client.send(exchange); @@ -676,7 +686,7 @@ public class ProxyServlet implements Servlet /* * (non-Javadoc) - * + * * @see javax.servlet.Servlet#getServletInfo() */ public String getServletInfo() @@ -687,7 +697,7 @@ public class ProxyServlet implements Servlet /** * Extension point for subclasses to customize an exchange. Useful for setting timeouts etc. The default implementation does nothing. - * + * * @param exchange * @param request */ @@ -699,7 +709,7 @@ public class ProxyServlet implements Servlet /** * Extension point for subclasses to customize the Continuation after it's initial creation in the service method. Useful for setting timeouts etc. The * default implementation does nothing. - * + * * @param continuation */ protected void customizeContinuation(Continuation continuation) @@ -710,7 +720,7 @@ public class ProxyServlet implements Servlet /** * Extension point for custom handling of an HttpExchange's onConnectionFailed method. The default implementation delegates to * {@link #handleOnException(Throwable, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)} - * + * * @param ex * @param request * @param response @@ -723,7 +733,7 @@ public class ProxyServlet implements Servlet /** * Extension point for custom handling of an HttpExchange's onException method. The default implementation sets the response status to * HttpServletResponse.SC_INTERNAL_SERVER_ERROR (503) - * + * * @param ex * @param request * @param response @@ -741,7 +751,7 @@ public class ProxyServlet implements Servlet /** * Extension point for custom handling of an HttpExchange's onExpire method. The default implementation sets the response status to * HttpServletResponse.SC_GATEWAY_TIMEOUT (504) - * + * * @param request * @param response */ @@ -755,7 +765,7 @@ public class ProxyServlet implements Servlet /** * Transparent Proxy. - * + * * This convenience extension to ProxyServlet configures the servlet as a transparent proxy. The servlet is configured with init parameters: *
      *
    • ProxyTo - a URI like http://host:80/context to which the request is proxied. @@ -763,7 +773,7 @@ public class ProxyServlet implements Servlet *
    * For example, if a request was received at /foo/bar and the ProxyTo was http://host:80/context and the Prefix was /foo, then the request would be proxied * to http://host:80/context/bar - * + * */ public static class Transparent extends ProxyServlet { From 2fa5a63f3c50ce1295477d226af59c025da47ccb Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Thu, 5 Jan 2012 17:41:09 +0100 Subject: [PATCH 38/92] 365048: Fix proxy issue. http-client dropped authentication header on connect requests before Signed-off-by: Simone Bordet --- .../jetty/client/AbstractHttpConnection.java | 28 +++-- .../client/HttpsProxyAuthenticationTest.java | 116 ++++++++++++++++++ 2 files changed, 131 insertions(+), 13 deletions(-) create mode 100644 jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java index a032b38b17b..4f736343cd8 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java @@ -180,20 +180,22 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen String method=_exchange.getMethod(); String uri = _exchange.getRequestURI(); - if (_destination.isProxied() && !HttpMethods.CONNECT.equals(method) && uri.startsWith("/")) + if (_destination.isProxied()) { - boolean secure = _destination.isSecure(); - String host = _destination.getAddress().getHost(); - int port = _destination.getAddress().getPort(); - StringBuilder absoluteURI = new StringBuilder(); - absoluteURI.append(secure ? HttpSchemes.HTTPS : HttpSchemes.HTTP); - absoluteURI.append("://"); - absoluteURI.append(host); - // Avoid adding default ports - if (!(secure && port == 443 || !secure && port == 80)) - absoluteURI.append(":").append(port); - absoluteURI.append(uri); - uri = absoluteURI.toString(); + if(!HttpMethods.CONNECT.equals(method) && uri.startsWith("/")){ + boolean secure = _destination.isSecure(); + String host = _destination.getAddress().getHost(); + int port = _destination.getAddress().getPort(); + StringBuilder absoluteURI = new StringBuilder(); + absoluteURI.append(secure ? HttpSchemes.HTTPS : HttpSchemes.HTTP); + absoluteURI.append("://"); + absoluteURI.append(host); + // Avoid adding default ports + if (!(secure && port == 443 || !secure && port == 80)) + absoluteURI.append(":").append(port); + absoluteURI.append(uri); + uri = absoluteURI.toString(); + } Authentication auth = _destination.getProxyAuthentication(); if (auth != null) auth.setCredentials(_exchange); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java new file mode 100644 index 00000000000..4b28b88b673 --- /dev/null +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java @@ -0,0 +1,116 @@ +// ======================================================================== +// Copyright (c) 2009-2009 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.client; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.client.security.Authentication; +import org.eclipse.jetty.client.security.BasicAuthentication; +import org.eclipse.jetty.client.security.Realm; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.ConnectHandler; +import org.eclipse.jetty.server.nio.SelectChannelConnector; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/* ------------------------------------------------------------ */ +/** + * This UnitTest class executes two tests. Both will send a http request to https://google.com through a misbehaving proxy server. + *

    + * The first test runs against a proxy which simply closes the connection (as nginx does) for a connect request. The second proxy server always responds with a + * 500 error. + *

    + * The expected result for both tests is an exception and the HttpExchange should have status HttpExchange.STATUS_EXCEPTED. + */ +public class HttpsProxyAuthenticationTest +{ + private Server _proxy = new Server(); + private HttpClient _client = new HttpClient(); + private boolean authHandlerSend; + + @Before + public void init() throws Exception + { + // setup proxies with different behaviour + _proxy.addConnector(new SelectChannelConnector()); + _proxy.setHandler(new ConnectHandler() + { + @Override + protected boolean handleAuthentication(HttpServletRequest request, HttpServletResponse response, String address) throws ServletException, + IOException + { + if(!request.getHeader("Authorization").isEmpty()){ + authHandlerSend = true; + } + return super.handleAuthentication(request,response,address); + } + }); + _proxy.start(); + int proxyPort = _proxy.getConnectors()[0].getLocalPort(); + + Authentication authentication = new BasicAuthentication(new Realm() + { + public String getId() + { + return "MyRealm"; + } + + public String getPrincipal() + { + return "jetty"; + } + + public String getCredentials() + { + return "jetty"; + } + }); + + _client.setProxy(new Address("localhost",proxyPort)); + _client.setProxyAuthentication(authentication); + _client.start(); + } + + @After + public void destroy() throws Exception + { + _client.stop(); + _proxy.stop(); + } + + @Test + public void httpsViaProxyThatReturns504ErrorTest() throws Exception + { + sendRequestThroughProxy(new ContentExchange(),"google",7); + assertTrue("Authorization header not set!",authHandlerSend); + } + + private void sendRequestThroughProxy(HttpExchange exchange, String desiredBehaviour, int exptectedStatus) throws Exception + { + String url = "https://" + desiredBehaviour + ".com/"; + exchange.setURL(url); + exchange.addRequestHeader("behaviour",desiredBehaviour); + _client.send(exchange); + assertEquals(HttpExchange.toState(exptectedStatus) + " status awaited",exptectedStatus,exchange.waitForDone()); + } + +} From 69675d4d19ce61e18040abaf1ac107703eeff878 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 6 Jan 2012 16:19:05 +0100 Subject: [PATCH 39/92] 365048 - jetty Http client does not send proxy authentication when requesting a Https-resource through a web-proxy. --- .../jetty/client/AbstractHttpConnection.java | 5 +- .../client/HttpsProxyAuthenticationTest.java | 63 ++++++++++--------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java index 4f736343cd8..51a4b53560c 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java @@ -180,9 +180,10 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen String method=_exchange.getMethod(); String uri = _exchange.getRequestURI(); - if (_destination.isProxied()) + if (_destination.isProxied()) { - if(!HttpMethods.CONNECT.equals(method) && uri.startsWith("/")){ + if (!HttpMethods.CONNECT.equals(method) && uri.startsWith("/")) + { boolean secure = _destination.isSecure(); String host = _destination.getAddress().getHost(); int port = _destination.getAddress().getPort(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java index 4b28b88b673..9076f054291 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java @@ -13,11 +13,9 @@ package org.eclipse.jetty.client; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.IOException; - +import java.net.InetSocketAddress; +import java.net.Socket; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -29,18 +27,11 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.ConnectHandler; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; import org.junit.Test; -/* ------------------------------------------------------------ */ -/** - * This UnitTest class executes two tests. Both will send a http request to https://google.com through a misbehaving proxy server. - *

    - * The first test runs against a proxy which simply closes the connection (as nginx does) for a connect request. The second proxy server always responds with a - * 500 error. - *

    - * The expected result for both tests is an exception and the HttpExchange should have status HttpExchange.STATUS_EXCEPTED. - */ public class HttpsProxyAuthenticationTest { private Server _proxy = new Server(); @@ -50,22 +41,20 @@ public class HttpsProxyAuthenticationTest @Before public void init() throws Exception { - // setup proxies with different behaviour - _proxy.addConnector(new SelectChannelConnector()); + SelectChannelConnector connector = new SelectChannelConnector(); + _proxy.addConnector(connector); _proxy.setHandler(new ConnectHandler() { @Override - protected boolean handleAuthentication(HttpServletRequest request, HttpServletResponse response, String address) throws ServletException, - IOException + protected boolean handleAuthentication(HttpServletRequest request, HttpServletResponse response, String address) throws ServletException, IOException { - if(!request.getHeader("Authorization").isEmpty()){ + if (!request.getHeader("Authorization").isEmpty()) authHandlerSend = true; - } return super.handleAuthentication(request,response,address); } }); _proxy.start(); - int proxyPort = _proxy.getConnectors()[0].getLocalPort(); + int proxyPort = connector.getLocalPort(); Authentication authentication = new BasicAuthentication(new Realm() { @@ -85,7 +74,7 @@ public class HttpsProxyAuthenticationTest } }); - _client.setProxy(new Address("localhost",proxyPort)); + _client.setProxy(new Address("localhost", proxyPort)); _client.setProxyAuthentication(authentication); _client.start(); } @@ -95,22 +84,34 @@ public class HttpsProxyAuthenticationTest { _client.stop(); _proxy.stop(); + _proxy.join(); } @Test public void httpsViaProxyThatReturns504ErrorTest() throws Exception { - sendRequestThroughProxy(new ContentExchange(),"google",7); - assertTrue("Authorization header not set!",authHandlerSend); - } + // Assume that we can connect to google + String host = "google.com"; + int port = 443; + Socket socket = new Socket(); + try + { + socket.connect(new InetSocketAddress(host, port), 1000); + } + catch (IOException x) + { + Assume.assumeNoException(x); + } + finally + { + socket.close(); + } - private void sendRequestThroughProxy(HttpExchange exchange, String desiredBehaviour, int exptectedStatus) throws Exception - { - String url = "https://" + desiredBehaviour + ".com/"; - exchange.setURL(url); - exchange.addRequestHeader("behaviour",desiredBehaviour); + HttpExchange exchange = new ContentExchange(); + exchange.setURL("https://" + host + ":" + port); + exchange.addRequestHeader("behaviour", "google"); _client.send(exchange); - assertEquals(HttpExchange.toState(exptectedStatus) + " status awaited",exptectedStatus,exchange.waitForDone()); + Assert.assertEquals(HttpExchange.STATUS_COMPLETED, exchange.waitForDone()); + Assert.assertTrue("Authorization header not set!", authHandlerSend); } - } From 588b068c06235c23a391a7f17f8857eaccf09ba3 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 9 Jan 2012 08:53:19 +1100 Subject: [PATCH 40/92] replaced break in finally with progres=false --- .../java/org/eclipse/jetty/server/AsyncHttpConnection.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index 031ad11e8d0..0f68b4ed6ba 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -126,10 +126,10 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async } else if (_request.getAsyncContinuation().isAsyncStarted()) { - // The request is suspended, so even though progress has been made, break the while loop + // The request is suspended, so even though progress has been made, + // exit the while loop by setting progress to false LOG.debug("suspended {}",this); - // TODO: breaking inside finally blocks is bad: rethink how we should exit from here - break; + progress=false; } } } From 6e3c8094f197bea369fc07d92e7be4ddd80cd326 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 9 Jan 2012 11:07:41 +1100 Subject: [PATCH 41/92] 368112 NPE on element parsing web.xml --- .../org/eclipse/jetty/webapp/StandardDescriptorProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java index 16e9eb91af8..452bbb077ec 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java @@ -1254,7 +1254,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor context.setResourceAlias(uri, location); - JspConfig config = (JspConfig)context.getServletHandler().getServletContext().getJspConfigDescriptor(); + JspConfig config = (JspConfig)context.getServletContext().getJspConfigDescriptor(); if (config == null) { config = new JspConfig(); From 90e9358ea5f62b78f1b11fe607b333b500373cb3 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 9 Jan 2012 11:16:30 +1100 Subject: [PATCH 42/92] 367716 simplified maxIdleTime logic --- .../main/java/org/eclipse/jetty/server/AsyncContinuation.java | 3 --- .../java/org/eclipse/jetty/server/AsyncHttpConnection.java | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java index f9846745e69..9ed4119c936 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java @@ -185,9 +185,6 @@ public class AsyncContinuation implements AsyncContext, Continuation } /* ------------------------------------------------------------ */ - /* (non-Javadoc) - * @see javax.servlet.ServletRequest#isSuspended() - */ public boolean isSuspending() { synchronized(this) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index 0f68b4ed6ba..59e66626e69 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -146,7 +146,8 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async _generator.returnBuffers(); } - if (_request.getAsyncContinuation().isComplete() || _request.getAsyncContinuation().isInitial()) + // reenable idle checking unless request is suspended + if(!_request.getAsyncContinuation().isAsyncStarted()) { _asyncEndp.setCheckForIdle(true); } From 48438dc914631dbcbdead46ae3076e4d627ef0c0 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Mon, 2 Jan 2012 17:50:57 +0100 Subject: [PATCH 43/92] 367635: Add test for parsing start.d files, small changes --- .../java/org/eclipse/jetty/start/Main.java | 45 ++++++++++--------- .../org/eclipse/jetty/start/usage.txt | 16 ++++--- .../org/eclipse/jetty/start/MainTest.java | 15 ++++--- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index c42b93d7106..6275baab2d2 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -123,30 +123,35 @@ public class Main // if no non-option inis, add the start.ini and start.d if (!ini) { - List ini_args=new ArrayList(); - File start_ini = new File(_jettyHome,"start.ini"); - if (start_ini.exists()) - ini_args.addAll(loadStartIni(start_ini)); - - File start_d = new File(_jettyHome,"start.d"); - if (start_d.isDirectory()) - { - File[] inis = start_d.listFiles(new FilenameFilter() - { - public boolean accept(File dir, String name) - { - return name.toLowerCase().endsWith(".ini"); - } - }); - Arrays.sort(inis); - for (File i : inis) - ini_args.addAll(loadStartIni(i)); - } - arguments.addAll(0,ini_args); + arguments.addAll(0,parseStartIniFiles()); } return arguments; } + + List parseStartIniFiles() + { + List ini_args=new ArrayList(); + File start_ini = new File(_jettyHome,"start.ini"); + if (start_ini.exists()) + ini_args.addAll(loadStartIni(start_ini)); + + File start_d = new File(_jettyHome,"start.d"); + if (start_d.isDirectory()) + { + File[] inis = start_d.listFiles(new FilenameFilter() + { + public boolean accept(File dir, String name) + { + return name.toLowerCase().endsWith(".ini"); + } + }); + Arrays.sort(inis); + for (File i : inis) + ini_args.addAll(loadStartIni(i)); + } + return ini_args; + } public List processCommandLine(List arguments) throws Exception { diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt index c4c85c4523d..41b0107580e 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt @@ -20,7 +20,7 @@ Command Line Options: when the start.ini includes -X or -D arguments. --exec Run the generated command line (see --dry-run) in - a sub processes. This can be used when start.ini + a sub process. This can be used when start.ini contains -X or -D arguments, but creates an extra JVM instance. @@ -36,8 +36,10 @@ Command Line Options: --ini= Load command line arguments from a file. If no --ini options are specified, then the - start.ini file will be read if it exists. - A --ini option with no file indicates that + start.ini file will be read if it exists in + jetty.home. If specified jetty.home/start.ini + and additional .ini files in jetty.home/start.d/ + will NOT be read. A --ini option with no file indicates that start.ini should not be read. --pre= Specify a configuration file that is to be processed @@ -116,10 +118,10 @@ Available Configurations: Defaults: A start.ini file may be used to specify default arguments to start.jar, which are used if no command line arguments are provided and override - the defaults in the start.config file. If the directory start.d exists, - then multiple *.ini files will be read from that directory in alphabetical - order. If --ini options are provided on the command line, then start.ini - and start.d will not be read. + the defaults in the start.config file. If the directory jetty.home/start.d + exists, then multiple *.ini files will be read from that directory in + alphabetical order. If --ini options are provided on the command line, + then start.ini and start.d will NOT be read. The current start.ini arguments are: diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java index 246771b4da6..8e2f1f071bb 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java @@ -15,7 +15,7 @@ package org.eclipse.jetty.start; import static org.junit.Assert.assertEquals; -import java.io.File; +import java.io.IOException; import java.net.URL; import java.util.List; @@ -39,15 +39,18 @@ public class MainTest /** * Test method for {@link org.eclipse.jetty.start.StartIniParser#loadStartIni(java.lang.String)}. + * @throws IOException */ @Test - public void testLoadStartIni() + public void testLoadStartIni() throws IOException { - URL startIni = this.getClass().getResource("/jetty.home/start.ini"); - String startIniFileName = startIni.getFile(); - List args = Main.loadStartIni(new File(startIniFileName)); - assertEquals("Expected 5 uncommented lines in start.ini",5,args.size()); + URL startIni = this.getClass().getResource("/jetty.home/"); + System.setProperty("jetty.home",startIni.getFile()); + Main main = new Main(); + List args = main.parseStartIniFiles(); + assertEquals("Expected 5 uncommented lines in start.ini",9,args.size()); assertEquals("First uncommented line in start.ini doesn't match expected result","OPTIONS=Server,jsp,resources,websocket,ext",args.get(0)); + assertEquals("Last uncommented line in start.ini doesn't match expected result","etc/jetty-testrealm.xml",args.get(8)); } @Test From 58c57a9ea0288acf80e52b85e35349811d88fb5a Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 9 Jan 2012 11:24:25 +1100 Subject: [PATCH 44/92] 367635: report errors --- jetty-start/src/main/java/org/eclipse/jetty/start/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 6275baab2d2..69112f8f319 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -1080,7 +1080,7 @@ public class Main } catch (IOException e) { - // usageExit(e,ERR_UNKNOWN); + usageExit(e,ERR_UNKNOWN); } finally { From bbaef55bd61811c9adc4cb21d4c1b42a3c02e999 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Fri, 6 Jan 2012 14:52:22 +0100 Subject: [PATCH 45/92] 366774: Request.java code format --- .../org/eclipse/jetty/server/Request.java | 1065 +++++++++-------- 1 file changed, 535 insertions(+), 530 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 4fc8c5934d5..7a54b62706d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -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; @@ -72,62 +72,55 @@ import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ -/** Jetty Request. +/** + * Jetty Request. *

    * Implements {@link javax.servlet.http.HttpServletRequest} from the javax.servlet.http package. *

    *

    - * The standard interface of mostly getters, - * is extended with setters so that the request is mutable by the handlers that it is - * passed to. This allows the request object to be as lightweight as possible and not - * actually implement any significant behavior. For example

      - * - *
    • The {@link Request#getContextPath()} method will return null, until the request has been - * passed to a {@link ContextHandler} which matches the {@link Request#getPathInfo()} with a context - * path and calls {@link Request#setContextPath(String)} as a result.
    • - * - *
    • the HTTP session methods - * will all return null sessions until such time as a request has been passed to - * a {@link org.eclipse.jetty.server.session.SessionHandler} which checks for session cookies - * and enables the ability to create new sessions.
    • - * - *
    • The {@link Request#getServletPath()} method will return null until the request has been - * passed to a org.eclipse.jetty.servlet.ServletHandler and the pathInfo matched - * against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.
    • + * The standard interface of mostly getters, is extended with setters so that the request is mutable by the handlers that it is passed to. This allows the + * request object to be as lightweight as possible and not actually implement any significant behavior. For example + *
        + * + *
      • The {@link Request#getContextPath()} method will return null, until the request has been passed to a {@link ContextHandler} which matches the + * {@link Request#getPathInfo()} with a context path and calls {@link Request#setContextPath(String)} as a result.
      • + * + *
      • the HTTP session methods will all return null sessions until such time as a request has been passed to a + * {@link org.eclipse.jetty.server.session.SessionHandler} which checks for session cookies and enables the ability to create new sessions.
      • + * + *
      • The {@link Request#getServletPath()} method will return null until the request has been passed to a org.eclipse.jetty.servlet.ServletHandler + * and the pathInfo matched against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.
      • *
      - * - * A request instance is created for each {@link AbstractHttpConnection} accepted by the server - * and recycled for each HTTP request received via that connection. An effort is made - * to avoid reparsing headers and cookies that are likely to be the same for - * requests from the same connection. - * + * + * A request instance is created for each {@link AbstractHttpConnection} accepted by the server and recycled for each HTTP request received via that connection. + * An effort is made to avoid reparsing headers and cookies that are likely to be the same for requests from the same connection. + * *

      - * The form content that a request can process is limited to protect from Denial of Service - * attacks. The size in bytes is limited by {@link ContextHandler#getMaxFormContentSize()} or if there is no - * context then the "org.eclipse.jetty.server.Request.maxFormContentSize" {@link Server} attribute. - * The number of parameters keys is limited by {@link ContextHandler#getMaxFormKeys()} or if there is no - * context then the "org.eclipse.jetty.server.Request.maxFormKeys" {@link Server} attribute. - * - * + * The form content that a request can process is limited to protect from Denial of Service attacks. The size in bytes is limited by + * {@link ContextHandler#getMaxFormContentSize()} or if there is no context then the "org.eclipse.jetty.server.Request.maxFormContentSize" {@link Server} + * attribute. The number of parameters keys is limited by {@link ContextHandler#getMaxFormKeys()} or if there is no context then the + * "org.eclipse.jetty.server.Request.maxFormKeys" {@link Server} attribute. + * + * */ public class Request implements HttpServletRequest { private static final Logger LOG = Log.getLogger(Request.class); - private static final String __ASYNC_FWD="org.eclipse.asyncfwd"; + private static final String __ASYNC_FWD = "org.eclipse.asyncfwd"; private static final Collection __defaultLocale = Collections.singleton(Locale.getDefault()); - private static final int __NONE=0, _STREAM=1, __READER=2; + private static final int __NONE = 0, _STREAM = 1, __READER = 2; /* ------------------------------------------------------------ */ public static Request getRequest(HttpServletRequest request) { if (request instanceof Request) - return (Request) request; + return (Request)request; return AbstractHttpConnection.getCurrentConnection().getRequest(); } protected final AsyncContinuation _async = new AsyncContinuation(); - private boolean _asyncSupported=true; + private boolean _asyncSupported = true; private volatile Attributes _attributes; private Authentication _authentication; private MultiMap _baseParameters; @@ -137,18 +130,18 @@ public class Request implements HttpServletRequest private boolean _newContext; private String _contextPath; private CookieCutter _cookies; - private boolean _cookiesExtracted=false; + private boolean _cookiesExtracted = false; private DispatcherType _dispatcherType; - private boolean _dns=false; + private boolean _dns = false; private EndPoint _endp; - private boolean _handled =false; - private int _inputState=__NONE; + private boolean _handled = false; + private int _inputState = __NONE; private String _method; private MultiMap _parameters; private boolean _paramsExtracted; private String _pathInfo; private int _port; - private String _protocol=HttpVersions.HTTP_1_1; + private String _protocol = HttpVersions.HTTP_1_1; private String _queryEncoding; private String _queryString; private BufferedReader _reader; @@ -157,10 +150,10 @@ public class Request implements HttpServletRequest private String _remoteHost; private Object _requestAttributeListeners; private String _requestedSessionId; - private boolean _requestedSessionIdFromCookie=false; + private boolean _requestedSessionIdFromCookie = false; private String _requestURI; - private Map _savedNewSessions; - private String _scheme=URIUtil.HTTP; + private Map _savedNewSessions; + private String _scheme = URIUtil.HTTP; private UserIdentity.Scope _scope; private String _serverName; private String _servletPath; @@ -168,10 +161,10 @@ public class Request implements HttpServletRequest private SessionManager _sessionManager; private long _timeStamp; private long _dispatchTime; - + private Buffer _timeStampBuffer; private HttpURI _uri; - + /* ------------------------------------------------------------ */ public Request() { @@ -184,10 +177,10 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - public void addEventListener(final EventListener listener) + public void addEventListener(final EventListener listener) { if (listener instanceof ServletRequestAttributeListener) - _requestAttributeListeners= LazyList.add(_requestAttributeListeners, listener); + _requestAttributeListeners = LazyList.add(_requestAttributeListeners,listener); if (listener instanceof ContinuationListener) throw new IllegalArgumentException(); } @@ -198,13 +191,13 @@ public class Request implements HttpServletRequest */ public void extractParameters() { - if (_baseParameters == null) + if (_baseParameters == null) _baseParameters = new MultiMap(16); - if (_paramsExtracted) + if (_paramsExtracted) { - if (_parameters==null) - _parameters=_baseParameters; + if (_parameters == null) + _parameters = _baseParameters; return; } @@ -213,9 +206,9 @@ public class Request implements HttpServletRequest try { // Handle query string - if (_uri!=null && _uri.hasQuery()) + if (_uri != null && _uri.hasQuery()) { - if (_queryEncoding==null) + if (_queryEncoding == null) _uri.decodeQueryTo(_baseParameters); else { @@ -238,40 +231,41 @@ public class Request implements HttpServletRequest String content_type = getContentType(); if (content_type != null && content_type.length() > 0) { - content_type = HttpFields.valueParameters(content_type, null); - - if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(content_type) && _inputState==__NONE && - (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod()))) + content_type = HttpFields.valueParameters(content_type,null); + + if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(content_type) && _inputState == __NONE + && (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod()))) { int content_length = getContentLength(); if (content_length != 0) { try { - int maxFormContentSize=-1; - int maxFormKeys=-1; + int maxFormContentSize = -1; + int maxFormKeys = -1; - if (_context!=null) + if (_context != null) { - maxFormContentSize=_context.getContextHandler().getMaxFormContentSize(); - maxFormKeys=_context.getContextHandler().getMaxFormKeys(); + maxFormContentSize = _context.getContextHandler().getMaxFormContentSize(); + maxFormKeys = _context.getContextHandler().getMaxFormKeys(); } else { - Number size = (Number)_connection.getConnector().getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormContentSize"); - maxFormContentSize=size==null?200000:size.intValue(); + Number size = (Number)_connection.getConnector().getServer() + .getAttribute("org.eclipse.jetty.server.Request.maxFormContentSize"); + maxFormContentSize = size == null?200000:size.intValue(); Number keys = (Number)_connection.getConnector().getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormKeys"); - maxFormKeys =keys==null?1000:keys.intValue(); + maxFormKeys = keys == null?1000:keys.intValue(); } - - if (content_length>maxFormContentSize && maxFormContentSize > 0) + + if (content_length > maxFormContentSize && maxFormContentSize > 0) { - throw new IllegalStateException("Form too large"+content_length+">"+maxFormContentSize); + throw new IllegalStateException("Form too large" + content_length + ">" + maxFormContentSize); } InputStream in = getInputStream(); // Add form params to query params - UrlEncoded.decodeTo(in, _baseParameters, encoding,content_length<0?maxFormContentSize:-1,maxFormKeys); + UrlEncoded.decodeTo(in,_baseParameters,encoding,content_length < 0?maxFormContentSize:-1,maxFormKeys); } catch (IOException e) { @@ -284,31 +278,30 @@ public class Request implements HttpServletRequest } } - if (_parameters==null) - _parameters=_baseParameters; - else if (_parameters!=_baseParameters) + if (_parameters == null) + _parameters = _baseParameters; + else if (_parameters != _baseParameters) { // Merge parameters (needed if parameters extracted after a forward). Iterator iter = _baseParameters.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); - String name=(String)entry.getKey(); - Object values=entry.getValue(); - for (int i=0;inull if {@link #setContext} has not yet - * been called. + * @return The current {@link Context context} used for this request, or null if {@link #setContext} has not yet been called. */ public Context getContext() { @@ -438,7 +432,7 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getContextPath() */ public String getContextPath() @@ -447,23 +441,23 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getCookies() */ public Cookie[] getCookies() { - if (_cookiesExtracted) - return _cookies==null?null:_cookies.getCookies(); + if (_cookiesExtracted) + return _cookies == null?null:_cookies.getCookies(); _cookiesExtracted = true; - + Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.COOKIE_BUFFER); - + // Handle no cookies - if (enm!=null) + if (enm != null) { - if (_cookies==null) - _cookies=new CookieCutter(); + if (_cookies == null) + _cookies = new CookieCutter(); while (enm.hasMoreElements()) { @@ -472,11 +466,11 @@ public class Request implements HttpServletRequest } } - return _cookies==null?null:_cookies.getCookies(); + return _cookies == null?null:_cookies.getCookies(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getDateHeader(java.lang.String) */ public long getDateHeader(String name) @@ -487,11 +481,11 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ public DispatcherType getDispatcherType() { - return _dispatcherType; + return _dispatcherType; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getHeader(java.lang.String) */ public String getHeader(String name) @@ -500,7 +494,7 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getHeaderNames() */ public Enumeration getHeaderNames() @@ -509,13 +503,13 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getHeaders(java.lang.String) */ public Enumeration getHeaders(String name) { Enumeration e = _connection.getRequestFields().getValues(name); - if (e==null) + if (e == null) return Collections.enumeration(Collections.EMPTY_LIST); return e; } @@ -530,19 +524,19 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getInputStream() */ public ServletInputStream getInputStream() throws IOException { - if (_inputState!=__NONE && _inputState!=_STREAM) + if (_inputState != __NONE && _inputState != _STREAM) throw new IllegalStateException("READER"); - _inputState=_STREAM; + _inputState = _STREAM; return _connection.getInputStream(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getIntHeader(java.lang.String) */ public int getIntHeader(String name) @@ -551,37 +545,37 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocalAddr() */ public String getLocalAddr() { - return _endp==null?null:_endp.getLocalAddr(); + return _endp == null?null:_endp.getLocalAddr(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocale() */ public Locale getLocale() { - Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE, HttpFields.__separators); - + Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE,HttpFields.__separators); + // handle no locale if (enm == null || !enm.hasMoreElements()) return Locale.getDefault(); - + // sort the list in quality order List acceptLanguage = HttpFields.qualityList(enm); - if (acceptLanguage.size()==0) - return Locale.getDefault(); - - int size=acceptLanguage.size(); + if (acceptLanguage.size() == 0) + return Locale.getDefault(); - if (size>0) + int size = acceptLanguage.size(); + + if (size > 0) { String language = (String)acceptLanguage.get(0); - language=HttpFields.valueParameters(language,null); + language = HttpFields.valueParameters(language,null); String country = ""; int dash = language.indexOf('-'); if (dash > -1) @@ -591,38 +585,37 @@ public class Request implements HttpServletRequest } return new Locale(language,country); } - - return Locale.getDefault(); + + return Locale.getDefault(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocales() */ public Enumeration getLocales() { - Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE, HttpFields.__separators); - + Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE,HttpFields.__separators); + // handle no locale if (enm == null || !enm.hasMoreElements()) return Collections.enumeration(__defaultLocale); - + // sort the list in quality order List acceptLanguage = HttpFields.qualityList(enm); - - if (acceptLanguage.size()==0) - return - Collections.enumeration(__defaultLocale); - + + if (acceptLanguage.size() == 0) + return Collections.enumeration(__defaultLocale); + Object langs = null; - int size=acceptLanguage.size(); - + int size = acceptLanguage.size(); + // convert to locals - for (int i=0; i -1) @@ -630,44 +623,44 @@ public class Request implements HttpServletRequest country = language.substring(dash + 1).trim(); language = language.substring(0,dash).trim(); } - langs=LazyList.ensureSize(langs,size); - langs=LazyList.add(langs,new Locale(language,country)); + langs = LazyList.ensureSize(langs,size); + langs = LazyList.add(langs,new Locale(language,country)); } - - if (LazyList.size(langs)==0) + + if (LazyList.size(langs) == 0) return Collections.enumeration(__defaultLocale); - + return Collections.enumeration(LazyList.getList(langs)); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocalName() */ public String getLocalName() { - if (_endp==null) + if (_endp == null) return null; if (_dns) return _endp.getLocalHost(); - + String local = _endp.getLocalAddr(); - if (local!=null && local.indexOf(':')>=0) - local="["+local+"]"; + if (local != null && local.indexOf(':') >= 0) + local = "[" + local + "]"; return local; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocalPort() */ public int getLocalPort() { - return _endp==null?0:_endp.getLocalPort(); + return _endp == null?0:_endp.getLocalPort(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getMethod() */ public String getMethod() @@ -676,35 +669,35 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getParameter(java.lang.String) */ public String getParameter(String name) { - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); - return (String) _parameters.getValue(name, 0); + return (String)_parameters.getValue(name,0); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getParameterMap() */ public Map getParameterMap() { - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); - + return Collections.unmodifiableMap(_parameters.toStringArrayMap()); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getParameterNames() */ public Enumeration getParameterNames() { - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); return Collections.enumeration(_parameters.keySet()); } @@ -719,21 +712,21 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getParameterValues(java.lang.String) */ public String[] getParameterValues(String name) { - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); List vals = _parameters.getValues(name); - if (vals==null) + if (vals == null) return null; - return (String[])vals.toArray(new String[vals.size()]); + return vals.toArray(new String[vals.size()]); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getPathInfo() */ public String getPathInfo() @@ -742,18 +735,18 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getPathTranslated() */ public String getPathTranslated() { - if (_pathInfo==null || _context==null) + if (_pathInfo == null || _context == null) return null; return _context.getRealPath(_pathInfo); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getProtocol() */ public String getProtocol() @@ -768,78 +761,78 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getQueryString() */ public String getQueryString() { - if (_queryString==null && _uri!=null) + if (_queryString == null && _uri != null) { - if (_queryEncoding==null) - _queryString=_uri.getQuery(); + if (_queryEncoding == null) + _queryString = _uri.getQuery(); else - _queryString=_uri.getQuery(_queryEncoding); + _queryString = _uri.getQuery(_queryEncoding); } return _queryString; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getReader() */ public BufferedReader getReader() throws IOException { - if (_inputState!=__NONE && _inputState!=__READER) + if (_inputState != __NONE && _inputState != __READER) throw new IllegalStateException("STREAMED"); - if (_inputState==__READER) + if (_inputState == __READER) return _reader; - - String encoding=getCharacterEncoding(); - if (encoding==null) - encoding=StringUtil.__ISO_8859_1; - - if (_reader==null || !encoding.equalsIgnoreCase(_readerEncoding)) + + String encoding = getCharacterEncoding(); + if (encoding == null) + encoding = StringUtil.__ISO_8859_1; + + if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding)) { final ServletInputStream in = getInputStream(); - _readerEncoding=encoding; - _reader=new BufferedReader(new InputStreamReader(in,encoding)) + _readerEncoding = encoding; + _reader = new BufferedReader(new InputStreamReader(in,encoding)) { @Override public void close() throws IOException { in.close(); - } + } }; } - _inputState=__READER; + _inputState = __READER; return _reader; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRealPath(java.lang.String) */ public String getRealPath(String path) { - if (_context==null) + if (_context == null) return null; return _context.getRealPath(path); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRemoteAddr() */ public String getRemoteAddr() { if (_remoteAddr != null) - return _remoteAddr; - return _endp==null?null:_endp.getRemoteAddr(); + return _remoteAddr; + return _endp == null?null:_endp.getRemoteAddr(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRemoteHost() */ public String getRemoteHost() @@ -850,58 +843,58 @@ public class Request implements HttpServletRequest { return _remoteHost; } - return _endp==null?null:_endp.getRemoteHost(); + return _endp == null?null:_endp.getRemoteHost(); } return getRemoteAddr(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRemotePort() */ public int getRemotePort() { - return _endp==null?0:_endp.getRemotePort(); + return _endp == null?0:_endp.getRemotePort(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getRemoteUser() */ public String getRemoteUser() { Principal p = getUserPrincipal(); - if (p==null) + if (p == null) return null; return p.getName(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRequestDispatcher(java.lang.String) */ public RequestDispatcher getRequestDispatcher(String path) { - if (path == null || _context==null) + if (path == null || _context == null) return null; // handle relative path if (!path.startsWith("/")) { - String relTo=URIUtil.addPaths(_servletPath,_pathInfo); - int slash=relTo.lastIndexOf("/"); - if (slash>1) - relTo=relTo.substring(0,slash+1); + String relTo = URIUtil.addPaths(_servletPath,_pathInfo); + int slash = relTo.lastIndexOf("/"); + if (slash > 1) + relTo = relTo.substring(0,slash + 1); else - relTo="/"; - path=URIUtil.addPaths(relTo,path); + relTo = "/"; + path = URIUtil.addPaths(relTo,path); } - + return _context.getRequestDispatcher(path); } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getRequestedSessionId() */ public String getRequestedSessionId() @@ -910,18 +903,18 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getRequestURI() */ public String getRequestURI() { - if (_requestURI==null && _uri!=null) - _requestURI=_uri.getPathAndParam(); + if (_requestURI == null && _uri != null) + _requestURI = _uri.getPathAndParam(); return _requestURI; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getRequestURL() */ public StringBuffer getRequestURL() @@ -935,14 +928,12 @@ public class Request implements HttpServletRequest url.append(scheme); url.append("://"); url.append(getServerName()); - if (_port>0 && - ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || - (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443))) + if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443))) { url.append(':'); url.append(_port); } - + url.append(getRequestURI()); return url; } @@ -953,17 +944,16 @@ public class Request implements HttpServletRequest { return _connection._response; } - + /* ------------------------------------------------------------ */ /** - * Reconstructs the URL the client used to make the request. The returned URL contains a - * protocol, server name, port number, and, but it does not include a path. + * Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and, but it does not include a + * path. *

      - * Because this method returns a StringBuffer, not a string, you can modify the - * URL easily, for example, to append path and query parameters. - * + * Because this method returns a StringBuffer, not a string, you can modify the URL easily, for example, to append path and query parameters. + * * This method is useful for creating redirect messages and for reporting errors. - * + * * @return "scheme://host:port" */ public StringBuilder getRootURL() @@ -985,7 +975,7 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getScheme() */ public String getScheme() @@ -994,49 +984,48 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getServerName() */ public String getServerName() - { + { // Return already determined host - if (_serverName != null) + if (_serverName != null) return _serverName; - + if (_uri == null) throw new IllegalStateException("No uri"); // Return host from absolute URI _serverName = _uri.getHost(); _port = _uri.getPort(); - if (_serverName != null) + if (_serverName != null) return _serverName; // Return host from header field Buffer hostPort = _connection.getRequestFields().get(HttpHeaders.HOST_BUFFER); - if (hostPort!=null) + if (hostPort != null) { - loop: - for (int i=hostPort.putIndex();i-->hostPort.getIndex();) + loop: for (int i = hostPort.putIndex(); i-- > hostPort.getIndex();) { - char ch=(char)(0xff&hostPort.peek(i)); - switch(ch) + char ch = (char)(0xff & hostPort.peek(i)); + switch (ch) { case ']': break loop; case ':': - _serverName=BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(), i-hostPort.getIndex())); - _port=BufferUtil.toInt(hostPort.peek(i+1, hostPort.putIndex()-i-1)); + _serverName = BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(),i - hostPort.getIndex())); + _port = BufferUtil.toInt(hostPort.peek(i + 1,hostPort.putIndex() - i - 1)); return _serverName; } } - if (_serverName==null || _port<0) + if (_serverName == null || _port < 0) { - _serverName=BufferUtil.to8859_1_String(hostPort); + _serverName = BufferUtil.to8859_1_String(hostPort); _port = 0; } - + return _serverName; } @@ -1045,7 +1034,7 @@ public class Request implements HttpServletRequest { _serverName = getLocalName(); _port = getLocalPort(); - if (_serverName != null && !StringUtil.ALL_INTERFACES.equals(_serverName)) + if (_serverName != null && !StringUtil.ALL_INTERFACES.equals(_serverName)) return _serverName; } @@ -1062,26 +1051,26 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getServerPort() */ public int getServerPort() { - if (_port<=0) + if (_port <= 0) { - if (_serverName==null) + if (_serverName == null) getServerName(); - - if (_port<=0) + + if (_port <= 0) { - if (_serverName!=null && _uri!=null) + if (_serverName != null && _uri != null) _port = _uri.getPort(); else - _port = _endp==null?0:_endp.getLocalPort(); + _port = _endp == null?0:_endp.getLocalPort(); } } - - if (_port<=0) + + if (_port <= 0) { if (getScheme().equalsIgnoreCase(URIUtil.HTTPS)) return 443; @@ -1097,23 +1086,23 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* */ public String getServletName() { - if (_scope!=null) + if (_scope != null) return _scope.getName(); return null; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getServletPath() */ public String getServletPath() { - if (_servletPath==null) - _servletPath=""; + if (_servletPath == null) + _servletPath = ""; return _servletPath; } @@ -1124,7 +1113,7 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getSession() */ public HttpSession getSession() @@ -1133,33 +1122,32 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getSession(boolean) */ public HttpSession getSession(boolean create) - { - if (_session != null ) + { + if (_session != null) { - if (_sessionManager!=null && !_sessionManager.isValid(_session)) - _session=null; + if (_sessionManager != null && !_sessionManager.isValid(_session)) + _session = null; else return _session; } - + if (!create) return null; - - if (_sessionManager==null) + + if (_sessionManager == null) throw new IllegalStateException("No SessionManager"); - _session=_sessionManager.newHttpSession(this); - HttpCookie cookie=_sessionManager.getSessionCookie(_session,getContextPath(),isSecure()); - if (cookie!=null) + _session = _sessionManager.newHttpSession(this); + HttpCookie cookie = _sessionManager.getSessionCookie(_session,getContextPath(),isSecure()); + if (cookie != null) _connection.getResponse().addCookie(cookie); - + return _session; } - /* ------------------------------------------------------------ */ /** @@ -1169,31 +1157,31 @@ public class Request implements HttpServletRequest { return _sessionManager; } - + /* ------------------------------------------------------------ */ /** * Get Request TimeStamp - * + * * @return The time that the request was received. */ public long getTimeStamp() { return _timeStamp; } - + /* ------------------------------------------------------------ */ /** * Get Request TimeStamp - * + * * @return The time that the request was received. */ public Buffer getTimeStampBuffer() { if (_timeStampBuffer == null && _timeStamp > 0) - _timeStampBuffer = HttpFields.__dateCache.formatBuffer(_timeStamp); + _timeStampBuffer = HttpFields.__dateCache.formatBuffer(_timeStamp); return _timeStampBuffer; } - + /* ------------------------------------------------------------ */ /** * @return Returns the uri. @@ -1208,7 +1196,7 @@ public class Request implements HttpServletRequest { if (_authentication instanceof Authentication.Deferred) setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); - + if (_authentication instanceof Authentication.User) return ((Authentication.User)_authentication).getUserIdentity(); return null; @@ -1216,9 +1204,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @return The resolved user Identity, which may be null if the - * {@link Authentication} is not {@link Authentication.User} - * (eg. {@link Authentication.Deferred}). + * @return The resolved user Identity, which may be null if the {@link Authentication} is not {@link Authentication.User} (eg. + * {@link Authentication.Deferred}). */ public UserIdentity getResolvedUserIdentity() { @@ -1226,22 +1213,22 @@ public class Request implements HttpServletRequest return ((Authentication.User)_authentication).getUserIdentity(); return null; } - + /* ------------------------------------------------------------ */ public UserIdentity.Scope getUserIdentityScope() { return _scope; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getUserPrincipal() */ public Principal getUserPrincipal() { if (_authentication instanceof Authentication.Deferred) setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); - + if (_authentication instanceof Authentication.User) { UserIdentity user = ((Authentication.User)_authentication).getUserIdentity(); @@ -1249,10 +1236,11 @@ public class Request implements HttpServletRequest } return null; } - + /* ------------------------------------------------------------ */ - /** Get timestamp of the request dispatch - * + /** + * Get timestamp of the request dispatch + * * @return timestamp */ public long getDispatchTime() @@ -1271,157 +1259,156 @@ public class Request implements HttpServletRequest { return _asyncSupported; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromCookie() */ public boolean isRequestedSessionIdFromCookie() { - return _requestedSessionId!=null && _requestedSessionIdFromCookie; + return _requestedSessionId != null && _requestedSessionIdFromCookie; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromUrl() */ public boolean isRequestedSessionIdFromUrl() { - return _requestedSessionId!=null && !_requestedSessionIdFromCookie; + return _requestedSessionId != null && !_requestedSessionIdFromCookie; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL() */ public boolean isRequestedSessionIdFromURL() { - return _requestedSessionId!=null && !_requestedSessionIdFromCookie; + return _requestedSessionId != null && !_requestedSessionIdFromCookie; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdValid() */ public boolean isRequestedSessionIdValid() - { - if (_requestedSessionId==null) + { + if (_requestedSessionId == null) return false; - - HttpSession session=getSession(false); + + HttpSession session = getSession(false); return (session != null && _sessionManager.getSessionIdManager().getClusterId(_requestedSessionId).equals(_sessionManager.getClusterId(session))); } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#isSecure() */ public boolean isSecure() { return _connection.isConfidential(this); } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isUserInRole(java.lang.String) */ public boolean isUserInRole(String role) { if (_authentication instanceof Authentication.Deferred) setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); - + if (_authentication instanceof Authentication.User) return ((Authentication.User)_authentication).isUserInRole(_scope,role); return false; } - + /* ------------------------------------------------------------ */ public HttpSession recoverNewSession(Object key) { - if (_savedNewSessions==null) + if (_savedNewSessions == null) return null; return _savedNewSessions.get(key); } - + /* ------------------------------------------------------------ */ protected void recycle() { - if (_inputState==__READER) + if (_inputState == __READER) { try { - int r=_reader.read(); - while(r!=-1) - r=_reader.read(); + int r = _reader.read(); + while (r != -1) + r = _reader.read(); } - catch(Exception e) + catch (Exception e) { LOG.ignore(e); - _reader=null; + _reader = null; } } - + setAuthentication(Authentication.NOT_CHECKED); - _async.recycle(); - _asyncSupported=true; - _handled=false; - if (_context!=null) + _async.recycle(); + _asyncSupported = true; + _handled = false; + if (_context != null) throw new IllegalStateException("Request in context!"); - if(_attributes!=null) + if (_attributes != null) _attributes.clearAttributes(); - _characterEncoding=null; - if (_cookies!=null) + _characterEncoding = null; + if (_cookies != null) _cookies.reset(); - _cookiesExtracted=false; - _context=null; - _serverName=null; - _method=null; - _pathInfo=null; - _port=0; - _protocol=HttpVersions.HTTP_1_1; - _queryEncoding=null; - _queryString=null; - _requestedSessionId=null; - _requestedSessionIdFromCookie=false; - _session=null; - _sessionManager=null; - _requestURI=null; - _scope=null; - _scheme=URIUtil.HTTP; - _servletPath=null; - _timeStamp=0; - _timeStampBuffer=null; - _uri=null; - if (_baseParameters!=null) + _cookiesExtracted = false; + _context = null; + _serverName = null; + _method = null; + _pathInfo = null; + _port = 0; + _protocol = HttpVersions.HTTP_1_1; + _queryEncoding = null; + _queryString = null; + _requestedSessionId = null; + _requestedSessionIdFromCookie = false; + _session = null; + _sessionManager = null; + _requestURI = null; + _scope = null; + _scheme = URIUtil.HTTP; + _servletPath = null; + _timeStamp = 0; + _timeStampBuffer = null; + _uri = null; + if (_baseParameters != null) _baseParameters.clear(); - _parameters=null; - _paramsExtracted=false; - _inputState=__NONE; - - if (_savedNewSessions!=null) + _parameters = null; + _paramsExtracted = false; + _inputState = __NONE; + + if (_savedNewSessions != null) _savedNewSessions.clear(); - _savedNewSessions=null; + _savedNewSessions = null; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#removeAttribute(java.lang.String) */ public void removeAttribute(String name) { - Object old_value=_attributes==null?null:_attributes.getAttribute(name); - - if (_attributes!=null) + Object old_value = _attributes == null?null:_attributes.getAttribute(name); + + if (_attributes != null) _attributes.removeAttribute(name); - - if (old_value!=null) + + if (old_value != null) { - if (_requestAttributeListeners!=null) + if (_requestAttributeListeners != null) { - final ServletRequestAttributeEvent event = - new ServletRequestAttributeEvent(_context,this,name, old_value); - final int size=LazyList.size(_requestAttributeListeners); - for(int i=0;i(); + if (_savedNewSessions == null) + _savedNewSessions = new HashMap(); _savedNewSessions.put(key,session); } + /* ------------------------------------------------------------ */ public void setAsyncSupported(boolean supported) { - _asyncSupported=supported; + _asyncSupported = supported; } - + /* ------------------------------------------------------------ */ - /* - * Set a request attribute. - * if the attribute name is "org.eclipse.jetty.server.server.Request.queryEncoding" then - * the value is also passed in a call to {@link #setQueryEncoding}. - *

      - * if the attribute name is "org.eclipse.jetty.server.server.ResponseBuffer", then - * the response buffer is flushed with @{link #flushResponseBuffer} - *

      - * if the attribute name is "org.eclipse.jetty.io.EndPoint.maxIdleTime", then the - * value is passed to the associated {@link EndPoint#setMaxIdleTime}. + /* + * Set a request attribute. if the attribute name is "org.eclipse.jetty.server.server.Request.queryEncoding" then the value is also passed in a call to + * {@link #setQueryEncoding}.

      if the attribute name is "org.eclipse.jetty.server.server.ResponseBuffer", then the response buffer is flushed with @{link + * #flushResponseBuffer}

      if the attribute name is "org.eclipse.jetty.io.EndPoint.maxIdleTime", then the value is passed to the associated {@link + * EndPoint#setMaxIdleTime}. + * * @see javax.servlet.ServletRequest#setAttribute(java.lang.String, java.lang.Object) */ public void setAttribute(String name, Object value) { - Object old_value=_attributes==null?null:_attributes.getAttribute(name); - + Object old_value = _attributes == null?null:_attributes.getAttribute(name); + if (name.startsWith("org.eclipse.jetty.")) { if ("org.eclipse.jetty.server.Request.queryEncoding".equals(name)) - setQueryEncoding(value==null?null:value.toString()); - else if("org.eclipse.jetty.server.sendContent".equals(name)) + setQueryEncoding(value == null?null:value.toString()); + else if ("org.eclipse.jetty.server.sendContent".equals(name)) { - try + try { - ((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendContent(value); - } + ((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendContent(value); + } catch (IOException e) { throw new RuntimeException(e); } } - else if("org.eclipse.jetty.server.ResponseBuffer".equals(name)) + else if ("org.eclipse.jetty.server.ResponseBuffer".equals(name)) { try { - final ByteBuffer byteBuffer=(ByteBuffer)value; + final ByteBuffer byteBuffer = (ByteBuffer)value; synchronized (byteBuffer) { - NIOBuffer buffer = byteBuffer.isDirect() - ?new DirectNIOBuffer(byteBuffer,true) - :new IndirectNIOBuffer(byteBuffer,true); + NIOBuffer buffer = byteBuffer.isDirect()?new DirectNIOBuffer(byteBuffer,true):new IndirectNIOBuffer(byteBuffer,true); ((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendResponse(buffer); } } @@ -1508,32 +1491,31 @@ public class Request implements HttpServletRequest { getConnection().getEndPoint().setMaxIdleTime(Integer.valueOf(value.toString())); } - catch(IOException e) + catch (IOException e) { throw new RuntimeException(e); } } } - - if (_attributes==null) - _attributes=new AttributesMap(); - _attributes.setAttribute(name, value); - - if (_requestAttributeListeners!=null) + + if (_attributes == null) + _attributes = new AttributesMap(); + _attributes.setAttribute(name,value); + + if (_requestAttributeListeners != null) { - final ServletRequestAttributeEvent event = - new ServletRequestAttributeEvent(_context,this,name, old_value==null?value:old_value); - final int size=LazyList.size(_requestAttributeListeners); - for(int i=0;i parameters) { - _parameters= (parameters==null)?_baseParameters:parameters; - if (_paramsExtracted && _parameters==null) + _parameters = (parameters == null)?_baseParameters:parameters; + if (_paramsExtracted && _parameters == null) throw new IllegalStateException(); } /* ------------------------------------------------------------ */ /** - * @param pathInfo The pathInfo to set. + * @param pathInfo + * The pathInfo to set. */ public void setPathInfo(String pathInfo) { _pathInfo = pathInfo; } - + /* ------------------------------------------------------------ */ /** - * @param protocol The protocol to set. + * @param protocol + * The protocol to set. */ public void setProtocol(String protocol) { @@ -1704,33 +1695,34 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /** Set the character encoding used for the query string. - * This call will effect the return of getQueryString and getParamaters. - * It must be called before any geParameter methods. - * - * The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" - * may be set as an alternate method of calling setQueryEncoding. - * + /** + * Set the character encoding used for the query string. This call will effect the return of getQueryString and getParamaters. It must be called before any + * geParameter methods. + * + * The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" may be set as an alternate method of calling setQueryEncoding. + * * @param queryEncoding */ public void setQueryEncoding(String queryEncoding) { - _queryEncoding=queryEncoding; - _queryString=null; + _queryEncoding = queryEncoding; + _queryString = null; } - + /* ------------------------------------------------------------ */ /** - * @param queryString The queryString to set. + * @param queryString + * The queryString to set. */ public void setQueryString(String queryString) { _queryString = queryString; } - + /* ------------------------------------------------------------ */ /** - * @param addr The address to set. + * @param addr + * The address to set. */ public void setRemoteAddr(String addr) { @@ -1739,7 +1731,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param host The host to set. + * @param host + * The host to set. */ public void setRemoteHost(String host) { @@ -1748,16 +1741,18 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param requestedSessionId The requestedSessionId to set. + * @param requestedSessionId + * The requestedSessionId to set. */ public void setRequestedSessionId(String requestedSessionId) { _requestedSessionId = requestedSessionId; } - + /* ------------------------------------------------------------ */ /** - * @param requestedSessionIdCookie The requestedSessionIdCookie to set. + * @param requestedSessionIdCookie + * The requestedSessionIdCookie to set. */ public void setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie) { @@ -1766,7 +1761,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param requestURI The requestURI to set. + * @param requestURI + * The requestURI to set. */ public void setRequestURI(String requestURI) { @@ -1775,7 +1771,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param scheme The scheme to set. + * @param scheme + * The scheme to set. */ public void setScheme(String scheme) { @@ -1784,16 +1781,18 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param host The host to set. + * @param host + * The host to set. */ public void setServerName(String host) { _serverName = host; } - + /* ------------------------------------------------------------ */ /** - * @param port The port to set. + * @param port + * The port to set. */ public void setServerPort(int port) { @@ -1802,7 +1801,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param servletPath The servletPath to set. + * @param servletPath + * The servletPath to set. */ public void setServletPath(String servletPath) { @@ -1811,7 +1811,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param session The session to set. + * @param session + * The session to set. */ public void setSession(HttpSession session) { @@ -1820,7 +1821,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param sessionManager The sessionManager to set. + * @param sessionManager + * The sessionManager to set. */ public void setSessionManager(SessionManager sessionManager) { @@ -1835,7 +1837,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param uri The uri to set. + * @param uri + * The uri to set. */ public void setUri(HttpURI uri) { @@ -1845,13 +1848,15 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ public void setUserIdentityScope(UserIdentity.Scope scope) { - _scope=scope; + _scope = scope; } /* ------------------------------------------------------------ */ - /** Set timetstamp of request dispatch - * - * @param value timestamp + /** + * Set timetstamp of request dispatch + * + * @param value + * timestamp */ public void setDispatchTime(long value) { @@ -1863,7 +1868,7 @@ public class Request implements HttpServletRequest { if (!_asyncSupported) throw new IllegalStateException("!asyncSupported"); - _async.suspend(_context,this,_connection._response); + _async.suspend(_context,this,_connection._response); return _async; } @@ -1880,85 +1885,85 @@ public class Request implements HttpServletRequest @Override public String toString() { - return (_handled?"[":"(")+getMethod()+" "+_uri+(_handled?"]@":")@")+hashCode()+" "+super.toString(); + return (_handled?"[":"(") + getMethod() + " " + _uri + (_handled?"]@":")@") + hashCode() + " " + super.toString(); } - - + /* ------------------------------------------------------------ */ - /** Merge in a new query string. - * The query string is merged with the existing parameters and {@link #setParameters(MultiMap)} and {@link #setQueryString(String)} are called with the result. - * The merge is according to the rules of the servlet dispatch forward method. - * @param query The query string to merge into the request. + /** + * Merge in a new query string. The query string is merged with the existing parameters and {@link #setParameters(MultiMap)} and + * {@link #setQueryString(String)} are called with the result. The merge is according to the rules of the servlet dispatch forward method. + * + * @param query + * The query string to merge into the request. */ public void mergeQueryString(String query) { // extract parameters from dispatch query - MultiMap parameters=new MultiMap(); + MultiMap parameters = new MultiMap(); UrlEncoded.decodeTo(query,parameters,getCharacterEncoding()); - + boolean merge_old_query = false; // Have we evaluated parameters - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); - + // Are there any existing parameters? - if (_parameters!=null && _parameters.size()>0) + if (_parameters != null && _parameters.size() > 0) { // Merge parameters; new parameters of the same name take precedence. - Iterator> iter = _parameters.entrySet().iterator(); + Iterator> iter = _parameters.entrySet().iterator(); while (iter.hasNext()) { - Map.Entry entry = iter.next(); - String name=entry.getKey(); - + Map.Entry entry = iter.next(); + String name = entry.getKey(); + // If the names match, we will need to remake the query string if (parameters.containsKey(name)) merge_old_query = true; // Add the old values to the new parameter map - Object values=entry.getValue(); - for (int i=0;i0) + + if (_queryString != null && _queryString.length() > 0) { - if ( merge_old_query ) + if (merge_old_query) { StringBuilder overridden_query_string = new StringBuilder(); MultiMap overridden_old_query = new MultiMap(); UrlEncoded.decodeTo(_queryString,overridden_old_query,getCharacterEncoding()); - MultiMap overridden_new_query = new MultiMap(); + MultiMap overridden_new_query = new MultiMap(); UrlEncoded.decodeTo(query,overridden_new_query,getCharacterEncoding()); - Iterator> iter = overridden_old_query.entrySet().iterator(); + Iterator> iter = overridden_old_query.entrySet().iterator(); while (iter.hasNext()) { - Map.Entry entry = iter.next(); - String name=entry.getKey(); - if(!overridden_new_query.containsKey(name)) + Map.Entry entry = iter.next(); + String name = entry.getKey(); + if (!overridden_new_query.containsKey(name)) { - Object values=entry.getValue(); - for (int i=0;i Date: Fri, 6 Jan 2012 17:49:22 +0100 Subject: [PATCH 46/92] 366774: NumberFormatException when parsing Host header now causes a 400 return code --- .../org/eclipse/jetty/server/Request.java | 20 ++++- .../org/eclipse/jetty/server/RequestTest.java | 73 ++++++++++++------- .../server/SelectChannelTimeoutTest.java | 20 ++--- 3 files changed, 76 insertions(+), 37 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 7a54b62706d..30dfd68c0d5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -46,10 +46,12 @@ import javax.servlet.http.HttpSession; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationListener; import org.eclipse.jetty.http.HttpCookie; +import org.eclipse.jetty.http.HttpException; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.http.HttpMethods; import org.eclipse.jetty.http.HttpParser; +import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.http.HttpVersions; import org.eclipse.jetty.http.MimeTypes; @@ -1016,7 +1018,23 @@ public class Request implements HttpServletRequest case ':': _serverName = BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(),i - hostPort.getIndex())); - _port = BufferUtil.toInt(hostPort.peek(i + 1,hostPort.putIndex() - i - 1)); + try + { + _port = BufferUtil.toInt(hostPort.peek(i + 1,hostPort.putIndex() - i - 1)); + } + catch (NumberFormatException e) + { + try + { + if (_connection != null) + _connection._generator.sendError(HttpStatus.BAD_REQUEST_400,"Port couldn't be parsed from Host header: " + hostPort,null, + true); + } + catch (IOException e1) + { + throw new IllegalArgumentException("IOException caught while trying to send error due to invalid host header: " + hostPort,e1); + } + } return _serverName; } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index bc4cbff2cdc..a81ad64a20e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -40,6 +40,7 @@ import junit.framework.Assert; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; @@ -78,7 +79,7 @@ public class RequestTest _server.stop(); _server.join(); } - + @Test public void testParamExtraction() throws Exception { @@ -101,27 +102,27 @@ public class RequestTest System.err.println(map); assertFalse(map == null); assertTrue(map.isEmpty()); - + Enumeration names = request.getParameterNames(); assertFalse(names.hasMoreElements()); } - + return true; } }; - + //Send a request with query string with illegal hex code to cause //an exception parsing the params String request="GET /?param=%ZZaaa HTTP/1.1\r\n"+ "Host: whatever\r\n"+ "Content-Type: text/html;charset=utf8\n"+ "\n"; - + String responses=_connector.getResponses(request); assertTrue(responses.startsWith("HTTP/1.1 200")); - + } - + @Test public void testBadUtf8ParamExtraction() throws Exception { @@ -133,20 +134,40 @@ public class RequestTest return value.startsWith("aaa") && value.endsWith("bb"); } }; - + //Send a request with query string with illegal hex code to cause //an exception parsing the params String request="GET /?param=aaa%E7bbb HTTP/1.1\r\n"+ "Host: whatever\r\n"+ "Content-Type: text/html;charset=utf8\n"+ "\n"; - + String responses=_connector.getResponses(request); - assertTrue(responses.startsWith("HTTP/1.1 200")); + assertTrue(responses.startsWith("HTTP/1.1 200")); } - - + @Test + public void testInvalidHostHeader() throws Exception + { + // Use a contextHandler with vhosts to force call to Request.getServerName() + ContextHandler handler = new ContextHandler(); + handler.addVirtualHosts(new String[1]); + _server.stop(); + _server.setHandler(handler); + _server.start(); + + // Request with illegal Host header + String request="GET / HTTP/1.1\r\n"+ + "Host: whatever.com:\r\n"+ + "Content-Type: text/html;charset=utf8\n"+ + "\n"; + + String responses=_connector.getResponses(request); + assertTrue("400 Bad Request response expected",responses.startsWith("HTTP/1.1 400")); + } + + + @Test public void testContentTypeEncoding() throws Exception { @@ -196,7 +217,7 @@ public class RequestTest assertTrue(results.get(i++).startsWith("text/html")); assertEquals(" x=z; ",results.get(i++)); } - + @Test public void testHostPort() throws Exception { @@ -369,7 +390,7 @@ public class RequestTest Reader reader=request.getReader(); String in = IO.toString(reader); String param = request.getParameter("param"); - + byte[] b=("read='"+in+"' param="+param+"\n").getBytes(StringUtil.__UTF8); response.setContentLength(b.length); response.getOutputStream().write(b); @@ -389,11 +410,11 @@ public class RequestTest "param=wrong\r\n"; String responses = _connector.getResponses(request); - + assertTrue(responses.indexOf("read='param=wrong' param=right")>0); - + } - + @Test public void testPartialInput() throws Exception { @@ -752,7 +773,7 @@ public class RequestTest { _server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize",-1); _server.setAttribute("org.eclipse.jetty.server.Request.maxFormKeys",1000); - + // This file is not distributed - as it is dangerous File evil_keys = new File("/tmp/keys_mapping_to_zero_2m"); if (!evil_keys.exists()) @@ -760,10 +781,10 @@ public class RequestTest Log.info("testHashDOS skipped"); return; } - + BufferedReader in = new BufferedReader(new FileReader(evil_keys)); StringBuilder buf = new StringBuilder(4000000); - + String key=null; buf.append("a=b"); while((key=in.readLine())!=null) @@ -771,7 +792,7 @@ public class RequestTest buf.append("&").append(key).append("=").append("x"); } buf.append("&c=d"); - + _handler._checker = new RequestTester() { public boolean check(HttpServletRequest request,HttpServletResponse response) @@ -787,15 +808,15 @@ public class RequestTest "Connection: close\r\n"+ "\r\n"+ buf; - + long start=System.currentTimeMillis(); String response = _connector.getResponses(request); assertTrue(response.contains("200 OK")); long now=System.currentTimeMillis(); assertTrue((now-start)<5000); } - - + + interface RequestTester { boolean check(HttpServletRequest request,HttpServletResponse response) throws IOException; @@ -812,12 +833,12 @@ public class RequestTest if (request.getContentLength()>0 && !MimeTypes.FORM_ENCODED.equals(request.getContentType())) _content=IO.toString(request.getInputStream()); - + if (_checker!=null && _checker.check(request,response)) response.setStatus(200); else response.sendError(500); - + } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java index c3479cb4d4a..b0b3af66339 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java @@ -24,14 +24,14 @@ import java.net.Socket; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.session.SessionHandler; import org.eclipse.jetty.util.IO; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; public class SelectChannelTimeoutTest extends ConnectorTimeoutTest { - - @Before - public void init() throws Exception + + @BeforeClass + public static void init() throws Exception { SelectChannelConnector connector = new SelectChannelConnector(); connector.setMaxIdleTime(MAX_IDLE_TIME); // 250 msec max idle @@ -52,7 +52,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setResumeAfter(25); assertTrue(process(null).toUpperCase().contains("RESUMED")); } - + @Test public void testIdleTimeoutAfterTimeout() throws Exception { @@ -62,13 +62,13 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest session.setHandler(_handler); _server.setHandler(session); _server.start(); - + _handler.setSuspendFor(50); assertTrue(process(null).toUpperCase().contains("TIMEOUT")); } - + @Test - public void testIdleTimeoutAfterComplete() throws Exception + public void testIdleTimeoutAfterComplete() throws Exception { SuspendHandler _handler = new SuspendHandler(); _server.stop(); @@ -76,13 +76,13 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest session.setHandler(_handler); _server.setHandler(session); _server.start(); - + _handler.setSuspendFor(100); _handler.setCompleteAfter(25); assertTrue(process(null).toUpperCase().contains("COMPLETED")); } - private synchronized String process(String content) throws UnsupportedEncodingException, IOException, InterruptedException + private synchronized String process(String content) throws UnsupportedEncodingException, IOException, InterruptedException { String request = "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + "Connection: close\r\n"; From 245161438160f0ed900bca3ce28b05b1bee6e3ad Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 9 Jan 2012 11:38:07 +1100 Subject: [PATCH 47/92] 366774 removed XSS vulnerbility --- .../src/main/java/org/eclipse/jetty/server/Request.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 30dfd68c0d5..01a6b7655d2 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1027,12 +1027,11 @@ public class Request implements HttpServletRequest try { if (_connection != null) - _connection._generator.sendError(HttpStatus.BAD_REQUEST_400,"Port couldn't be parsed from Host header: " + hostPort,null, - true); + _connection._generator.sendError(HttpStatus.BAD_REQUEST_400,"Bad Host header",null,true); } catch (IOException e1) { - throw new IllegalArgumentException("IOException caught while trying to send error due to invalid host header: " + hostPort,e1); + throw new RuntimeException(e1); } } return _serverName; From 9ba96f22dd44e6e8a342a03afe0b28244a8f9622 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Fri, 6 Jan 2012 14:09:26 +0100 Subject: [PATCH 48/92] 367974: Calculate wait times, etc. based on MAX_IDLE_TIME --- .../jetty/server/ConnectorTimeoutTest.java | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java index f01dfc831a8..85db40c80ed 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java @@ -39,6 +39,9 @@ import static org.junit.matchers.JUnitMatchers.containsString; public abstract class ConnectorTimeoutTest extends HttpServerTestFixture { protected static final int MAX_IDLE_TIME=250; + private int sleepTime = MAX_IDLE_TIME + MAX_IDLE_TIME/5; + private int minimumTestRuntime = MAX_IDLE_TIME-MAX_IDLE_TIME/5; + private int maximumTestRuntime = MAX_IDLE_TIME*10; static { @@ -68,11 +71,11 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture long start = System.currentTimeMillis(); IO.toString(is); - Thread.sleep(300); + Thread.sleep(sleepTime); assertEquals(-1, is.read()); - Assert.assertTrue(System.currentTimeMillis()-start>200); - Assert.assertTrue(System.currentTimeMillis()-start<5000); + Assert.assertTrue(System.currentTimeMillis()-start>minimumTestRuntime); + Assert.assertTrue(System.currentTimeMillis()-start200); - Assert.assertTrue(System.currentTimeMillis()-start<5000); + Assert.assertTrue(System.currentTimeMillis()-start>minimumTestRuntime); + Assert.assertTrue(System.currentTimeMillis()-start Date: Mon, 9 Jan 2012 13:12:25 +1100 Subject: [PATCH 49/92] 368114 Protect against non-Strings in System properties for Log --- jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java index 74f8e5fa66d..c1f42baa85e 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java @@ -102,7 +102,10 @@ public class Log while (systemKeyEnum.hasMoreElements()) { String key = systemKeyEnum.nextElement(); - __props.setProperty(key,System.getProperty(key)); + String val = System.getProperty(key); + //protect against application code insertion of non-String values (returned as null) + if (val != null) + __props.setProperty(key,val); } /* Now use the configuration properties to configure the Log statics From 71ea564f0b48f28e95ac6020c0aca67df5c05552 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 9 Jan 2012 20:15:22 +0100 Subject: [PATCH 50/92] 368189 - WebSocketClientFactory should not manage external thread pool. --- .../websocket/WebSocketClientFactory.java | 23 ++++++++++++++++--- .../jetty/websocket/WebSocketClientTest.java | 5 +++- .../jetty/websocket/WebSocketOverSSLTest.java | 22 ++++++++++++++---- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 92407cd2eab..c7c73bc6524 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -45,6 +45,7 @@ import org.eclipse.jetty.io.nio.SslConnection; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.component.AggregateLifeCycle; +import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.QueuedThreadPool; @@ -67,6 +68,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle private final Queue connections = new ConcurrentLinkedQueue(); private final SslContextFactory _sslContextFactory = new SslContextFactory(); private final ThreadPool _threadPool; + private final boolean _shutdownThreadPool; private final WebSocketClientSelector _selector; private MaskGen _maskGen; private WebSocketBuffers _buffers; @@ -77,7 +79,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle */ public WebSocketClientFactory() { - this(new QueuedThreadPool()); + this(null); } /* ------------------------------------------------------------ */ @@ -114,14 +116,27 @@ public class WebSocketClientFactory extends AggregateLifeCycle */ public WebSocketClientFactory(ThreadPool threadPool, MaskGen maskGen, int bufferSize) { - _threadPool = threadPool; - addBean(threadPool); + if (threadPool == null) + { + _threadPool = new QueuedThreadPool(); + addBean(_threadPool); + _shutdownThreadPool = true; + } + else + { + _threadPool = threadPool; + _shutdownThreadPool = false; + } + _buffers = new WebSocketBuffers(bufferSize); addBean(_buffers); + _maskGen = maskGen; addBean(_maskGen); + _selector = new WebSocketClientSelector(); addBean(_selector); + addBean(_sslContextFactory); } @@ -209,6 +224,8 @@ public class WebSocketClientFactory extends AggregateLifeCycle { closeConnections(); super.doStop(); + if (_shutdownThreadPool && _threadPool instanceof LifeCycle) + ((LifeCycle)_threadPool).stop(); } /* ------------------------------------------------------------ */ diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java index 571a454e0da..07a9060baa0 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java @@ -74,8 +74,10 @@ public class WebSocketClientTest @Test public void testMessageBiggerThanBufferSize() throws Exception { + QueuedThreadPool threadPool = new QueuedThreadPool(); int bufferSize = 512; - WebSocketClientFactory factory = new WebSocketClientFactory(new QueuedThreadPool(), new ZeroMaskGen(), bufferSize); + WebSocketClientFactory factory = new WebSocketClientFactory(threadPool, new ZeroMaskGen(), bufferSize); + threadPool.start(); factory.start(); WebSocketClient client = new WebSocketClient(factory); @@ -118,6 +120,7 @@ public class WebSocketClientTest Assert.assertTrue(dataLatch.await(1000, TimeUnit.SECONDS)); factory.stop(); + threadPool.stop(); } @Test diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketOverSSLTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketOverSSLTest.java index 80b262d6392..524d8d0ece3 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketOverSSLTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketOverSSLTest.java @@ -35,6 +35,8 @@ public class WebSocketOverSSLTest { private Server _server; private int _port; + private QueuedThreadPool _threadPool; + private WebSocketClientFactory _wsFactory; private WebSocket.Connection _connection; private void startServer(final WebSocket webSocket) throws Exception @@ -61,13 +63,18 @@ public class WebSocketOverSSLTest { Assert.assertTrue(_server.isStarted()); - WebSocketClientFactory factory = new WebSocketClientFactory(new QueuedThreadPool(), new ZeroMaskGen()); - SslContextFactory cf = factory.getSslContextFactory(); + _threadPool = new QueuedThreadPool(); + _threadPool.setName("wsc-" + _threadPool.getName()); + _threadPool.start(); + + _wsFactory = new WebSocketClientFactory(_threadPool, new ZeroMaskGen()); + SslContextFactory cf = _wsFactory.getSslContextFactory(); cf.setKeyStorePath(MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath()); cf.setKeyStorePassword("storepwd"); cf.setKeyManagerPassword("keypwd"); - factory.start(); - WebSocketClient client = new WebSocketClient(factory); + _wsFactory.start(); + + WebSocketClient client = new WebSocketClient(_wsFactory); _connection = client.open(new URI("wss://localhost:" + _port), webSocket).get(5, TimeUnit.SECONDS); } @@ -76,6 +83,13 @@ public class WebSocketOverSSLTest { if (_connection != null) _connection.close(); + + if (_wsFactory != null) + _wsFactory.stop(); + + if (_threadPool != null) + _threadPool.stop(); + if (_server != null) { _server.stop(); From 27cbf0bf785f92c7639133cd6542ffdfdd6cf361 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 9 Jan 2012 20:27:46 +0100 Subject: [PATCH 51/92] 367099 - Upgrade jetty-websocket for RFC 6455 - Addendum. The WebSocket parser was forgot in the renaming. Took also the chance to remove hardcoded "D13" string in toString() methods. --- .../websocket/WebSocketConnectionRFC6455.java | 14 +- ...erD13.java => WebSocketParserRFC6455.java} | 6 +- ...est.java => WebSocketLoadRFC6455Test.java} | 24 +- .../WebSocketMessageRFC6455Test.java | 234 +++++++++--------- .../websocket/WebSocketParserRFC6455Test.java | 64 ++--- 5 files changed, 174 insertions(+), 168 deletions(-) rename jetty-websocket/src/main/java/org/eclipse/jetty/websocket/{WebSocketParserD13.java => WebSocketParserRFC6455.java} (98%) rename jetty-websocket/src/test/java/org/eclipse/jetty/websocket/{WebSocketLoadD13Test.java => WebSocketLoadRFC6455Test.java} (96%) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java index 7f693751be0..9a6377bd125 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java @@ -121,7 +121,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We private final static byte[] MAGIC; private final List _extensions; - private final WebSocketParserD13 _parser; + private final WebSocketParserRFC6455 _parser; private final WebSocketGeneratorRFC6455 _generator; private final WebSocketGenerator _outbound; private final WebSocket _webSocket; @@ -197,7 +197,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We _outbound=(_extensions==null||_extensions.size()==0)?_generator:extensions.get(extensions.size()-1); WebSocketParser.FrameHandler inbound = (_extensions == null || _extensions.size() == 0) ? frameHandler : extensions.get(0); - _parser = new WebSocketParserD13(buffers, endpoint, inbound,maskgen==null); + _parser = new WebSocketParserRFC6455(buffers, endpoint, inbound,maskgen==null); _protocol=protocol; @@ -642,7 +642,13 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We @Override public String toString() { - return this.getClass().getSimpleName()+"D13@"+_endp.getLocalAddr()+":"+_endp.getLocalPort()+"<->"+_endp.getRemoteAddr()+":"+_endp.getRemotePort(); + return String.format("%s@%x l(%s:%d)<->r(%s:%d)", + getClass().getSimpleName(), + hashCode(), + _endp.getLocalAddr(), + _endp.getLocalPort(), + _endp.getRemoteAddr(), + _endp.getRemotePort()); } } @@ -973,6 +979,6 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We @Override public String toString() { - return String.format("WS/D%d p=%s g=%s", _draft, _parser, _generator); + return String.format("%s p=%s g=%s", getClass().getSimpleName(), _parser, _generator); } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD13.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java similarity index 98% rename from jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD13.java rename to jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java index 9979a683735..dbb16cb4390 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD13.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java @@ -43,9 +43,9 @@ import org.eclipse.jetty.util.log.Logger; * Parser the WebSocket protocol. * */ -public class WebSocketParserD13 implements WebSocketParser +public class WebSocketParserRFC6455 implements WebSocketParser { - private static final Logger LOG = Log.getLogger(WebSocketParserD13.class); + private static final Logger LOG = Log.getLogger(WebSocketParserRFC6455.class); public enum State { @@ -89,7 +89,7 @@ public class WebSocketParserD13 implements WebSocketParser * @param handler the handler to notify when a parse event occurs * @param shouldBeMasked whether masking should be handled */ - public WebSocketParserD13(WebSocketBuffers buffers, EndPoint endp, FrameHandler handler, boolean shouldBeMasked) + public WebSocketParserRFC6455(WebSocketBuffers buffers, EndPoint endp, FrameHandler handler, boolean shouldBeMasked) { _buffers=buffers; _endp=endp; diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD13Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java similarity index 96% rename from jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD13Test.java rename to jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java index 9a12059a006..13a3869bdc1 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD13Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.junit.Assert.*; - import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; @@ -28,11 +26,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; - import javax.servlet.http.HttpServletRequest; import junit.framework.Assert; - import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.bio.SocketEndPoint; import org.eclipse.jetty.server.Connector; @@ -45,7 +41,9 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -public class WebSocketLoadD13Test +import static org.junit.Assert.assertTrue; + +public class WebSocketLoadRFC6455Test { private static Server _server; private static Connector _connector; @@ -127,7 +125,7 @@ public class WebSocketLoadD13Test { this.outbound = outbound; } - + public void onMessage(String data) { try @@ -155,7 +153,7 @@ public class WebSocketLoadD13Test private final CountDownLatch latch; private final SocketEndPoint _endp; private final WebSocketGeneratorRFC6455 _generator; - private final WebSocketParserD13 _parser; + private final WebSocketParserRFC6455 _parser; private final WebSocketParser.FrameHandler _handler = new WebSocketParser.FrameHandler() { public void onFrame(byte flags, byte opcode, Buffer buffer) @@ -168,7 +166,7 @@ public class WebSocketLoadD13Test } }; private volatile Buffer _response; - + public WebSocketClient(String host, int port, int readTimeout, CountDownLatch latch, int iterations) throws IOException { this.latch = latch; @@ -177,11 +175,11 @@ public class WebSocketLoadD13Test output = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "ISO-8859-1")); input = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ISO-8859-1")); this.iterations = iterations; - + _endp=new SocketEndPoint(socket); _generator = new WebSocketGeneratorRFC6455(new WebSocketBuffers(32*1024),_endp,new FixedMaskGen()); - _parser = new WebSocketParserD13(new WebSocketBuffers(32*1024),_endp,_handler,false); - + _parser = new WebSocketParserRFC6455(new WebSocketBuffers(32*1024),_endp,_handler,false); + } private void open() throws IOException @@ -216,9 +214,9 @@ public class WebSocketLoadD13Test byte[] data = message.getBytes(StringUtil.__UTF8); _generator.addFrame((byte)0x8,WebSocketConnectionRFC6455.OP_TEXT,data,0,data.length); _generator.flush(); - + //System.err.println("-> "+message); - + _response=null; while(_response==null) _parser.parseNext(); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java index 6c017e93175..3fe9942cb63 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.junit.Assert.*; - import java.io.EOFException; import java.io.IOException; import java.io.InputStream; @@ -30,11 +28,9 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.zip.Deflater; import java.util.zip.Inflater; - import javax.servlet.http.HttpServletRequest; import junit.framework.Assert; - import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.server.Connector; @@ -48,6 +44,10 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + public class WebSocketMessageRFC6455Test { private static Server __server; @@ -78,7 +78,7 @@ public class WebSocketMessageRFC6455Test } }; wsHandler.getWebSocketFactory().setBufferSize(8192); - wsHandler.getWebSocketFactory().setMaxIdleTime(1000); + wsHandler.getWebSocketFactory().setMaxIdleTime(1000); wsHandler.setHandler(new DefaultHandler()); __server.setHandler(wsHandler); __server.start(); @@ -91,13 +91,13 @@ public class WebSocketMessageRFC6455Test __server.join(); } - + @Test public void testHash() { assertEquals("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",WebSocketConnectionRFC6455.hashKey("dGhlIHNhbXBsZSBub25jZQ==")); } - + @Test public void testServerSendBigStringMessage() throws Exception { @@ -119,7 +119,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -127,7 +127,7 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + // Server sends a big message StringBuilder message = new StringBuilder(); String text = "0123456789ABCDEF"; @@ -167,7 +167,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -175,7 +175,7 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + assertEquals(0x81,input.read()); assertEquals(0x0f,input.read()); lookFor("sent on connect",input); @@ -312,8 +312,8 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - - + + // Server sends a big message String text = "0123456789ABCDEF "; text=text+text+text+text; @@ -324,15 +324,15 @@ public class WebSocketMessageRFC6455Test deflater.setInput(data); deflater.finish(); byte[] buf=new byte[data.length]; - + buf[0]=(byte)((byte)0x7e); buf[1]=(byte)(data.length>>8); buf[2]=(byte)(data.length&0xff); - + int l=deflater.deflate(buf,3,buf.length-3); assertTrue(deflater.finished()); - + output.write(0xC1); output.write((byte)(0x80|(0xff&(l+3)))); output.write(0x00); @@ -341,41 +341,41 @@ public class WebSocketMessageRFC6455Test output.write(0x00); output.write(buf,0,l+3); output.flush(); - + assertEquals(0x40+WebSocketConnectionRFC6455.OP_TEXT,input.read()); assertEquals(0x20+3,input.read()); assertEquals(0x7e,input.read()); assertEquals(0x02,input.read()); assertEquals(0x20,input.read()); - + byte[] raw = new byte[32]; assertEquals(32,input.read(raw)); - + Inflater inflater = new Inflater(); inflater.setInput(raw); - + byte[] result = new byte[544]; assertEquals(544,inflater.inflate(result)); assertEquals(TypeUtil.toHexString(data,0,544),TypeUtil.toHexString(result)); - + assertEquals((byte)0xC0,(byte)input.read()); assertEquals(0x21+3,input.read()); assertEquals(0x7e,input.read()); assertEquals(0x02,input.read()); assertEquals(0x21,input.read()); - + assertEquals(32,input.read(raw)); - + inflater.reset(); inflater.setInput(raw); result = new byte[545]; assertEquals(545,inflater.inflate(result)); assertEquals(TypeUtil.toHexString(data,544,545),TypeUtil.toHexString(result)); - + } - + @Test public void testServerEcho() throws Exception { @@ -403,10 +403,10 @@ public class WebSocketMessageRFC6455Test output.write(bytes[i]^0xff); output.flush(); // Make sure the read times out if there are problems with the implementation - socket.setSoTimeout(1000); + socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -414,12 +414,12 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + assertEquals(0x84,input.read()); assertEquals(0x0f,input.read()); lookFor("this is an echo",input); } - + @Test public void testBlockedConsumer() throws Exception { @@ -436,7 +436,7 @@ public class WebSocketMessageRFC6455Test mesg[5]=(byte)0xff; for (int i=0;i>> "+i); output.flush(); - + long now=System.currentTimeMillis(); long duration=now-start; start=now; @@ -518,13 +518,13 @@ public class WebSocketMessageRFC6455Test assertEquals(count+1,__textCount.get()); // all messages assertTrue(max>2000); // was blocked } - + @Test public void testBlockedProducer() throws Exception { final Socket socket = new Socket("localhost", __connector.getLocalPort()); OutputStream output = socket.getOutputStream(); - + final int count = 100000; output.write( @@ -581,8 +581,8 @@ public class WebSocketMessageRFC6455Test } } }.start(); - - + + // Send enough messages to fill receive buffer long max=0; long start=System.currentTimeMillis(); @@ -593,7 +593,7 @@ public class WebSocketMessageRFC6455Test if (i%100==0) { output.flush(); - + long now=System.currentTimeMillis(); long duration=now-start; start=now; @@ -601,10 +601,10 @@ public class WebSocketMessageRFC6455Test max=duration; } } - + while(totalB.get()<(count*(mesg.length()+2))) Thread.sleep(100); - + assertEquals(count*(mesg.length()+2),totalB.get()); // all messages assertTrue(max>1000); // was blocked } @@ -635,7 +635,7 @@ public class WebSocketMessageRFC6455Test output.flush(); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -668,7 +668,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -676,10 +676,10 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + __serverWebSocket.getConnection().setMaxTextMessageSize(10*1024); __serverWebSocket.getConnection().setAllowFrameFragmentation(true); - + output.write(0x81); output.write(0x80|0x7E); output.write((byte)((16*1024)>>8)); @@ -692,7 +692,7 @@ public class WebSocketMessageRFC6455Test for (int i=0;i<(16*1024);i++) output.write('X'); output.flush(); - + assertEquals(0x80|WebSocketConnectionRFC6455.OP_CLOSE,input.read()); assertEquals(33,input.read()); @@ -720,7 +720,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -728,9 +728,9 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + __serverWebSocket.getConnection().setMaxTextMessageSize(15); - + output.write(0x01); output.write(0x8a); output.write(0xff); @@ -779,7 +779,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(100000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -787,9 +787,9 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + __serverWebSocket.getConnection().setMaxTextMessageSize(15); - + output.write(0x01); output.write(0x94); output.write(0xff); @@ -800,9 +800,9 @@ public class WebSocketMessageRFC6455Test for (int i=0;i 15",input); } - - + + @Test public void testCloseIn() throws Exception { - int[][] tests = + int[][] tests = { {-1,0,-1}, {-1,0,-1}, @@ -960,7 +960,7 @@ public class WebSocketMessageRFC6455Test "", "mesg" }; - + String[] resp = { "", @@ -1007,14 +1007,14 @@ public class WebSocketMessageRFC6455Test int code=tests[t][0]; String m=mesg[t]; - + output.write(0x88); output.write(0x80 + (code<=0?0:(2+m.length()))); output.write(0x00); output.write(0x00); output.write(0x00); output.write(0x00); - + if (code>0) { output.write(code/0x100); @@ -1022,12 +1022,12 @@ public class WebSocketMessageRFC6455Test output.write(m.getBytes()); } output.flush(); - + __serverWebSocket.awaitDisconnected(1000); byte[] buf = new byte[128]; int len = input.read(buf); - + assertEquals(tst,2+tests[t][1],len); assertEquals(tst,(byte)0x88,buf[0]); @@ -1035,7 +1035,7 @@ public class WebSocketMessageRFC6455Test { code=(0xff&buf[2])*0x100+(0xff&buf[3]); assertEquals(tst,tests[t][2],code); - + if (len>4) { m = new String(buf,4,len-4,"UTF-8"); @@ -1044,19 +1044,19 @@ public class WebSocketMessageRFC6455Test } else assertEquals(tst,tests[t][2],-1); - + len = input.read(buf); assertEquals(tst,-1,len); } } - + @Test public void testCloseOut() throws Exception { - int[][] tests = + int[][] tests = { {-1,0,-1}, {-1,0,-1}, @@ -1127,7 +1127,7 @@ public class WebSocketMessageRFC6455Test { int code=(0xff&buf[2])*0x100+(0xff&buf[3]); assertEquals(tst,tests[t][2],code); - + if (len>4) { String m = new String(buf,4,len-4,"UTF-8"); @@ -1136,7 +1136,7 @@ public class WebSocketMessageRFC6455Test } else assertEquals(tst,tests[t][2],-1); - + try { output.write(0x88); @@ -1152,12 +1152,12 @@ public class WebSocketMessageRFC6455Test System.err.println("socket "+socket); throw e; } - + len = input.read(buf); assertEquals(tst,-1,len); - } + } } - + @Test public void testNotUTF8() throws Exception @@ -1225,7 +1225,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(100000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -1233,9 +1233,9 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + __serverWebSocket.getConnection().setMaxBinaryMessageSize(15); - + output.write(0x02); output.write(0x94); output.write(0xff); @@ -1246,7 +1246,7 @@ public class WebSocketMessageRFC6455Test for (int i=0;i received = new AtomicReference(); ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); - + WebSocketGeneratorRFC6455 gen = new WebSocketGeneratorRFC6455(new WebSocketBuffers(8096),endp,null); - + byte[] data = message.getBytes(StringUtil.__UTF8); gen.addFrame((byte)0x8,(byte)0x4,data,0,data.length); - + endp = new ByteArrayEndPoint(endp.getOut().asArray(),4096); - - WebSocketParserD13 parser = new WebSocketParserD13(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() + + WebSocketParserRFC6455 parser = new WebSocketParserRFC6455(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { public void onFrame(byte flags, byte opcode, Buffer buffer) { @@ -1449,12 +1449,12 @@ public class WebSocketMessageRFC6455Test } },false); - + parser.parseNext(); - + assertEquals(message,received.get()); } - + @Test public void testParserAndGeneratorMasked() throws Exception { @@ -1463,14 +1463,14 @@ public class WebSocketMessageRFC6455Test ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); MaskGen maskGen = new RandomMaskGen(); - + WebSocketGeneratorRFC6455 gen = new WebSocketGeneratorRFC6455(new WebSocketBuffers(8096),endp,maskGen); byte[] data = message.getBytes(StringUtil.__UTF8); gen.addFrame((byte)0x8,(byte)0x1,data,0,data.length); - + endp = new ByteArrayEndPoint(endp.getOut().asArray(),4096); - - WebSocketParserD13 parser = new WebSocketParserD13(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() + + WebSocketParserRFC6455 parser = new WebSocketParserRFC6455(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { public void onFrame(byte flags, byte opcode, Buffer buffer) { @@ -1481,13 +1481,13 @@ public class WebSocketMessageRFC6455Test { } },true); - + parser.parseNext(); - + assertEquals(message,received.get()); } - - + + private void lookFor(String string,InputStream in) throws IOException { @@ -1535,7 +1535,7 @@ public class WebSocketMessageRFC6455Test state=0; } } - + private static class TestWebSocket implements WebSocket.OnFrame, WebSocket.OnBinaryMessage, WebSocket.OnTextMessage { @@ -1556,7 +1556,7 @@ public class WebSocketMessageRFC6455Test { this.connection = connection; } - + public void onOpen(Connection connection) { if (_onConnect) @@ -1582,14 +1582,14 @@ public class WebSocketMessageRFC6455Test { return disconnected.await(time, TimeUnit.MILLISECONDS); } - + public void onClose(int code,String message) { disconnected.countDown(); } public boolean onFrame(byte flags, byte opcode, byte[] data, int offset, int length) - { + { if (_echo) { switch(opcode) @@ -1598,7 +1598,7 @@ public class WebSocketMessageRFC6455Test case WebSocketConnectionRFC6455.OP_PING: case WebSocketConnectionRFC6455.OP_PONG: break; - + default: try { @@ -1642,7 +1642,7 @@ public class WebSocketMessageRFC6455Test e.printStackTrace(); } } - + if (_aggregate) { try diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java index 34d0f1efdd1..5d9e920dd76 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.junit.Assert.*; - import java.util.ArrayList; import java.util.List; @@ -30,12 +28,16 @@ import org.eclipse.jetty.util.Utf8StringBuilder; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class WebSocketParserRFC6455Test { private ByteArrayEndPoint _endPoint; private MaskedByteArrayBuffer _in; private Handler _handler; - private WebSocketParserD13 _parser; + private WebSocketParserRFC6455 _parser; private byte[] _mask = new byte[] {(byte)0x00,(byte)0xF0,(byte)0x0F,(byte)0xFF}; private int _m; @@ -45,7 +47,7 @@ public class WebSocketParserRFC6455Test { super(4096); } - + public void sendMask() { super.poke(putIndex(),_mask,0,4); @@ -63,7 +65,7 @@ public class WebSocketParserRFC6455Test { super.put(b); } - + @Override public void put(byte b) { @@ -87,10 +89,10 @@ public class WebSocketParserRFC6455Test { return put(b,0,b.length); } - + }; - - + + @Before public void setUp() throws Exception { @@ -98,10 +100,10 @@ public class WebSocketParserRFC6455Test _endPoint = new ByteArrayEndPoint(); _endPoint.setNonBlocking(true); _handler = new Handler(); - _parser=new WebSocketParserD13(buffers, _endPoint,_handler,true); + _parser=new WebSocketParserRFC6455(buffers, _endPoint,_handler,true); _parser.setFakeFragments(false); _in = new MaskedByteArrayBuffer(); - + _endPoint.setIn(_in); } @@ -127,7 +129,7 @@ public class WebSocketParserRFC6455Test _parser.returnBuffer(); assertTrue(_parser.getBuffer()==null); } - + @Test public void testShortText() throws Exception { @@ -147,7 +149,7 @@ public class WebSocketParserRFC6455Test _parser.returnBuffer(); assertTrue(_parser.getBuffer()==null); } - + @Test public void testShortUtf8() throws Exception { @@ -169,7 +171,7 @@ public class WebSocketParserRFC6455Test assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); } - + @Test public void testMediumText() throws Exception { @@ -177,9 +179,9 @@ public class WebSocketParserRFC6455Test for (int i=0;i<4;i++) string = string+string; string += ". The end."; - + byte[] bytes = string.getBytes(StringUtil.__UTF8); - + _in.putUnmasked((byte)0x81); _in.putUnmasked((byte)(0x80|0x7E)); _in.putUnmasked((byte)(bytes.length>>8)); @@ -197,21 +199,21 @@ public class WebSocketParserRFC6455Test assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); } - + @Test public void testLongText() throws Exception { WebSocketBuffers buffers = new WebSocketBuffers(0x20000); ByteArrayEndPoint endPoint = new ByteArrayEndPoint(); - WebSocketParserD13 parser=new WebSocketParserD13(buffers, endPoint,_handler,false); + WebSocketParserRFC6455 parser=new WebSocketParserRFC6455(buffers, endPoint,_handler,false); ByteArrayBuffer in = new ByteArrayBuffer(0x20000); endPoint.setIn(in); - + String string = "Hell\uFF4f Big W\uFF4Frld "; for (int i=0;i<12;i++) string = string+string; string += ". The end."; - + byte[] bytes = string.getBytes("UTF-8"); _in.sendMask(); @@ -269,7 +271,7 @@ public class WebSocketParserRFC6455Test { // Buffers are only 1024, so this frame is too large _parser.setFakeFragments(false); - + _in.putUnmasked((byte)0x81); _in.putUnmasked((byte)(0x80|0x7E)); _in.putUnmasked((byte)(2048>>8)); @@ -280,8 +282,8 @@ public class WebSocketParserRFC6455Test assertTrue(progress>0); assertEquals(WebSocketConnectionRFC6455.CLOSE_POLICY_VIOLATION,_handler._code); - - + + for (int i=0;i<2048;i++) _in.put((byte)'a'); progress =_parser.parseNext(); @@ -289,7 +291,7 @@ public class WebSocketParserRFC6455Test assertTrue(progress>0); assertEquals(0,_handler._data.size()); assertEquals(0,_handler._utf8.length()); - + _handler._code=0; _in.putUnmasked((byte)0x81); @@ -310,7 +312,7 @@ public class WebSocketParserRFC6455Test { // Buffers are only 1024, so this frame will be fake fragmented _parser.setFakeFragments(true); - + _in.putUnmasked((byte)0x81); _in.putUnmasked((byte)(0x80|0x7E)); _in.putUnmasked((byte)(2048>>8)); @@ -318,7 +320,7 @@ public class WebSocketParserRFC6455Test _in.sendMask(); for (int i=0;i<2048;i++) _in.put((byte)('a'+i%26)); - + int progress =_parser.parseNext(); assertTrue(progress>0); @@ -355,21 +357,21 @@ public class WebSocketParserRFC6455Test _parser.returnBuffer(); assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); - + _in.clear(); _in.put(bytes); _endPoint.setIn(_in); progress =_parser.parseNext(); assertTrue(progress>0); - + _endPoint.shutdownInput(); - + progress =_parser.parseNext(); assertEquals(-1,progress); - + } - - + + private class Handler implements WebSocketParser.FrameHandler { Utf8StringBuilder _utf8 = new Utf8StringBuilder(); From 829686f1e10f0bab1fd63d882a20193d0a474831 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 9 Jan 2012 21:51:15 +0100 Subject: [PATCH 52/92] Removed JDK 1.6-ism. --- .../org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java index 9076f054291..e04f93875e0 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java @@ -48,7 +48,8 @@ public class HttpsProxyAuthenticationTest @Override protected boolean handleAuthentication(HttpServletRequest request, HttpServletResponse response, String address) throws ServletException, IOException { - if (!request.getHeader("Authorization").isEmpty()) + String authHeader = request.getHeader("Authorization"); + if (authHeader != null && authHeader.length() > 0) authHandlerSend = true; return super.handleAuthentication(request,response,address); } From 0fa4fa9b23fe88b1327c3be65f3eed8db20ac680 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 9 Jan 2012 14:57:21 -0600 Subject: [PATCH 53/92] clean up some warnings from maven --- jetty-http/pom.xml | 1 - jetty-io/pom.xml | 1 - jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 1 - jetty-osgi/jetty-osgi-boot-logback/pom.xml | 1 - jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 1 - jetty-osgi/jetty-osgi-httpservice/pom.xml | 1 - jetty-osgi/test-jetty-osgi/pom.xml | 1 - jetty-policy/pom.xml | 1 - test-jetty-webapp/pom.xml | 1 - 9 files changed, 9 deletions(-) diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 53d5c6e9641..48de7f48335 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -5,7 +5,6 @@ 7.6.0-SNAPSHOT 4.0.0 - org.eclipse.jetty jetty-http Jetty :: Http Utility diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 8a5f69852a6..548bab2f30a 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -5,7 +5,6 @@ 7.6.0-SNAPSHOT 4.0.0 - org.eclipse.jetty jetty-io Jetty :: IO Utility diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index 76e530cde78..aed5c0202e0 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-osgi-boot-jsp Jetty :: OSGi :: Boot JSP Jetty OSGi Boot JSP bundle diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 595e77a4b24..98a73a0ce47 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-osgi-boot-logback Jetty :: OSGi :: Boot Logback Jetty OSGi Boot Logback bundle diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index a0463cc5643..24e2cc919fa 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-osgi-boot-warurl Jetty :: OSGi :: Boot :: Warurl Jetty OSGi Boot-Warurl bundle diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index e389254295d..cb8f9d76281 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-httpservice Jetty :: OSGi :: HttpService Jetty OSGi HttpService bundle diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index f0ae38a1230..f2a0795b5db 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi test-jetty-osgi Jetty :: OSGi :: Test Jetty OSGi Integration test diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 64548024678..192234b2626 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -5,7 +5,6 @@ jetty-project 7.6.0-SNAPSHOT - org.eclipse.jetty jetty-policy Jetty :: Policy Tool jar diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 5c9fbf6c19b..4162b96e66e 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -5,7 +5,6 @@ 7.6.0-SNAPSHOT 4.0.0 - org.eclipse.jetty test-jetty-webapp Test :: Jetty Test Webapp war From e0f117f2a84a3fa6e7c0dae14c01136f7fb2f5de Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 9 Jan 2012 15:16:59 -0600 Subject: [PATCH 54/92] resolve another maven warning --- jetty-osgi/jetty-osgi-boot/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 87a7087125d..43ce529208f 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-osgi-boot Jetty :: OSGi :: Boot Jetty OSGi Boot bundle From 083c793b1c7f251fc67d464e9a2449530782e9d9 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 9 Jan 2012 15:18:25 -0600 Subject: [PATCH 55/92] http-spi is 1.6 compiler required for the interface when its part of the jvm being used for environment --- jetty-http-spi/pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 856673b86eb..cf4900757c7 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -31,6 +31,14 @@ + + maven-compiler-plugin + + 1.6 + 1.6 + false + + org.apache.felix maven-bundle-plugin From e4123d5d4876a2190e35274cafab352e774bbdd4 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 10 Jan 2012 17:47:14 +1100 Subject: [PATCH 56/92] 368215 Remove debug from jaspi --- .../jetty/security/jaspi/JaspiAuthenticator.java | 16 ---------------- .../jaspi/JaspiAuthenticatorFactory.java | 6 +----- .../security/jaspi/modules/BaseAuthModule.java | 1 - .../security/jaspi/modules/FormAuthModule.java | 12 ++---------- .../eclipse/jetty/security/SecurityHandler.java | 6 ++---- .../eclipse/jetty/security/ConstraintTest.java | 4 ---- 6 files changed, 5 insertions(+), 40 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index 526f53a0101..b932196a0ff 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -81,13 +81,6 @@ public class JaspiAuthenticator implements Authenticator public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException { - System.err.println("\nJaspiAuthenticator.validateRequest, uri=" + ((javax.servlet.http.HttpServletRequest) request).getRequestURI() - + " lazy=" - + _allowLazyAuthentication - + " mandatory=" - + mandatory); - new Throwable().printStackTrace(); - JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); @@ -96,16 +89,12 @@ public class JaspiAuthenticator implements Authenticator //if its not mandatory to authenticate, and the authenticator returned UNAUTHENTICATED, we treat it as authentication deferred if (_allowLazyAuthentication && !info.isAuthMandatory() && a == Authentication.UNAUTHENTICATED) a =_deferred; - - System.err.println("JaspiAuthenticator.validateRequest returning "+a); return a; } // most likely validatedUser is not needed here. public boolean secureResponse(ServletRequest req, ServletResponse res, boolean mandatory, User validatedUser) throws ServerAuthException { - System.err.println("JaspiAuthenticator.secureResponse uri=" + ((javax.servlet.http.HttpServletRequest) req).getRequestURI()); - JaspiMessageInfo info = (JaspiMessageInfo) req.getAttribute("org.eclipse.jetty.security.jaspi.info"); if (info == null) throw new NullPointerException("MessageInfo from request missing: " + req); return secureResponse(info, validatedUser); @@ -116,14 +105,11 @@ public class JaspiAuthenticator implements Authenticator { try { - System.err.println("jaspAuthenticator.validateRequest(info)"); String authContextId = _authConfig.getAuthContextID(messageInfo); ServerAuthContext authContext = _authConfig.getAuthContext(authContextId, _serviceSubject, _authProperties); Subject clientSubject = new Subject(); AuthStatus authStatus = authContext.validateRequest(messageInfo, clientSubject, _serviceSubject); - // String authMethod = - // (String)messageInfo.getMap().get(JaspiMessageInfo.AUTH_METHOD_KEY); if (authStatus == AuthStatus.SEND_CONTINUE) return Authentication.SEND_CONTINUE; if (authStatus == AuthStatus.SEND_FAILURE) return Authentication.SEND_FAILURE; @@ -188,8 +174,6 @@ public class JaspiAuthenticator implements Authenticator } catch (AuthException e) { - System.err.println("Error in JaspiAuthenticator.secureResponse"); - e.printStackTrace(); throw new ServerAuthException(e); } } diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java index c645ffa85a2..cab6251af26 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java @@ -97,14 +97,10 @@ public class JaspiAuthenticatorFactory extends DefaultAuthenticatorFactory Subject serviceSubject=findServiceSubject(server); String serverName=findServerName(server,serviceSubject); - - System.err.println("authconfigfactory="+authConfigFactory+" serviceSubject="+serviceSubject+" serverName="+serverName); - String appContext = serverName + " " + context.getContextPath(); - System.err.println("appcontext="+appContext); AuthConfigProvider authConfigProvider = authConfigFactory.getConfigProvider(MESSAGE_LAYER,appContext,listener); - System.err.println("authconfigProvider="+authConfigProvider); + if (authConfigProvider != null) { ServletCallbackHandler servletCallbackHandler = new ServletCallbackHandler(loginService); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java index 4eb1ad6e256..7afd61c4c38 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java @@ -131,7 +131,6 @@ public class BaseAuthModule implements ServerAuthModule, ServerAuthContext if (credValidationCallback.getResult()) { Set loginCallbacks = clientSubject.getPrivateCredentials(LoginCallbackImpl.class); - System.err.println("LoginCallbackImpls.isEmpty="+loginCallbacks.isEmpty()); if (!loginCallbacks.isEmpty()) { LoginCallbackImpl loginCallback = loginCallbacks.iterator().next(); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index be390555742..bb813be6493 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -158,8 +158,6 @@ public class FormAuthModule extends BaseAuthModule boolean mandatory = isMandatory(messageInfo); mandatory |= isJSecurityCheck(uri); HttpSession session = request.getSession(mandatory); - - System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo()))); // not mandatory or its the login or login error page don't authenticate if (!mandatory || isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo()))) return AuthStatus.SUCCESS; @@ -171,7 +169,7 @@ public class FormAuthModule extends BaseAuthModule { final String username = request.getParameter(__J_USERNAME); final String password = request.getParameter(__J_PASSWORD); - System.err.println("Try login username="+username+" password="+password); + boolean success = tryLogin(messageInfo, clientSubject, response, session, username, new Password(password)); if (success) { @@ -189,7 +187,6 @@ public class FormAuthModule extends BaseAuthModule nuri = URIUtil.SLASH; } - System.err.println("FormAuthModule succesful login, sending redirect to "+nuri); response.setContentLength(0); response.sendRedirect(response.encodeRedirectURL(nuri)); return AuthStatus.SEND_CONTINUE; @@ -215,8 +212,6 @@ public class FormAuthModule extends BaseAuthModule FormCredential form_cred = (FormCredential) session.getAttribute(__J_AUTHENTICATED); if (form_cred != null) { - System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); - //TODO: we would like the form auth module to be able to invoke the loginservice.validate() method to check the previously authed user boolean success = tryLogin(messageInfo, clientSubject, response, session, form_cred._jUserName, new Password(new String(form_cred._jPassword))); @@ -249,7 +244,6 @@ public class FormAuthModule extends BaseAuthModule session.setAttribute(__J_URI, buf.toString()); } - System.err.println("Redirecting to login page "+_formLoginPage+" and remembering juri="+buf.toString()); response.setContentLength(0); response.sendRedirect(response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(), _formLoginPage))); return AuthStatus.SEND_CONTINUE; @@ -288,12 +282,11 @@ public class FormAuthModule extends BaseAuthModule { char[] pwdChars = password.toString().toCharArray(); Set loginCallbacks = clientSubject.getPrivateCredentials(LoginCallbackImpl.class); - System.err.println("FormAuthModule, LoginCallbackImpl.isEmpty="+loginCallbacks.isEmpty()); + if (!loginCallbacks.isEmpty()) { LoginCallbackImpl loginCallback = loginCallbacks.iterator().next(); FormCredential form_cred = new FormCredential(username, pwdChars, loginCallback.getUserPrincipal(), loginCallback.getSubject()); - session.setAttribute(__J_AUTHENTICATED, form_cred); } @@ -310,7 +303,6 @@ public class FormAuthModule extends BaseAuthModule public boolean isLoginOrErrorPage(String pathInContext) { - System.err.println("ISLOGINORERRORPAGE? "+pathInContext+" error: "+_formErrorPath+" login:"+_formLoginPath); return pathInContext != null && (pathInContext.equals(_formErrorPath) || pathInContext.equals(_formLoginPath)); } diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java index 6a4b837783f..7e4232c5795 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java @@ -318,13 +318,11 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti if (!_loginServiceShared && _loginService instanceof LifeCycle) ((LifeCycle)_loginService).start(); - System.err.println("authenticator="+_authenticator+" authenticatorFactory="+_authenticatorFactory+" identityService="+_identityService); if (_authenticator==null && _authenticatorFactory!=null && _identityService!=null) { _authenticator=_authenticatorFactory.getAuthenticator(getServer(),ContextHandler.getCurrentContext(),this, _identityService, _loginService); if (_authenticator!=null) _authMethod=_authenticator.getAuthMethod(); - System.err.println("Called auth factory, authenticator="+_authenticator); } if (_authenticator==null) @@ -479,7 +477,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti deferred.setIdentityService(_identityService); deferred.setLoginService(_loginService); baseRequest.setAuthentication(authentication); -System.err.println("uri="+baseRequest.getUri()+" Auth is deferred"); + try { handler.handle(pathInContext, baseRequest, request, response); @@ -489,7 +487,7 @@ System.err.println("uri="+baseRequest.getUri()+" Auth is deferred"); previousIdentity = deferred.getPreviousAssociation(); deferred.setIdentityService(null); } - System.err.println("Securityhandler calling secureResponse, for Authentication.User"); + Authentication auth=baseRequest.getAuthentication(); if (auth instanceof Authentication.User) { diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java index 47190675b63..7fdf357ca7b 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java @@ -835,11 +835,7 @@ public class ConstraintTest assertTrue(response.startsWith("HTTP/1.1 200 ")); response = _connector.getResponses("GET /ctx/forbid/post HTTP/1.0\r\n\r\n"); - System.err.println(response); assertTrue(response.startsWith("HTTP/1.1 200 ")); // This is so stupid, but it is the S P E C - - - } private class RequestHandler extends AbstractHandler { From 968a2ac95b9bbf5c8af0b1e708f2bc741532e39d Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 00:09:34 +1100 Subject: [PATCH 57/92] 368240: Added concept of join to AggregateLifeCycle. Used by HttpClient and AbstractConnector --- .../org/eclipse/jetty/client/HttpClient.java | 177 +++++++---- .../eclipse/jetty/client/SelectConnector.java | 6 +- .../org/eclipse/jetty/http/HttpBuffers.java | 164 ++-------- .../eclipse/jetty/http/HttpBuffersImpl.java | 233 ++++++++++++++ .../org/eclipse/jetty/io/AbstractBuffers.java | 8 +- .../org/eclipse/jetty/io/PooledBuffers.java | 9 + .../eclipse/jetty/io/nio/SelectorManager.java | 3 + .../jetty/rewrite/handler/ProxyRuleTest.java | 4 +- .../jetty/server/AbstractConnector.java | 127 ++++++-- .../server/nio/AbstractNIOConnector.java | 12 +- .../server/nio/SelectChannelConnector.java | 39 +-- .../server/ssl/SslSelectChannelConnector.java | 3 +- .../util/component/AggregateLifeCycle.java | 291 ++++++++++++++---- .../jetty/util/ssl/SslContextFactory.java | 8 +- .../component/AggregateLifeCycleTest.java | 106 +++++++ 15 files changed, 863 insertions(+), 327 deletions(-) create mode 100644 jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffersImpl.java diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java index 21e8b0f89e9..baad2e962f7 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java @@ -29,7 +29,9 @@ import org.eclipse.jetty.client.security.Authentication; import org.eclipse.jetty.client.security.RealmResolver; import org.eclipse.jetty.client.security.SecurityListener; import org.eclipse.jetty.http.HttpBuffers; +import org.eclipse.jetty.http.HttpBuffersImpl; import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.Buffers.Type; import org.eclipse.jetty.util.Attributes; import org.eclipse.jetty.util.AttributesMap; @@ -66,7 +68,7 @@ import org.eclipse.jetty.util.thread.Timeout; * @see HttpExchange * @see HttpDestination */ -public class HttpClient extends HttpBuffers implements Attributes, Dumpable +public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attributes, Dumpable { public static final int CONNECTOR_SOCKET = 0; public static final int CONNECTOR_SELECT_CHANNEL = 2; @@ -91,43 +93,46 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable private int _maxRedirects = 20; private LinkedList _registeredListeners; - private SslContextFactory _sslContextFactory; + private final SslContextFactory _sslContextFactory; private RealmResolver _realmResolver; private AttributesMap _attributes=new AttributesMap(); + private final HttpBuffersImpl _buffers= new HttpBuffersImpl(); /* ------------------------------------------------------------------------------- */ private void setBufferTypes() { if (_connectorType==CONNECTOR_SOCKET) { - setRequestBufferType(Type.BYTE_ARRAY); - setRequestHeaderType(Type.BYTE_ARRAY); - setResponseBufferType(Type.BYTE_ARRAY); - setResponseHeaderType(Type.BYTE_ARRAY); + _buffers.setRequestBufferType(Type.BYTE_ARRAY); + _buffers.setRequestHeaderType(Type.BYTE_ARRAY); + _buffers.setResponseBufferType(Type.BYTE_ARRAY); + _buffers.setResponseHeaderType(Type.BYTE_ARRAY); } else { - setRequestBufferType(Type.DIRECT); - setRequestHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT); - setResponseBufferType(Type.DIRECT); - setResponseHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT); + _buffers.setRequestBufferType(Type.DIRECT); + _buffers.setRequestHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT); + _buffers.setResponseBufferType(Type.DIRECT); + _buffers.setResponseHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT); } + } /* ------------------------------------------------------------------------------- */ public HttpClient() { this(new SslContextFactory()); - setBufferTypes(); } /* ------------------------------------------------------------------------------- */ public HttpClient(SslContextFactory sslContextFactory) { _sslContextFactory = sslContextFactory; + addBean(_sslContextFactory); + addBean(_buffers); setBufferTypes(); } @@ -149,25 +154,6 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable _connectBlocking = connectBlocking; } - /* ------------------------------------------------------------ */ - /** - * @see org.eclipse.jetty.util.component.Dumpable#dump() - */ - public String dump() - { - return AggregateLifeCycle.dump(this); - } - - /* ------------------------------------------------------------ */ - /** - * @see org.eclipse.jetty.util.component.Dumpable#dump(java.lang.Appendable, java.lang.String) - */ - public void dump(Appendable out, String indent) throws IOException - { - out.append(String.valueOf(this)).append("\n"); - AggregateLifeCycle.dump(out,indent,Arrays.asList(_threadPool,_connector),_destinations.values()); - } - /* ------------------------------------------------------------------------------- */ public void send(HttpExchange exchange) throws IOException { @@ -190,6 +176,7 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable pool.setDaemon(true); pool.setName("HttpClient"); _threadPool = pool; + addBean(_threadPool,true); } return _threadPool; @@ -201,7 +188,9 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable */ public void setThreadPool(ThreadPool threadPool) { + removeBean(_threadPool); _threadPool = threadPool; + addBean(_threadPool); } @@ -338,6 +327,7 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable } + /* ------------------------------------------------------------ */ /** * Registers a listener that can listen to the stream of execution between the client and the * server and influence events. Sequential calls to the method wrapper sequentially wrap the preceding @@ -422,7 +412,6 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable protected void doStart() throws Exception { setBufferTypes(); - super.doStart(); _timeoutQ.setDuration(_timeout); _timeoutQ.setNow(); @@ -432,24 +421,12 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable if (_threadPool == null) getThreadPool(); - if (_threadPool instanceof LifeCycle) - { - ((LifeCycle)_threadPool).start(); - } - - _sslContextFactory.start(); - - if (_connectorType == CONNECTOR_SELECT_CHANNEL) - { - - _connector = new SelectConnector(this); - } - else - { - _connector = new SocketConnector(this); - } - _connector.start(); - + + _connector=(_connectorType == CONNECTOR_SELECT_CHANNEL)?new SelectConnector(this):new SocketConnector(this); + addBean(_connector,true); + + super.doStart(); + _threadPool.dispatch(new Runnable() { public void run() @@ -480,14 +457,6 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable @Override protected void doStop() throws Exception { - _connector.stop(); - _connector = null; - _sslContextFactory.stop(); - - if (_threadPool instanceof LifeCycle) - { - ((LifeCycle)_threadPool).stop(); - } for (HttpDestination destination : _destinations.values()) { destination.close(); @@ -496,6 +465,8 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable _timeoutQ.cancelAll(); _idleTimeoutQ.cancelAll(); super.doStop(); + _connector = null; + removeBean(_connector); } /* ------------------------------------------------------------ */ @@ -667,6 +638,98 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable _maxRedirects = redirects; } + + + public int getRequestBufferSize() + { + return _buffers.getRequestBufferSize(); + } + + public void setRequestBufferSize(int requestBufferSize) + { + _buffers.setRequestBufferSize(requestBufferSize); + } + + public int getRequestHeaderSize() + { + return _buffers.getRequestHeaderSize(); + } + + public void setRequestHeaderSize(int requestHeaderSize) + { + _buffers.setRequestHeaderSize(requestHeaderSize); + } + + public int getResponseBufferSize() + { + return _buffers.getResponseBufferSize(); + } + + public void setResponseBufferSize(int responseBufferSize) + { + _buffers.setResponseBufferSize(responseBufferSize); + } + + public int getResponseHeaderSize() + { + return _buffers.getResponseHeaderSize(); + } + + public void setResponseHeaderSize(int responseHeaderSize) + { + _buffers.setResponseHeaderSize(responseHeaderSize); + } + + public Type getRequestBufferType() + { + return _buffers.getRequestBufferType(); + } + + public Type getRequestHeaderType() + { + return _buffers.getRequestHeaderType(); + } + + public Type getResponseBufferType() + { + return _buffers.getResponseBufferType(); + } + + public Type getResponseHeaderType() + { + return _buffers.getResponseHeaderType(); + } + + public void setRequestBuffers(Buffers requestBuffers) + { + _buffers.setRequestBuffers(requestBuffers); + } + + public void setResponseBuffers(Buffers responseBuffers) + { + _buffers.setResponseBuffers(responseBuffers); + } + + public Buffers getRequestBuffers() + { + return _buffers.getRequestBuffers(); + } + + public Buffers getResponseBuffers() + { + return _buffers.getResponseBuffers(); + } + + public void setMaxBuffers(int maxBuffers) + { + _buffers.setMaxBuffers(maxBuffers); + } + + public int getMaxBuffers() + { + return _buffers.getMaxBuffers(); + } + /* ------------------------------------------------------------ */ @Deprecated public String getTrustStoreLocation() diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index b3c93a7dee8..892991bd964 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -97,9 +97,9 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, if (_httpClient.isConnectBlocking()) { - channel.socket().connect(address.toSocketAddress(), _httpClient.getConnectTimeout()); - channel.configureBlocking(false); - _selectorManager.register( channel, destination ); + channel.socket().connect(address.toSocketAddress(), _httpClient.getConnectTimeout()); + channel.configureBlocking(false); + _selectorManager.register( channel, destination ); } else { diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffers.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffers.java index 28c5ad13bdf..a502e72567f 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffers.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffers.java @@ -19,211 +19,85 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle; /* ------------------------------------------------------------ */ /** Abstract Buffer pool. - * simple unbounded pool of buffers for header, request and response sizes. - * */ -public class HttpBuffers extends AbstractLifeCycle +public interface HttpBuffers { - private int _requestBufferSize=16*1024; - private int _requestHeaderSize=6*1024; - private int _responseBufferSize=32*1024; - private int _responseHeaderSize=6*1024; - private int _maxBuffers=1024; - - private Buffers.Type _requestBufferType=Buffers.Type.BYTE_ARRAY; - private Buffers.Type _requestHeaderType=Buffers.Type.BYTE_ARRAY; - private Buffers.Type _responseBufferType=Buffers.Type.BYTE_ARRAY; - private Buffers.Type _responseHeaderType=Buffers.Type.BYTE_ARRAY; - - private Buffers _requestBuffers; - private Buffers _responseBuffers; - - - public HttpBuffers() - { - super(); - } - /** * @return the requestBufferSize */ - public int getRequestBufferSize() - { - return _requestBufferSize; - } + public int getRequestBufferSize(); /** * @param requestBufferSize the requestBufferSize to set */ - public void setRequestBufferSize(int requestBufferSize) - { - _requestBufferSize = requestBufferSize; - } + public void setRequestBufferSize(int requestBufferSize); /** * @return the requestHeaderSize */ - public int getRequestHeaderSize() - { - return _requestHeaderSize; - } + public int getRequestHeaderSize(); /** * @param requestHeaderSize the requestHeaderSize to set */ - public void setRequestHeaderSize(int requestHeaderSize) - { - _requestHeaderSize = requestHeaderSize; - } + public void setRequestHeaderSize(int requestHeaderSize); /** * @return the responseBufferSize */ - public int getResponseBufferSize() - { - return _responseBufferSize; - } + public int getResponseBufferSize(); /** * @param responseBufferSize the responseBufferSize to set */ - public void setResponseBufferSize(int responseBufferSize) - { - _responseBufferSize = responseBufferSize; - } + public void setResponseBufferSize(int responseBufferSize); /** * @return the responseHeaderSize */ - public int getResponseHeaderSize() - { - return _responseHeaderSize; - } + public int getResponseHeaderSize(); /** * @param responseHeaderSize the responseHeaderSize to set */ - public void setResponseHeaderSize(int responseHeaderSize) - { - _responseHeaderSize = responseHeaderSize; - } + public void setResponseHeaderSize(int responseHeaderSize); /** * @return the requestBufferType */ - public Buffers.Type getRequestBufferType() - { - return _requestBufferType; - } - - /** - * @param requestBufferType the requestBufferType to set - */ - protected void setRequestBufferType(Buffers.Type requestBufferType) - { - _requestBufferType = requestBufferType; - } + public Buffers.Type getRequestBufferType(); /** * @return the requestHeaderType */ - public Buffers.Type getRequestHeaderType() - { - return _requestHeaderType; - } - - /** - * @param requestHeaderType the requestHeaderType to set - */ - protected void setRequestHeaderType(Buffers.Type requestHeaderType) - { - _requestHeaderType = requestHeaderType; - } + public Buffers.Type getRequestHeaderType(); /** * @return the responseBufferType */ - public Buffers.Type getResponseBufferType() - { - return _responseBufferType; - } - - /** - * @param responseBufferType the responseBufferType to set - */ - protected void setResponseBufferType(Buffers.Type responseBufferType) - { - _responseBufferType = responseBufferType; - } + public Buffers.Type getResponseBufferType(); /** * @return the responseHeaderType */ - public Buffers.Type getResponseHeaderType() - { - return _responseHeaderType; - } - - /** - * @param responseHeaderType the responseHeaderType to set - */ - protected void setResponseHeaderType(Buffers.Type responseHeaderType) - { - _responseHeaderType = responseHeaderType; - } + public Buffers.Type getResponseHeaderType(); /** * @param requestBuffers the requestBuffers to set */ - public void setRequestBuffers(Buffers requestBuffers) - { - _requestBuffers = requestBuffers; - } + public void setRequestBuffers(Buffers requestBuffers); /** * @param responseBuffers the responseBuffers to set */ - public void setResponseBuffers(Buffers responseBuffers) - { - _responseBuffers = responseBuffers; - } + public void setResponseBuffers(Buffers responseBuffers); - @Override - protected void doStart() - throws Exception - { - _requestBuffers=BuffersFactory.newBuffers(_requestHeaderType,_requestHeaderSize,_requestBufferType,_requestBufferSize,_requestBufferType,getMaxBuffers()); - _responseBuffers=BuffersFactory.newBuffers(_responseHeaderType,_responseHeaderSize,_responseBufferType,_responseBufferSize,_responseBufferType,getMaxBuffers()); - super.doStart(); - } - - @Override - protected void doStop() - throws Exception - { - _requestBuffers=null; - _responseBuffers=null; - } + public Buffers getRequestBuffers(); - public Buffers getRequestBuffers() - { - return _requestBuffers; - } - + public Buffers getResponseBuffers(); - public Buffers getResponseBuffers() - { - return _responseBuffers; - } + public void setMaxBuffers(int maxBuffers); - public void setMaxBuffers(int maxBuffers) - { - _maxBuffers = maxBuffers; - } - - public int getMaxBuffers() - { - return _maxBuffers; - } + public int getMaxBuffers(); } diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffersImpl.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffersImpl.java new file mode 100644 index 00000000000..43db337e73c --- /dev/null +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffersImpl.java @@ -0,0 +1,233 @@ +// ======================================================================== +// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.http; + +import org.eclipse.jetty.io.Buffers; +import org.eclipse.jetty.io.BuffersFactory; +import org.eclipse.jetty.util.component.AbstractLifeCycle; + +/* ------------------------------------------------------------ */ +/** Abstract Buffer pool. + * simple unbounded pool of buffers for header, request and response sizes. + * + */ +public class HttpBuffersImpl extends AbstractLifeCycle implements HttpBuffers +{ + private int _requestBufferSize=16*1024; + private int _requestHeaderSize=6*1024; + private int _responseBufferSize=32*1024; + private int _responseHeaderSize=6*1024; + private int _maxBuffers=1024; + + private Buffers.Type _requestBufferType=Buffers.Type.BYTE_ARRAY; + private Buffers.Type _requestHeaderType=Buffers.Type.BYTE_ARRAY; + private Buffers.Type _responseBufferType=Buffers.Type.BYTE_ARRAY; + private Buffers.Type _responseHeaderType=Buffers.Type.BYTE_ARRAY; + + private Buffers _requestBuffers; + private Buffers _responseBuffers; + + + public HttpBuffersImpl() + { + super(); + } + + /** + * @return the requestBufferSize + */ + public int getRequestBufferSize() + { + return _requestBufferSize; + } + + /** + * @param requestBufferSize the requestBufferSize to set + */ + public void setRequestBufferSize(int requestBufferSize) + { + _requestBufferSize = requestBufferSize; + } + + /** + * @return the requestHeaderSize + */ + public int getRequestHeaderSize() + { + return _requestHeaderSize; + } + + /** + * @param requestHeaderSize the requestHeaderSize to set + */ + public void setRequestHeaderSize(int requestHeaderSize) + { + _requestHeaderSize = requestHeaderSize; + } + + /** + * @return the responseBufferSize + */ + public int getResponseBufferSize() + { + return _responseBufferSize; + } + + /** + * @param responseBufferSize the responseBufferSize to set + */ + public void setResponseBufferSize(int responseBufferSize) + { + _responseBufferSize = responseBufferSize; + } + + /** + * @return the responseHeaderSize + */ + public int getResponseHeaderSize() + { + return _responseHeaderSize; + } + + /** + * @param responseHeaderSize the responseHeaderSize to set + */ + public void setResponseHeaderSize(int responseHeaderSize) + { + _responseHeaderSize = responseHeaderSize; + } + + /** + * @return the requestBufferType + */ + public Buffers.Type getRequestBufferType() + { + return _requestBufferType; + } + + /** + * @param requestBufferType the requestBufferType to set + */ + public void setRequestBufferType(Buffers.Type requestBufferType) + { + _requestBufferType = requestBufferType; + } + + /** + * @return the requestHeaderType + */ + public Buffers.Type getRequestHeaderType() + { + return _requestHeaderType; + } + + /** + * @param requestHeaderType the requestHeaderType to set + */ + public void setRequestHeaderType(Buffers.Type requestHeaderType) + { + _requestHeaderType = requestHeaderType; + } + + /** + * @return the responseBufferType + */ + public Buffers.Type getResponseBufferType() + { + return _responseBufferType; + } + + /** + * @param responseBufferType the responseBufferType to set + */ + public void setResponseBufferType(Buffers.Type responseBufferType) + { + _responseBufferType = responseBufferType; + } + + /** + * @return the responseHeaderType + */ + public Buffers.Type getResponseHeaderType() + { + return _responseHeaderType; + } + + /** + * @param responseHeaderType the responseHeaderType to set + */ + public void setResponseHeaderType(Buffers.Type responseHeaderType) + { + _responseHeaderType = responseHeaderType; + } + + /** + * @param requestBuffers the requestBuffers to set + */ + public void setRequestBuffers(Buffers requestBuffers) + { + _requestBuffers = requestBuffers; + } + + /** + * @param responseBuffers the responseBuffers to set + */ + public void setResponseBuffers(Buffers responseBuffers) + { + _responseBuffers = responseBuffers; + } + + @Override + protected void doStart() + throws Exception + { + _requestBuffers=BuffersFactory.newBuffers(_requestHeaderType,_requestHeaderSize,_requestBufferType,_requestBufferSize,_requestBufferType,getMaxBuffers()); + _responseBuffers=BuffersFactory.newBuffers(_responseHeaderType,_responseHeaderSize,_responseBufferType,_responseBufferSize,_responseBufferType,getMaxBuffers()); + super.doStart(); + } + + @Override + protected void doStop() + throws Exception + { + _requestBuffers=null; + _responseBuffers=null; + } + + public Buffers getRequestBuffers() + { + return _requestBuffers; + } + + + public Buffers getResponseBuffers() + { + return _responseBuffers; + } + + public void setMaxBuffers(int maxBuffers) + { + _maxBuffers = maxBuffers; + } + + public int getMaxBuffers() + { + return _maxBuffers; + } + + public String toString() + { + return _requestBuffers+"/"+_responseBuffers; + } +} diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java index ef828361357..bc24d078ae9 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java @@ -2,6 +2,7 @@ package org.eclipse.jetty.io; import org.eclipse.jetty.io.nio.DirectNIOBuffer; import org.eclipse.jetty.io.nio.IndirectNIOBuffer; +import org.omg.stub.java.rmi._Remote_Stub; public abstract class AbstractBuffers implements Buffers { @@ -141,5 +142,10 @@ public abstract class AbstractBuffers implements Buffers } return false; } - + + /* ------------------------------------------------------------ */ + public String toString() + { + return this.getClass().getSimpleName()+"["+_headerSize+","+_bufferSize+"]"; + } } \ No newline at end of file diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java b/jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java index 90f297e73d4..9c476312544 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java @@ -92,4 +92,13 @@ public class PooledBuffers extends AbstractBuffers _others.add(buffer); } } + + public String toString() + { + return this.getClass().getSimpleName()+ + "["+ + _headers.size()+"/"+_maxSize+"@"+_headerSize+","+ + _buffers.size()+"/"+_maxSize+"@"+_bufferSize+","+ + _others.size()+"/"+_maxSize+"@-]"; + } } diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java index eaeabc88624..dd101e9fbc1 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java @@ -938,6 +938,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa final ArrayList dump = new ArrayList(selector.keys().size()*2); dump.add(where); + /* final CountDownLatch latch = new CountDownLatch(1); addChange(new ChangeTask() @@ -957,6 +958,8 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa { LOG.ignore(e); } + */ + AggregateLifeCycle.dump(out,indent,dump); } } diff --git a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java index 9cb9def596a..85cab0f2ba0 100644 --- a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java +++ b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java @@ -31,6 +31,7 @@ import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.nio.SelectChannelConnector; +import org.eclipse.jetty.util.log.Log; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -87,7 +88,8 @@ public class ProxyRuleTest @Test public void testProxy() throws Exception { - + Log.getLogger("org.eclipse.jetty.client").setDebugEnabled(true); + ContentExchange exchange = new ContentExchange(true); exchange.setMethod(HttpMethods.GET); String body = "BODY"; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index 6f349ca4f8b..acc51a1c4cb 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -22,9 +22,12 @@ import java.util.concurrent.atomic.AtomicLong; import javax.servlet.ServletRequest; import org.eclipse.jetty.http.HttpBuffers; +import org.eclipse.jetty.http.HttpBuffersImpl; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.io.Buffers; +import org.eclipse.jetty.io.Buffers.Type; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EofException; @@ -51,7 +54,7 @@ import org.eclipse.jetty.util.thread.ThreadPool; * * */ -public abstract class AbstractConnector extends HttpBuffers implements Connector, Dumpable +public abstract class AbstractConnector extends AggregateLifeCycle implements HttpBuffers, Connector, Dumpable { private static final Logger LOG = Log.getLogger(AbstractConnector.class); @@ -95,11 +98,14 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector /** duration of a connection */ private final SampleStatistic _connectionDurationStats = new SampleStatistic(); + protected final HttpBuffersImpl _buffers = new HttpBuffersImpl(); + /* ------------------------------------------------------------ */ /** */ public AbstractConnector() { + addBean(_buffers); } /* ------------------------------------------------------------ */ @@ -125,7 +131,9 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector /* ------------------------------------------------------------ */ public void setThreadPool(ThreadPool pool) { + removeBean(_threadPool); _threadPool = pool; + addBean(_threadPool); } /* ------------------------------------------------------------ */ @@ -299,12 +307,13 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector // open listener port open(); - super.doStart(); - if (_threadPool == null) + { _threadPool = _server.getThreadPool(); - if (_threadPool != _server.getThreadPool() && (_threadPool instanceof LifeCycle)) - ((LifeCycle)_threadPool).start(); + addBean(_threadPool,false); + } + + super.doStart(); // Start selector thread synchronized (this) @@ -333,9 +342,6 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector LOG.warn(e); } - if (_threadPool != _server.getThreadPool() && _threadPool instanceof LifeCycle) - ((LifeCycle)_threadPool).stop(); - super.doStop(); Thread[] acceptors = null; @@ -785,6 +791,98 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector { _forwardedSslSessionIdHeader = forwardedSslSessionId; } + + + + public int getRequestBufferSize() + { + return _buffers.getRequestBufferSize(); + } + + public void setRequestBufferSize(int requestBufferSize) + { + _buffers.setRequestBufferSize(requestBufferSize); + } + + public int getRequestHeaderSize() + { + return _buffers.getRequestHeaderSize(); + } + + public void setRequestHeaderSize(int requestHeaderSize) + { + _buffers.setRequestHeaderSize(requestHeaderSize); + } + + public int getResponseBufferSize() + { + return _buffers.getResponseBufferSize(); + } + + public void setResponseBufferSize(int responseBufferSize) + { + _buffers.setResponseBufferSize(responseBufferSize); + } + + public int getResponseHeaderSize() + { + return _buffers.getResponseHeaderSize(); + } + + public void setResponseHeaderSize(int responseHeaderSize) + { + _buffers.setResponseHeaderSize(responseHeaderSize); + } + + public Type getRequestBufferType() + { + return _buffers.getRequestBufferType(); + } + + public Type getRequestHeaderType() + { + return _buffers.getRequestHeaderType(); + } + + public Type getResponseBufferType() + { + return _buffers.getResponseBufferType(); + } + + public Type getResponseHeaderType() + { + return _buffers.getResponseHeaderType(); + } + + public void setRequestBuffers(Buffers requestBuffers) + { + _buffers.setRequestBuffers(requestBuffers); + } + + public void setResponseBuffers(Buffers responseBuffers) + { + _buffers.setResponseBuffers(responseBuffers); + } + + public Buffers getRequestBuffers() + { + return _buffers.getRequestBuffers(); + } + + public Buffers getResponseBuffers() + { + return _buffers.getResponseBuffers(); + } + + public void setMaxBuffers(int maxBuffers) + { + _buffers.setMaxBuffers(maxBuffers); + } + + public int getMaxBuffers() + { + return _buffers.getMaxBuffers(); + } /* ------------------------------------------------------------ */ @Override @@ -1118,17 +1216,4 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector oldValue = valueHolder.get(); } } - - /* ------------------------------------------------------------ */ - public String dump() - { - return AggregateLifeCycle.dump(this); - } - - /* ------------------------------------------------------------ */ - public void dump(Appendable out, String indent) throws IOException - { - out.append(String.valueOf(this)).append("\n"); - } - } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java index 4fc4d1a301c..2083c5d3714 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java @@ -27,10 +27,10 @@ import org.eclipse.jetty.server.AbstractConnector; public abstract class AbstractNIOConnector extends AbstractConnector implements NIOConnector { { - setRequestBufferType(Type.DIRECT); - setRequestHeaderType(Type.INDIRECT); - setResponseBufferType(Type.DIRECT); - setResponseHeaderType(Type.INDIRECT); + _buffers.setRequestBufferType(Type.DIRECT); + _buffers.setRequestHeaderType(Type.INDIRECT); + _buffers.setResponseBufferType(Type.DIRECT); + _buffers.setResponseHeaderType(Type.INDIRECT); } /* ------------------------------------------------------------------------------- */ @@ -46,8 +46,8 @@ public abstract class AbstractNIOConnector extends AbstractConnector implements */ public void setUseDirectBuffers(boolean direct) { - setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT); - setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT); + _buffers.setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT); + _buffers.setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT); } } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java index b6165d45fdf..9cf3ede1fef 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java @@ -82,6 +82,7 @@ public class SelectChannelConnector extends AbstractNIOConnector public SelectChannelConnector() { _manager.setMaxIdleTime(getMaxIdleTime()); + addBean(_manager,true); setAcceptors(Math.max(1,(Runtime.getRuntime().availableProcessors()+3)/4)); } @@ -111,7 +112,11 @@ public class SelectChannelConnector extends AbstractNIOConnector synchronized(this) { if (_acceptChannel != null) - _acceptChannel.close(); + { + removeBean(_acceptChannel); + if (_acceptChannel.isOpen()) + _acceptChannel.close(); + } _acceptChannel = null; _localPort=-2; } @@ -177,6 +182,8 @@ public class SelectChannelConnector extends AbstractNIOConnector _localPort=_acceptChannel.socket().getLocalPort(); if (_localPort<=0) throw new IOException("Server channel not bound"); + + addBean(_acceptChannel); } } @@ -250,7 +257,6 @@ public class SelectChannelConnector extends AbstractNIOConnector _manager.setLowResourcesMaxIdleTime(getLowResourcesMaxIdleTime()); super.doStart(); - _manager.start(); } /* ------------------------------------------------------------ */ @@ -260,20 +266,7 @@ public class SelectChannelConnector extends AbstractNIOConnector @Override protected void doStop() throws Exception { - synchronized(this) - { - if(_manager.isRunning()) - { - try - { - _manager.stop(); - } - catch (Exception e) - { - LOG.warn(e); - } - } - } + close(); super.doStop(); } @@ -297,20 +290,6 @@ public class SelectChannelConnector extends AbstractNIOConnector return new AsyncHttpConnection(SelectChannelConnector.this,endpoint,getServer()); } - /* ------------------------------------------------------------ */ - public void dump(Appendable out, String indent) throws IOException - { - super.dump(out, indent); - ServerSocketChannel channel; - synchronized (this) - { - channel=_acceptChannel; - } - if (channel==null) - AggregateLifeCycle.dump(out,indent,Arrays.asList(null,"CLOSED",_manager)); - else - AggregateLifeCycle.dump(out,indent,Arrays.asList(channel,channel.isOpen()?"OPEN":"CLOSED",_manager)); - } /* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */ diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java index 1986e7bc08d..e7746cbb5c6 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java @@ -57,6 +57,7 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements public SslSelectChannelConnector(SslContextFactory sslContextFactory) { _sslContextFactory = sslContextFactory; + addBean(_sslContextFactory); setUseDirectBuffers(false); setSoLingerTime(30000); } @@ -597,7 +598,6 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements protected void doStart() throws Exception { _sslContextFactory.checkKeyStore(); - _sslContextFactory.start(); SSLEngine sslEngine = _sslContextFactory.newSslEngine(); @@ -627,7 +627,6 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements @Override protected void doStop() throws Exception { - _sslContextFactory.stop(); _sslBuffers=null; super.doStop(); } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java index 8e14c84b7d0..281779a5241 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java @@ -12,92 +12,242 @@ import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; /** - * An AggregateLifeCycle is an AbstractLifeCycle with a collection of dependent beans. + * An AggregateLifeCycle is an {@link LifeCycle} implementation for a collection of contained beans. + *

      + * Beans can be added the AggregateLifeCycle either as joined beans, as disjoint beans. A joined bean is started, stopped and destroyed with the aggregate. + * A disjointed bean is associated with the aggregate for the purposes of {@link #dump()}, but it's lifecycle must be managed externally. + *

      + * When a bean is added, if it is a {@link LifeCycle} and it is already started, then it is assumed to be a disjoined bean. + * Otherwise the methods {@link #addBean(LifeCycle, boolean)}, {@link #join(LifeCycle)} and {@link #disjoin(LifeCycle)} can be used to + * explicitly control the life cycle relationship. *

      - * Dependent beans are started and stopped with the {@link LifeCycle} and if they are destroyed if they are also {@link Destroyable}. - * */ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable, Dumpable { private static final Logger LOG = Log.getLogger(AggregateLifeCycle.class); - private final List _dependentBeans=new CopyOnWriteArrayList(); + private final List _beans=new CopyOnWriteArrayList(); - public void destroy() + private class Bean { - for (Object o : _dependentBeans) + Bean(Object b) { - if (o instanceof Destroyable) - { - ((Destroyable)o).destroy(); - } + _bean=b; } - _dependentBeans.clear(); + final Object _bean; + volatile boolean _joined=true; } + /* ------------------------------------------------------------ */ + /** + * Start the joined lifecycle beans in the order they were added. + * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() + */ @Override protected void doStart() throws Exception { - for (Object o:_dependentBeans) + for (Bean b:_beans) { - if (o instanceof LifeCycle) - ((LifeCycle)o).start(); + if (b._joined && b._bean instanceof LifeCycle) + { + LifeCycle l=(LifeCycle)b._bean; + if (!l.isRunning()) + l.start(); + } } super.doStart(); } - + + /* ------------------------------------------------------------ */ + /** + * Stop the joined lifecycle beans in the reverse order they were added. + * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() + */ @Override protected void doStop() throws Exception { super.doStop(); - List reverse = new ArrayList(_dependentBeans); + List reverse = new ArrayList(_beans); Collections.reverse(reverse); - for (Object o:reverse) + for (Bean b:reverse) { - if (o instanceof LifeCycle) - ((LifeCycle)o).stop(); + if (b._joined && b._bean instanceof LifeCycle) + { + LifeCycle l=(LifeCycle)b._bean; + if (l.isRunning()) + l.stop(); + } } } + /* ------------------------------------------------------------ */ + /** + * Destroy the joined Destroyable beans in the reverse order they were added. + * @see org.eclipse.jetty.util.component.Destroyable#destroy() + */ + public void destroy() + { + List reverse = new ArrayList(_beans); + Collections.reverse(reverse); + for (Bean b:reverse) + { + if (b._bean instanceof Destroyable && b._joined) + { + Destroyable d=(Destroyable)b._bean; + d.destroy(); + } + } + _beans.clear(); + } + + + /* ------------------------------------------------------------ */ + /** Is the bean contained in the aggregate. + * @param bean + * @return True if the aggregate contains the bean + */ + public boolean contains(Object bean) + { + for (Bean b:_beans) + if (b._bean==bean) + return true; + return false; + } + + /* ------------------------------------------------------------ */ + /** Is the bean joined to the aggregate. + * @param bean + * @return True if the aggregate contains the bean and it is joined + */ + public boolean isJoined(Object bean) + { + for (Bean b:_beans) + if (b._bean==bean) + return b._joined; + return false; + } + /* ------------------------------------------------------------ */ /** * Add an associated bean. - * The bean will be added to this LifeCycle and if it is also a - * {@link LifeCycle} instance, it will be - * started/stopped. Any beans that are also - * {@link Destroyable}, will be destroyed with the server. + * If the bean is a {@link LifeCycle}, it is added as neither joined or disjoint and + * that status will be determined when the Aggregate bean is started. * @param o the bean object to add + * @return true if the bean was added or false if it has already been added. */ public boolean addBean(Object o) { - if (o == null) + if (contains(o)) return false; - boolean added=false; - if (!_dependentBeans.contains(o)) + + Bean b = new Bean(o); + _beans.add(b); + + // extra LifeCycle handling + if (o instanceof LifeCycle) { - _dependentBeans.add(o); - added=true; + LifeCycle l=(LifeCycle)o; + + // If it is running, then assume it is disjoint + if (l.isRunning()) + b._joined=false; + + // else if we are running, then start the bean + else if (isRunning()) + { + try + { + l.start(); + } + catch(Exception e) + { + throw new RuntimeException (e); + } + } } - try + return true; + } + + /* ------------------------------------------------------------ */ + /** Add an associated lifecycle. + * @param o The lifecycle to add + * @param joined True if the LifeCycle is to be joined, otherwise it will be disjoint. + * @return + */ + public boolean addBean(Object o, boolean joined) + { + if (contains(o)) + return false; + + Bean b = new Bean(o); + b._joined=joined; + _beans.add(b); + + if (o instanceof LifeCycle) { - if (isStarted() && o instanceof LifeCycle) - ((LifeCycle)o).start(); + LifeCycle l=(LifeCycle)o; + + if (joined && isRunning()) + { + try + { + l.start(); + } + catch(Exception e) + { + throw new RuntimeException (e); + } + } } - catch (Exception e) + return true; + } + + /* ------------------------------------------------------------ */ + /** + * Join a bean to this aggregate, so that it is started/stopped/destroyed with the + * aggregate lifecycle. + * @param bean The bean to join (must already have been added). + */ + public void join(Object bean) + { + for (Bean b :_beans) { - throw new RuntimeException (e); + if (b._bean==bean) + { + b._joined=true; + return; + } } - return added; + throw new IllegalArgumentException(); } + /* ------------------------------------------------------------ */ + /** + * Disjoin a bean to this aggregate, so that it is not started/stopped/destroyed with the + * aggregate lifecycle. + * @param bean The bean to join (must already have been added). + */ + public void disjoin(Object bean) + { + for (Bean b :_beans) + { + if (b._bean==bean) + { + b._joined=false; + return; + } + } + throw new IllegalArgumentException(); + } + /* ------------------------------------------------------------ */ /** Get dependent beans * @return List of beans. */ public Collection getBeans() { - return _dependentBeans; + return getBeans(Object.class); } /* ------------------------------------------------------------ */ @@ -109,19 +259,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable public List getBeans(Class clazz) { ArrayList beans = new ArrayList(); - Iterator iter = _dependentBeans.iterator(); - while (iter.hasNext()) + for (Bean b:_beans) { - Object o = iter.next(); - if (clazz.isInstance(o)) - beans.add((T)o); + if (clazz.isInstance(b._bean)) + beans.add((T)(b._bean)); } return beans; } /* ------------------------------------------------------------ */ - /** Get dependent bean of a specific class. + /** Get dependent beans of a specific class. * If more than one bean of the type exist, the first is returned. * @see #addBean(Object) * @param clazz @@ -129,23 +277,13 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable */ public T getBean(Class clazz) { - Iterator iter = _dependentBeans.iterator(); - T t=null; - int count=0; - while (iter.hasNext()) + for (Bean b:_beans) { - Object o = iter.next(); - if (clazz.isInstance(o)) - { - count++; - if (t==null) - t=(T)o; - } + if (clazz.isInstance(b._bean)) + return (T)b._bean; } - if (count>1 && LOG.isDebugEnabled()) - LOG.debug("getBean({}) 1 of {}",clazz.getName(),count); - return t; + return null; } /* ------------------------------------------------------------ */ @@ -154,7 +292,7 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable */ public void removeBeans () { - _dependentBeans.clear(); + _beans.clear(); } /* ------------------------------------------------------------ */ @@ -163,9 +301,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable */ public boolean removeBean (Object o) { - if (o == null) - return false; - return _dependentBeans.remove(o); + Iterator i = _beans.iterator(); + while(i.hasNext()) + { + Bean b=i.next(); + if (b._bean==o) + { + _beans.remove(b); + return true; + } + } + return false; } /* ------------------------------------------------------------ */ @@ -218,7 +364,32 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable public void dump(Appendable out,String indent) throws IOException { dumpThis(out); - dump(out,indent,_dependentBeans); + int size=_beans.size(); + if (size==0) + return; + int i=0; + for (Bean b : _beans) + { + i++; + + if (b._joined) + { + out.append(indent).append(" +- "); + if (b._bean instanceof Dumpable) + ((Dumpable)b._bean).dump(out,indent+(i==size?" ":" | ")); + else + out.append(String.valueOf(b._bean)).append("\n"); + } + else + { + out.append(indent).append(" +~ "); + out.append(String.valueOf(b._bean)).append("\n"); + } + + } + + if (i!=size) + out.append(indent).append(" |\n"); } /* ------------------------------------------------------------ */ diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java index 6180022cd7e..d1b8d9bbfac 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java @@ -1521,5 +1521,11 @@ public class SslContextFactory extends AbstractLifeCycle sslEngine.setEnabledProtocols(selectProtocols(sslEngine.getEnabledProtocols(),sslEngine.getSupportedProtocols())); } - + + /* ------------------------------------------------------------ */ + public String toString() + { + return this.getClass().getSimpleName()+"@"+Integer.toHexString(hashCode())+ + "("+_keyStorePath+","+_trustStorePath+")#"+getState(); + } } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/component/AggregateLifeCycleTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/component/AggregateLifeCycleTest.java index 3bda2998abc..2b5ec8d6e86 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/component/AggregateLifeCycleTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/component/AggregateLifeCycleTest.java @@ -110,6 +110,107 @@ public class AggregateLifeCycleTest } + @Test + public void testDisJoint() throws Exception + { + final AtomicInteger destroyed=new AtomicInteger(); + final AtomicInteger started=new AtomicInteger(); + final AtomicInteger stopped=new AtomicInteger(); + + AggregateLifeCycle a0=new AggregateLifeCycle(); + + AggregateLifeCycle a1=new AggregateLifeCycle() + { + @Override + protected void doStart() throws Exception + { + started.incrementAndGet(); + super.doStart(); + } + + @Override + protected void doStop() throws Exception + { + stopped.incrementAndGet(); + super.doStop(); + } + + @Override + public void destroy() + { + destroyed.incrementAndGet(); + super.destroy(); + } + + }; + + // Start the a1 bean before adding, makes it auto disjoint + a1.start(); + + // Now add it + a0.addBean(a1); + Assert.assertFalse(a0.isJoined(a1)); + + a0.start(); + Assert.assertEquals(1,started.get()); + Assert.assertEquals(0,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + a0.start(); + Assert.assertEquals(1,started.get()); + Assert.assertEquals(0,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + a0.stop(); + Assert.assertEquals(1,started.get()); + Assert.assertEquals(0,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + a1.stop(); + Assert.assertEquals(1,started.get()); + Assert.assertEquals(1,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + a0.start(); + Assert.assertEquals(1,started.get()); + Assert.assertEquals(1,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + a0.join(a1); + Assert.assertTrue(a0.isJoined(a1)); + + a0.stop(); + Assert.assertEquals(1,started.get()); + Assert.assertEquals(1,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + + a0.start(); + Assert.assertEquals(2,started.get()); + Assert.assertEquals(1,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + a0.stop(); + Assert.assertEquals(2,started.get()); + Assert.assertEquals(2,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + + a0.disjoin(a1); + Assert.assertFalse(a0.isJoined(a1)); + + a0.destroy(); + Assert.assertEquals(2,started.get()); + Assert.assertEquals(2,stopped.get()); + Assert.assertEquals(0,destroyed.get()); + + a1.destroy(); + Assert.assertEquals(2,started.get()); + Assert.assertEquals(2,stopped.get()); + Assert.assertEquals(1,destroyed.get()); + + } + @Test public void testDumpable() { @@ -159,6 +260,11 @@ public class AggregateLifeCycleTest System.err.println("--"); a2.addBean(aa0); a0.dumpStdErr(); + + System.err.println("--"); + a0.disjoin(aa); + a2.disjoin(aa0); + a0.dumpStdErr(); } } From a7783ae5687acf5d3e0c31441d3a8a46f2ba105f Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 01:04:01 +1100 Subject: [PATCH 58/92] 368240: Fixed the start of dependent beans --- .../eclipse/jetty/client/SelectConnector.java | 33 +++---------------- .../eclipse/jetty/io/nio/SelectorManager.java | 2 -- .../jetty/rewrite/handler/ProxyRule.java | 2 +- .../jetty/rewrite/handler/ProxyRuleTest.java | 4 +-- .../util/component/AggregateLifeCycle.java | 2 +- 5 files changed, 8 insertions(+), 35 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index 892991bd964..944a8c64f6b 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -35,13 +35,14 @@ import org.eclipse.jetty.io.nio.SslConnection; import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.component.Dumpable; +import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.Timeout; import org.eclipse.jetty.util.thread.Timeout.Task; -class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, Dumpable +class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector, Dumpable { private static final Logger LOG = Log.getLogger(SelectConnector.class); @@ -49,39 +50,15 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, private final Manager _selectorManager=new Manager(); private final Map _connectingChannels = new ConcurrentHashMap(); + /* ------------------------------------------------------------ */ /** * @param httpClient the HttpClient this connector is associated to */ SelectConnector(HttpClient httpClient) { _httpClient = httpClient; - } - - /* ------------------------------------------------------------ */ - @Override - protected void doStart() throws Exception - { - super.doStart(); - - _selectorManager.start(); - } - - /* ------------------------------------------------------------ */ - @Override - protected void doStop() throws Exception - { - _selectorManager.stop(); - } - - public String dump() - { - return AggregateLifeCycle.dump(this); - } - - public void dump(Appendable out, String indent) throws IOException - { - out.append(String.valueOf(this)).append("\n"); - AggregateLifeCycle.dump(out, indent, Arrays.asList(_selectorManager)); + addBean(_httpClient,false); + addBean(_selectorManager,true); } /* ------------------------------------------------------------ */ diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java index dd101e9fbc1..4059a4db420 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java @@ -938,7 +938,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa final ArrayList dump = new ArrayList(selector.keys().size()*2); dump.add(where); - /* final CountDownLatch latch = new CountDownLatch(1); addChange(new ChangeTask() @@ -958,7 +957,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa { LOG.ignore(e); } - */ AggregateLifeCycle.dump(out,indent,dump); } diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java index 8e63b8c5a74..841168e0ca5 100644 --- a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java +++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java @@ -55,7 +55,7 @@ public class ProxyRule extends PatternRule private String _hostHeader; private String _proxyTo; - private int _connectorType = 2; + private int _connectorType = HttpClient.CONNECTOR_SELECT_CHANNEL; private String _maxThreads; private String _maxConnections; private String _timeout; diff --git a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java index 85cab0f2ba0..9cb9def596a 100644 --- a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java +++ b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java @@ -31,7 +31,6 @@ import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.nio.SelectChannelConnector; -import org.eclipse.jetty.util.log.Log; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -88,8 +87,7 @@ public class ProxyRuleTest @Test public void testProxy() throws Exception { - Log.getLogger("org.eclipse.jetty.client").setDebugEnabled(true); - + ContentExchange exchange = new ContentExchange(true); exchange.setMethod(HttpMethods.GET); String body = "BODY"; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java index 281779a5241..75e4a50253b 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java @@ -188,7 +188,7 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable { LifeCycle l=(LifeCycle)o; - if (joined && isRunning()) + if (joined && isStarted()) { try { From 8fcc22df321ae02cdf1d531cce657cdeb4c607b8 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 01:12:36 +1100 Subject: [PATCH 59/92] 368240: Improved handling of dispatch failure --- .../main/java/org/eclipse/jetty/io/nio/SelectorManager.java | 5 ++++- .../java/org/eclipse/jetty/server/AbstractConnector.java | 3 ++- .../java/org/eclipse/jetty/util/thread/QueuedThreadPool.java | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java index 4059a4db420..a28b46ab824 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java @@ -260,7 +260,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa for (int i=0;i Date: Tue, 10 Jan 2012 17:39:17 +0100 Subject: [PATCH 60/92] Cosmetics. --- .../java/org/eclipse/jetty/client/SelectConnector.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index 944a8c64f6b..363349d150e 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -18,10 +18,8 @@ import java.net.SocketTimeoutException; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; import java.nio.channels.UnresolvedAddressException; -import java.util.Arrays; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; - import javax.net.ssl.SSLEngine; import org.eclipse.jetty.io.AsyncEndPoint; @@ -32,10 +30,8 @@ import org.eclipse.jetty.io.nio.AsyncConnection; import org.eclipse.jetty.io.nio.SelectChannelEndPoint; import org.eclipse.jetty.io.nio.SelectorManager; import org.eclipse.jetty.io.nio.SslConnection; -import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.component.Dumpable; -import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.ssl.SslContextFactory; @@ -428,11 +424,10 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector { return _endp.isCheckForIdle(); } - + public String toString() { return "Upgradable:"+_endp.toString(); } - } } From bb0a3201024263b065c6422eecffbcaf95298b89 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 10 Jan 2012 17:41:32 +0100 Subject: [PATCH 61/92] Improved toString(). --- .../org/eclipse/jetty/io/AbstractBuffers.java | 11 ++- .../org/eclipse/jetty/io/PooledBuffers.java | 22 +++--- .../jetty/server/AbstractConnector.java | 53 ++++++------- .../jetty/util/ssl/SslContextFactory.java | 75 ++++++++++--------- 4 files changed, 78 insertions(+), 83 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java index bc24d078ae9..b94710af5ca 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java @@ -2,7 +2,6 @@ package org.eclipse.jetty.io; import org.eclipse.jetty.io.nio.DirectNIOBuffer; import org.eclipse.jetty.io.nio.IndirectNIOBuffer; -import org.omg.stub.java.rmi._Remote_Stub; public abstract class AbstractBuffers implements Buffers { @@ -59,7 +58,7 @@ public abstract class AbstractBuffers implements Buffers } throw new IllegalStateException(); } - + /* ------------------------------------------------------------ */ /** * Create a new content Buffer @@ -78,7 +77,7 @@ public abstract class AbstractBuffers implements Buffers } throw new IllegalStateException(); } - + /* ------------------------------------------------------------ */ /** * Create a new content Buffer @@ -142,10 +141,10 @@ public abstract class AbstractBuffers implements Buffers } return false; } - + /* ------------------------------------------------------------ */ public String toString() { - return this.getClass().getSimpleName()+"["+_headerSize+","+_bufferSize+"]"; + return String.format("%s [%d,%d]", getClass().getSimpleName(), _headerSize, _bufferSize); } -} \ No newline at end of file +} diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java b/jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java index 9c476312544..194eb9bf71b 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java @@ -25,7 +25,7 @@ public class PooledBuffers extends AbstractBuffers _otherBuffers=bufferType==otherType; _maxSize=maxSize; } - + /* ------------------------------------------------------------ */ public Buffer getHeader() { @@ -55,17 +55,17 @@ public class PooledBuffers extends AbstractBuffers return getHeader(); if (_otherBuffers && size==getBufferSize()) return getBuffer(); - + // Look for an other buffer Buffer buffer = _others.poll(); - + // consume all other buffers until one of the right size is found while (buffer!=null && buffer.capacity()!=size) { _size.decrementAndGet(); buffer = _others.poll(); } - + if (buffer==null) buffer=newBuffer(size); else @@ -89,16 +89,16 @@ public class PooledBuffers extends AbstractBuffers else if (isBuffer(buffer)) _buffers.add(buffer); else - _others.add(buffer); + _others.add(buffer); } } - + public String toString() { - return this.getClass().getSimpleName()+ - "["+ - _headers.size()+"/"+_maxSize+"@"+_headerSize+","+ - _buffers.size()+"/"+_maxSize+"@"+_bufferSize+","+ - _others.size()+"/"+_maxSize+"@-]"; + return String.format("%s [%d/%d@%d,%d/%d@%d,%d/%d@-]", + getClass().getSimpleName(), + _headers.size(),_maxSize,_headerSize, + _buffers.size(),_maxSize,_bufferSize, + _others.size(),_maxSize); } } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index 37ae728d121..7a95f4d5fd2 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -18,7 +18,6 @@ import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import java.util.concurrent.atomic.AtomicLong; - import javax.servlet.ServletRequest; import org.eclipse.jetty.http.HttpBuffers; @@ -34,7 +33,6 @@ import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.component.Dumpable; -import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.statistic.CounterStatistic; @@ -87,7 +85,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht protected int _lowResourceMaxIdleTime = -1; protected int _soLingerTime = -1; - private transient Thread[] _acceptorThread; + private transient Thread[] _acceptorThreads; private final AtomicLong _statsStartedAt = new AtomicLong(-1L); @@ -99,7 +97,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht private final SampleStatistic _connectionDurationStats = new SampleStatistic(); protected final HttpBuffersImpl _buffers = new HttpBuffersImpl(); - + /* ------------------------------------------------------------ */ /** */ @@ -312,15 +310,15 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht _threadPool = _server.getThreadPool(); addBean(_threadPool,false); } - + super.doStart(); // Start selector thread synchronized (this) { - _acceptorThread = new Thread[getAcceptors()]; + _acceptorThreads = new Thread[getAcceptors()]; - for (int i = 0; i < _acceptorThread.length; i++) + for (int i = 0; i < _acceptorThreads.length; i++) if (!_threadPool.dispatch(new Acceptor(i))) throw new IllegalStateException("!accepting"); if (_threadPool.isLowOnThreads()) @@ -345,17 +343,16 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht super.doStop(); - Thread[] acceptors = null; + Thread[] acceptors; synchronized (this) { - acceptors = _acceptorThread; - _acceptorThread = null; + acceptors = _acceptorThreads; + _acceptorThreads = null; } if (acceptors != null) { - for (int i = 0; i < acceptors.length; i++) + for (Thread thread : acceptors) { - Thread thread = acceptors[i]; if (thread != null) thread.interrupt(); } @@ -368,12 +365,12 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht Thread[] threads; synchronized(this) { - threads= _acceptorThread; + threads=_acceptorThreads; } if (threads != null) - for (int i = 0; i < threads.length; i++) - if (threads[i] != null) - threads[i].join(); + for (Thread thread : threads) + if (thread != null) + thread.join(); } /* ------------------------------------------------------------ */ @@ -792,8 +789,6 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht { _forwardedSslSessionIdHeader = forwardedSslSessionId; } - - public int getRequestBufferSize() { @@ -889,13 +884,11 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht @Override public String toString() { - String name = this.getClass().getName(); - int dot = name.lastIndexOf('.'); - if (dot > 0) - name = name.substring(dot + 1); - - return name + "@" + (getHost() == null?"0.0.0.0":getHost()) + ":" + (getLocalPort() <= 0?getPort():getLocalPort()) + " " - + AbstractLifeCycle.getState(this); + return String.format("%s@%s:%d %s", + getClass().getSimpleName(), + getHost()==null?"0.0.0.0":getHost(), + getLocalPort()<=0?getPort():getLocalPort(), + AbstractLifeCycle.getState(this)); } /* ------------------------------------------------------------ */ @@ -917,11 +910,11 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht String name; synchronized (AbstractConnector.this) { - if (_acceptorThread == null) + if (_acceptorThreads == null) return; - _acceptorThread[_acceptor] = current; - name = _acceptorThread[_acceptor].getName(); + _acceptorThreads[_acceptor] = current; + name = _acceptorThreads[_acceptor].getName(); current.setName(name + " Acceptor" + _acceptor + " " + AbstractConnector.this); } int old_priority = current.getPriority(); @@ -961,8 +954,8 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht synchronized (AbstractConnector.this) { - if (_acceptorThread != null) - _acceptorThread[_acceptor] = null; + if (_acceptorThreads != null) + _acceptorThreads[_acceptor] = null; } } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java index d1b8d9bbfac..956c294b885 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java @@ -38,7 +38,6 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; - import javax.net.ssl.CertPathTrustManagerParameters; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; @@ -73,7 +72,7 @@ import org.eclipse.jetty.util.security.Password; public class SslContextFactory extends AbstractLifeCycle { private static final Logger LOG = Log.getLogger(SslContextFactory.class); - + public static final String DEFAULT_KEYMANAGERFACTORY_ALGORITHM = (Security.getProperty("ssl.KeyManagerFactory.algorithm") == null ? "SunX509" : Security.getProperty("ssl.KeyManagerFactory.algorithm")); @@ -96,7 +95,7 @@ public class SslContextFactory extends AbstractLifeCycle // private final Set _excludeProtocols = new HashSet(Collections.singleton("SSLv2Hello")); /** Included protocols. */ private Set _includeProtocols = null; - + /** Excluded cipher suites. */ private final Set _excludeCipherSuites = new HashSet(); /** Included cipher suites. */ @@ -178,7 +177,7 @@ public class SslContextFactory extends AbstractLifeCycle /** SSL context */ private SSLContext _context; - + private boolean _trustAll; /* ------------------------------------------------------------ */ @@ -225,7 +224,7 @@ public class SslContextFactory extends AbstractLifeCycle _trustStore==null && _trustStoreInputStream == null && _trustStorePath == null ) { TrustManager[] trust_managers=null; - + if (_trustAll) { LOG.debug("No keystore or trust store configured. ACCEPTING UNTRUSTED CERTIFICATES!!!!!"); @@ -247,7 +246,7 @@ public class SslContextFactory extends AbstractLifeCycle }; trust_managers = new TrustManager[] { trustAllCerts }; } - + SecureRandom secureRandom = (_secureRandomAlgorithm == null)?null:SecureRandom.getInstance(_secureRandomAlgorithm); _context = SSLContext.getInstance(_sslProtocol); _context.init(null, trust_managers, secureRandom); @@ -255,7 +254,7 @@ public class SslContextFactory extends AbstractLifeCycle else { // verify that keystore and truststore - // parameters are set up correctly + // parameters are set up correctly checkKeyStore(); KeyStore keyStore = loadKeyStore(); @@ -293,7 +292,7 @@ public class SslContextFactory extends AbstractLifeCycle _context.init(keyManagers,trustManagers,secureRandom); SSLEngine engine=newSslEngine(); - + LOG.info("Enabled Protocols {} of {}",Arrays.asList(engine.getEnabledProtocols()),Arrays.asList(engine.getSupportedProtocols())); if (LOG.isDebugEnabled()) LOG.debug("Enabled Ciphers {} of {}",Arrays.asList(engine.getEnabledCipherSuites()),Arrays.asList(engine.getSupportedCipherSuites())); @@ -334,7 +333,7 @@ public class SslContextFactory extends AbstractLifeCycle checkNotStarted(); _excludeProtocols.addAll(Arrays.asList(protocol)); } - + /* ------------------------------------------------------------ */ /** * @return The array of protocol names to include in @@ -380,7 +379,7 @@ public class SslContextFactory extends AbstractLifeCycle _excludeCipherSuites.clear(); _excludeCipherSuites.addAll(Arrays.asList(cipherSuites)); } - + /* ------------------------------------------------------------ */ /** * @param cipher Cipher names to add to {@link SSLEngine#setEnabledCipherSuites(String[])} @@ -429,7 +428,7 @@ public class SslContextFactory extends AbstractLifeCycle { return _keyStorePath; } - + /* ------------------------------------------------------------ */ /** * @param keyStorePath @@ -878,7 +877,7 @@ public class SslContextFactory extends AbstractLifeCycle { return (_keyManagerFactoryAlgorithm); } - + /* ------------------------------------------------------------ */ /** * @param algorithm @@ -1094,7 +1093,7 @@ public class SslContextFactory extends AbstractLifeCycle /* ------------------------------------------------------------ */ protected TrustManager[] getTrustManagers(KeyStore trustStore, Collection crls) throws Exception - { + { TrustManager[] managers = null; if (trustStore != null) { @@ -1156,15 +1155,15 @@ public class SslContextFactory extends AbstractLifeCycle * used as truststore. * @throws IllegalStateException if SslContextFactory configuration can't be used. */ - public void checkKeyStore() + public void checkKeyStore() { if (_context != null) return; //nothing to check if using preconfigured context - - + + if (_keyStore == null && _keyStoreInputStream == null && _keyStorePath == null) throw new IllegalStateException("SSL doesn't have a valid keystore"); - + // if the keystore has been configured but there is no // truststore configured, use the keystore as the truststore if (_trustStore == null && _trustStoreInputStream == null && _trustStorePath == null) @@ -1209,7 +1208,7 @@ public class SslContextFactory extends AbstractLifeCycle public String[] selectProtocols(String[] enabledProtocols, String[] supportedProtocols) { Set selected_protocols = new HashSet(); - + // Set the starting protocols - either from the included or enabled list if (_includeProtocols!=null) { @@ -1220,15 +1219,15 @@ public class SslContextFactory extends AbstractLifeCycle } else selected_protocols.addAll(Arrays.asList(enabledProtocols)); - - + + // Remove any excluded protocols if (_excludeProtocols != null) selected_protocols.removeAll(_excludeProtocols); - + return selected_protocols.toArray(new String[selected_protocols.size()]); } - + /* ------------------------------------------------------------ */ /** * Select cipher suites to be used by the connector @@ -1241,7 +1240,7 @@ public class SslContextFactory extends AbstractLifeCycle public String[] selectCipherSuites(String[] enabledCipherSuites, String[] supportedCipherSuites) { Set selected_ciphers = new HashSet(); - + // Set the starting ciphers - either from the included or enabled list if (_includeCipherSuites!=null) { @@ -1252,8 +1251,8 @@ public class SslContextFactory extends AbstractLifeCycle } else selected_ciphers.addAll(Arrays.asList(enabledCipherSuites)); - - + + // Remove any excluded ciphers if (_excludeCipherSuites != null) selected_ciphers.removeAll(_excludeCipherSuites); @@ -1450,7 +1449,7 @@ public class SslContextFactory extends AbstractLifeCycle { SSLServerSocketFactory factory = _context.getServerSocketFactory(); - SSLServerSocket socket = + SSLServerSocket socket = (SSLServerSocket) (host==null ? factory.createServerSocket(port,backlog): factory.createServerSocket(port,backlog,InetAddress.getByName(host))); @@ -1467,14 +1466,14 @@ public class SslContextFactory extends AbstractLifeCycle return socket; } - + /* ------------------------------------------------------------ */ public SSLSocket newSslSocket() throws IOException { SSLSocketFactory factory = _context.getSocketFactory(); - + SSLSocket socket = (SSLSocket)factory.createSocket(); - + if (getWantClientAuth()) socket.setWantClientAuth(getWantClientAuth()); if (getNeedClientAuth()) @@ -1482,23 +1481,23 @@ public class SslContextFactory extends AbstractLifeCycle socket.setEnabledCipherSuites(selectCipherSuites( socket.getEnabledCipherSuites(), - socket.getSupportedCipherSuites())); + socket.getSupportedCipherSuites())); socket.setEnabledProtocols(selectProtocols(socket.getEnabledProtocols(),socket.getSupportedProtocols())); return socket; } - + /* ------------------------------------------------------------ */ public SSLEngine newSslEngine(String host,int port) { SSLEngine sslEngine=isSessionCachingEnabled() ?_context.createSSLEngine(host, port) :_context.createSSLEngine(); - + customize(sslEngine); return sslEngine; } - + /* ------------------------------------------------------------ */ public SSLEngine newSslEngine() { @@ -1518,14 +1517,18 @@ public class SslContextFactory extends AbstractLifeCycle sslEngine.setEnabledCipherSuites(selectCipherSuites( sslEngine.getEnabledCipherSuites(), sslEngine.getSupportedCipherSuites())); - + sslEngine.setEnabledProtocols(selectProtocols(sslEngine.getEnabledProtocols(),sslEngine.getSupportedProtocols())); } /* ------------------------------------------------------------ */ public String toString() { - return this.getClass().getSimpleName()+"@"+Integer.toHexString(hashCode())+ - "("+_keyStorePath+","+_trustStorePath+")#"+getState(); + return String.format("%s@%x(%s,%s)#%s", + getClass().getSimpleName(), + hashCode(), + _keyStorePath, + _trustStorePath, + getState()); } } From 297625b44692bd8f86fd1c20675abce2481dc3f2 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 10 Jan 2012 17:42:52 +0100 Subject: [PATCH 62/92] Removed redundant code and cleaned up. --- .../jetty/rewrite/handler/ProxyRuleTest.java | 8 +++---- .../server/nio/AbstractNIOConnector.java | 15 +++++-------- .../server/nio/SelectChannelConnector.java | 22 +------------------ 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java index 9cb9def596a..b56b1bebc96 100644 --- a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java +++ b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java @@ -1,5 +1,3 @@ -package org.eclipse.jetty.rewrite.handler; - //======================================================================== //Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd. //------------------------------------------------------------------------ @@ -12,12 +10,10 @@ package org.eclipse.jetty.rewrite.handler; //http://www.opensource.org/licenses/apache2.0.php //You may elect to redistribute this code under either of these licenses. //======================================================================== - -import static org.junit.Assert.assertEquals; +package org.eclipse.jetty.rewrite.handler; import java.io.IOException; import java.net.URLEncoder; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -35,6 +31,8 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import static org.junit.Assert.assertEquals; + public class ProxyRuleTest { private static ProxyRule _rule; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java index 2083c5d3714..8e24a8c5eb5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java @@ -4,35 +4,31 @@ // 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.nio; import org.eclipse.jetty.io.Buffers.Type; import org.eclipse.jetty.server.AbstractConnector; -/* ------------------------------------------------------------ */ -/** - * - * - */ public abstract class AbstractNIOConnector extends AbstractConnector implements NIOConnector { + public AbstractNIOConnector() { _buffers.setRequestBufferType(Type.DIRECT); _buffers.setRequestHeaderType(Type.INDIRECT); _buffers.setResponseBufferType(Type.DIRECT); _buffers.setResponseHeaderType(Type.INDIRECT); } - + /* ------------------------------------------------------------------------------- */ public boolean getUseDirectBuffers() { @@ -49,5 +45,4 @@ public abstract class AbstractNIOConnector extends AbstractConnector implements _buffers.setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT); _buffers.setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT); } - } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java index 9cf3ede1fef..c5618a6e97c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java @@ -19,7 +19,6 @@ import java.net.Socket; import java.nio.channels.SelectionKey; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; -import java.util.Arrays; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.io.AsyncEndPoint; @@ -32,9 +31,6 @@ import org.eclipse.jetty.io.nio.SelectorManager; import org.eclipse.jetty.io.nio.SelectorManager.SelectSet; import org.eclipse.jetty.server.AsyncHttpConnection; import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.util.component.AggregateLifeCycle; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.ThreadPool; /* ------------------------------------------------------------------------------- */ @@ -65,8 +61,6 @@ import org.eclipse.jetty.util.thread.ThreadPool; */ public class SelectChannelConnector extends AbstractNIOConnector { - private static final Logger LOG = Log.getLogger(SelectChannelConnector.class); - protected ServerSocketChannel _acceptChannel; private int _lowResourcesConnections; private int _lowResourcesMaxIdleTime; @@ -126,7 +120,6 @@ public class SelectChannelConnector extends AbstractNIOConnector @Override public void customize(EndPoint endpoint, Request request) throws IOException { - AsyncEndPoint aEndp = ((AsyncEndPoint)endpoint); request.setTimeStamp(System.currentTimeMillis()); endpoint.setMaxIdleTime(_maxIdleTime); super.customize(endpoint, request); @@ -182,9 +175,8 @@ public class SelectChannelConnector extends AbstractNIOConnector _localPort=_acceptChannel.socket().getLocalPort(); if (_localPort<=0) throw new IOException("Server channel not bound"); - - addBean(_acceptChannel); + addBean(_acceptChannel); } } } @@ -259,17 +251,6 @@ public class SelectChannelConnector extends AbstractNIOConnector super.doStart(); } - /* ------------------------------------------------------------ */ - /* - * @see org.eclipse.jetty.server.server.AbstractConnector#doStop() - */ - @Override - protected void doStop() throws Exception - { - close(); - super.doStop(); - } - /* ------------------------------------------------------------ */ protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException { @@ -336,5 +317,4 @@ public class SelectChannelConnector extends AbstractNIOConnector return SelectChannelConnector.this.newEndPoint(channel,selectSet,sKey); } } - } From 3a30b4b7a59e5fda59e79d46f13927cff7b37a64 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 10 Jan 2012 17:44:57 +0100 Subject: [PATCH 63/92] 368240 - Better handling of locally created ThreadPool. --- .../org/eclipse/jetty/client/HttpClient.java | 53 ++++++++----------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java index baad2e962f7..671806f4704 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java @@ -16,13 +16,11 @@ package org.eclipse.jetty.client; import java.io.IOException; import java.io.InputStream; import java.net.UnknownHostException; -import java.util.Arrays; import java.util.Enumeration; import java.util.LinkedList; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; - import javax.net.ssl.SSLContext; import org.eclipse.jetty.client.security.Authentication; @@ -99,7 +97,7 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri private AttributesMap _attributes=new AttributesMap(); - private final HttpBuffersImpl _buffers= new HttpBuffersImpl(); + private final HttpBuffersImpl _buffers= new HttpBuffersImpl(); /* ------------------------------------------------------------------------------- */ private void setBufferTypes() @@ -133,7 +131,6 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri _sslContextFactory = sslContextFactory; addBean(_sslContextFactory); addBean(_buffers); - setBufferTypes(); } /* ------------------------------------------------------------------------------- */ @@ -169,16 +166,6 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri */ public ThreadPool getThreadPool() { - if (_threadPool==null) - { - QueuedThreadPool pool = new QueuedThreadPool(); - pool.setMaxThreads(16); - pool.setDaemon(true); - pool.setName("HttpClient"); - _threadPool = pool; - addBean(_threadPool,true); - } - return _threadPool; } @@ -418,15 +405,21 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri _idleTimeoutQ.setDuration(_idleTimeout); _idleTimeoutQ.setNow(); - if (_threadPool == null) - getThreadPool(); + if (_threadPool==null) + { + QueuedThreadPool pool = new LocalQueuedThreadPool(); + pool.setMaxThreads(16); + pool.setDaemon(true); + pool.setName("HttpClient"); + _threadPool = pool; + addBean(_threadPool,true); + } - _connector=(_connectorType == CONNECTOR_SELECT_CHANNEL)?new SelectConnector(this):new SocketConnector(this); addBean(_connector,true); - + super.doStart(); - + _threadPool.dispatch(new Runnable() { public void run() @@ -439,7 +432,7 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri { Thread.sleep(200); } - catch (InterruptedException e) + catch (InterruptedException ignored) { } } @@ -447,25 +440,21 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri }); } - /* ------------------------------------------------------------ */ - long getNow() - { - return _timeoutQ.getNow(); - } - /* ------------------------------------------------------------ */ @Override protected void doStop() throws Exception { for (HttpDestination destination : _destinations.values()) - { destination.close(); - } _timeoutQ.cancelAll(); _idleTimeoutQ.cancelAll(); + super.doStop(); - _connector = null; + + if (_threadPool instanceof LocalQueuedThreadPool) + removeBean(_threadPool); + removeBean(_connector); } @@ -638,8 +627,6 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri _maxRedirects = redirects; } - - public int getRequestBufferSize() { return _buffers.getRequestBufferSize(); @@ -902,4 +889,8 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri { _sslContextFactory.setSecureRandomAlgorithm(secureRandomAlgorithm); } + + private static class LocalQueuedThreadPool extends QueuedThreadPool + { + } } From 74317987c4de990de9987455df77c2a0dc4dce89 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 10 Jan 2012 18:08:10 +0100 Subject: [PATCH 64/92] 368240 - Fixed test. --- .../jetty/monitor/AttrEventTriggerTest.java | 192 +++++++++--------- 1 file changed, 95 insertions(+), 97 deletions(-) diff --git a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/AttrEventTriggerTest.java b/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/AttrEventTriggerTest.java index 5cc7bdfd2d0..c9be35939cd 100644 --- a/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/AttrEventTriggerTest.java +++ b/jetty-monitor/src/test/java/org/eclipse/jetty/monitor/AttrEventTriggerTest.java @@ -4,17 +4,15 @@ // 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.monitor; -import static org.junit.Assert.assertEquals; - import java.io.File; import java.io.IOException; import java.io.PrintWriter; @@ -22,7 +20,6 @@ import java.lang.management.ManagementFactory; import java.util.Collection; import java.util.Iterator; import java.util.TreeSet; - import javax.management.MBeanServer; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -35,13 +32,12 @@ import org.eclipse.jetty.client.security.SimpleRealmResolver; import org.eclipse.jetty.http.HttpMethods; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.jmx.MBeanContainer; -import org.eclipse.jetty.monitor.JMXMonitor; import org.eclipse.jetty.monitor.jmx.ConsoleNotifier; import org.eclipse.jetty.monitor.jmx.EventNotifier; import org.eclipse.jetty.monitor.jmx.EventState; +import org.eclipse.jetty.monitor.jmx.EventState.TriggerState; import org.eclipse.jetty.monitor.jmx.EventTrigger; import org.eclipse.jetty.monitor.jmx.MonitorAction; -import org.eclipse.jetty.monitor.jmx.EventState.TriggerState; import org.eclipse.jetty.monitor.triggers.AndEventTrigger; import org.eclipse.jetty.monitor.triggers.AttrEventTrigger; import org.eclipse.jetty.monitor.triggers.EqualToAttrEventTrigger; @@ -61,6 +57,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; + /* ------------------------------------------------------------ */ /** @@ -81,93 +79,93 @@ public class AttrEventTriggerTest File docRoot = new File("target/test-output/docroot/"); docRoot.mkdirs(); docRoot.deleteOnExit(); - + System.setProperty("org.eclipse.jetty.util.log.DEBUG",""); _server = new Server(); - + SelectChannelConnector connector = new SelectChannelConnector(); _server.addConnector(connector); - + _handler = new TestHandler(); _server.setHandler(_handler); - + MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); mBeanContainer.addBean(Log.getLog()); _counter = _handler.getRequestCounter(); mBeanContainer.addBean(_counter); - - _server.addBean(mBeanContainer); - _server.getContainer().addEventListener(mBeanContainer); + + _server.addBean(mBeanContainer, true); + _server.getContainer().addEventListener(mBeanContainer); _server.start(); - + startClient(null); - + _monitor = new JMXMonitor(); - - int port = _server.getConnectors()[0].getLocalPort(); + + int port = connector.getLocalPort(); _requestUrl = "http://localhost:"+port+ "/"; } - + @After public void tearDown() throws Exception { stopClient(); - + if (_server != null) { _server.stop(); _server = null; - } + } } - + @Test public void testNoCondition() throws Exception { long requestCount = 10; - - AttrEventTrigger trigger = + + AttrEventTrigger trigger = new AttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter"); EventNotifier notifier = new ConsoleNotifier("%s"); CounterAction action = new CounterAction(trigger, notifier, 500, 100); - + performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(1,requestCount); assertEquals(result, action.getHits()); } - + @Test public void testEqual_TRUE() throws Exception { long requestCount = 10; long testValue = 5; - - EqualToAttrEventTrigger trigger = + + EqualToAttrEventTrigger trigger = new EqualToAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",testValue); EventNotifier notifier = new ConsoleNotifier("%s"); CounterAction action = new CounterAction(trigger, notifier, 500, 100); performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(testValue); assertEquals(result, action.getHits()); } - + @Test public void testEqual_FALSE() throws Exception { long requestCount = 10; long testValue = 11; - - EqualToAttrEventTrigger trigger = + + EqualToAttrEventTrigger trigger = new EqualToAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testValue); @@ -175,19 +173,19 @@ public class AttrEventTriggerTest CounterAction action = new CounterAction(trigger, notifier, 500, 100); performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(); assertEquals(result, action.getHits()); } - + @Test public void testLowerLimit() throws Exception { long requestCount = 10; long testRangeLow = 5; - - GreaterThanAttrEventTrigger trigger = + + GreaterThanAttrEventTrigger trigger = new GreaterThanAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeLow); @@ -195,27 +193,27 @@ public class AttrEventTriggerTest CounterAction action = new CounterAction(trigger, notifier, 500, 100); performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(6,10); assertEquals(result, action.getHits()); } - + @Test public void testLowerLimitIncl() throws Exception { long requestCount = 10; long testRangeLow = 5; - - GreaterThanOrEqualToAttrEventTrigger trigger = + + GreaterThanOrEqualToAttrEventTrigger trigger = new GreaterThanOrEqualToAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeLow); - + EventNotifier notifier = new ConsoleNotifier("%s"); CounterAction action = new CounterAction(trigger, notifier, 500, 100); - + performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(5,10); assertEquals(result, action.getHits()); } @@ -226,8 +224,8 @@ public class AttrEventTriggerTest { long requestCount = 10; long testRangeHigh = 5; - - LessThanAttrEventTrigger trigger = + + LessThanAttrEventTrigger trigger = new LessThanAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeHigh); @@ -235,11 +233,11 @@ public class AttrEventTriggerTest CounterAction action = new CounterAction(trigger, notifier, 500, 100); performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(1,4); assertEquals(result, action.getHits()); } - + @Test public void testUpperLimitIncl() @@ -247,8 +245,8 @@ public class AttrEventTriggerTest { long requestCount = 10; long testRangeHigh = 5; - - LessThanOrEqualToAttrEventTrigger trigger = + + LessThanOrEqualToAttrEventTrigger trigger = new LessThanOrEqualToAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeHigh); @@ -256,11 +254,11 @@ public class AttrEventTriggerTest CounterAction action = new CounterAction(trigger, notifier, 500, 100); performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(1,5); assertEquals(result, action.getHits()); } - + @Test public void testRangeInclusive() throws Exception @@ -268,20 +266,20 @@ public class AttrEventTriggerTest long requestCount = 10; long testRangeLow = 3; long testRangeHigh = 8; - - RangeInclAttrEventTrigger trigger = + + RangeInclAttrEventTrigger trigger = new RangeInclAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeLow, testRangeHigh); - + EventNotifier notifier = new ConsoleNotifier("%s"); CounterAction action = new CounterAction(trigger, notifier, 500, 100); - + performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(testRangeLow,testRangeHigh); assertEquals(result, action.getHits()); } - + @Test public void testInsideRangeExclusive() throws Exception @@ -289,20 +287,20 @@ public class AttrEventTriggerTest long requestCount = 10; long testRangeLow = 3; long testRangeHigh = 8; - - RangeAttrEventTrigger trigger = + + RangeAttrEventTrigger trigger = new RangeAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeLow, testRangeHigh); - + EventNotifier notifier = new ConsoleNotifier("%s"); CounterAction action = new CounterAction(trigger, notifier, 500, 100); - + performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(testRangeLow+1,testRangeHigh-1); assertEquals(result, action.getHits()); } - + @Test public void testRangeComposite() throws Exception @@ -310,23 +308,23 @@ public class AttrEventTriggerTest long requestCount = 10; long testRangeLow = 4; long testRangeHigh = 7; - - GreaterThanAttrEventTrigger trigger1 = + + GreaterThanAttrEventTrigger trigger1 = new GreaterThanAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeLow); - LessThanOrEqualToAttrEventTrigger trigger2 = + LessThanOrEqualToAttrEventTrigger trigger2 = new LessThanOrEqualToAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeHigh); AndEventTrigger trigger = new AndEventTrigger(trigger1, trigger2); EventNotifier notifier = new ConsoleNotifier("%s"); CounterAction action = new CounterAction(trigger, notifier, 500, 100); - + performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(testRangeLow+1,testRangeHigh); assertEquals(result, action.getHits()); } - + @Test public void testRangeOuter() throws Exception @@ -334,23 +332,23 @@ public class AttrEventTriggerTest long requestCount = 10; long testRangeLow = 4; long testRangeHigh = 7; - - LessThanOrEqualToAttrEventTrigger trigger1 = + + LessThanOrEqualToAttrEventTrigger trigger1 = new LessThanOrEqualToAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeLow); - GreaterThanAttrEventTrigger trigger2 = + GreaterThanAttrEventTrigger trigger2 = new GreaterThanAttrEventTrigger("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter", testRangeHigh); OrEventTrigger trigger = new OrEventTrigger(trigger1, trigger2); EventNotifier notifier = new ConsoleNotifier("%s"); CounterAction action = new CounterAction(trigger, notifier, 500, 100); - + performTest(action, requestCount, 1000); - + ResultSet result = new ResultSet(1,testRangeLow,testRangeHigh+1, requestCount); assertEquals(result, action.getHits()); } - + protected void performTest(MonitorAction action, long count, long interval) throws Exception { @@ -363,17 +361,17 @@ public class AttrEventTriggerTest ContentExchange getExchange = new ContentExchange(); getExchange.setURL(_requestUrl); getExchange.setMethod(HttpMethods.GET); - + _client.send(getExchange); int state = getExchange.waitForDone(); - + String content = ""; int responseStatus = getExchange.getResponseStatus(); if (responseStatus == HttpStatus.OK_200) { content = getExchange.getResponseContent(); - } - + } + assertEquals(HttpStatus.OK_200,responseStatus); Thread.sleep(interval); } @@ -382,12 +380,12 @@ public class AttrEventTriggerTest break; } } - + Thread.sleep(interval); _monitor.removeActions(action); } - + protected void startClient(Realm realm) throws Exception { @@ -397,7 +395,7 @@ public class AttrEventTriggerTest _client.setRealmResolver(new SimpleRealmResolver(realm)); _client.start(); } - + protected void stopClient() throws Exception { @@ -412,7 +410,7 @@ public class AttrEventTriggerTest extends AbstractHandler { private RequestCounter _counter = new RequestCounter(); - + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException @@ -421,40 +419,40 @@ public class AttrEventTriggerTest return; } _counter.increment(); - + response.setContentType("text/plain"); response.setStatus(HttpServletResponse.SC_OK); PrintWriter writer = response.getWriter(); writer.println("===TEST RESPONSE==="); baseRequest.setHandled(true); } - + public RequestCounter getRequestCounter() { return _counter; } } - + protected static class ResultSet extends TreeSet - { + { public ResultSet() {} - + public ResultSet(long value) { add(value); } - + public ResultSet(long start, long end) { addEntries(start, end); } - + public ResultSet(long start, long pause, long resume, long end) { addEntries(start, pause); addEntries(resume, end); } - + public void addEntries(long start, long stop) { if (start > 0 && stop > 0) @@ -471,23 +469,23 @@ public class AttrEventTriggerTest return (this.size() == set.size()) && containsAll(set); } } - + protected static class CounterAction extends MonitorAction { private ResultSet _hits = new ResultSet(); - + public CounterAction(EventTrigger trigger, EventNotifier notifier, long interval, long delay) { super(trigger, notifier, interval, delay); } - + public void execute(EventTrigger trigger, EventState state, long timestamp) { if (trigger != null && state != null) { Collection values = state.values(); - + Iterator it = values.iterator(); while(it.hasNext()) { @@ -500,7 +498,7 @@ public class AttrEventTriggerTest } } } - + public ResultSet getHits() { return _hits; From cecfa69a1387822980a51912dcc4a05bb556564c Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 10 Jan 2012 18:10:24 +0100 Subject: [PATCH 65/92] 368189 - WebSocketClientFactory should not manage external thread pool. 368240 - Improve AggregateLifeCycle handling of shared lifecycles Reworked the implementation in order to follow 368240. --- .../jetty/websocket/WebSocketClientFactory.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index c7c73bc6524..e0ef62e2306 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -45,7 +45,6 @@ import org.eclipse.jetty.io.nio.SslConnection; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.component.AggregateLifeCycle; -import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.QueuedThreadPool; @@ -68,7 +67,6 @@ public class WebSocketClientFactory extends AggregateLifeCycle private final Queue connections = new ConcurrentLinkedQueue(); private final SslContextFactory _sslContextFactory = new SslContextFactory(); private final ThreadPool _threadPool; - private final boolean _shutdownThreadPool; private final WebSocketClientSelector _selector; private MaskGen _maskGen; private WebSocketBuffers _buffers; @@ -117,16 +115,9 @@ public class WebSocketClientFactory extends AggregateLifeCycle public WebSocketClientFactory(ThreadPool threadPool, MaskGen maskGen, int bufferSize) { if (threadPool == null) - { - _threadPool = new QueuedThreadPool(); - addBean(_threadPool); - _shutdownThreadPool = true; - } - else - { - _threadPool = threadPool; - _shutdownThreadPool = false; - } + threadPool = new QueuedThreadPool(); + _threadPool = threadPool; + addBean(_threadPool); _buffers = new WebSocketBuffers(bufferSize); addBean(_buffers); @@ -224,8 +215,6 @@ public class WebSocketClientFactory extends AggregateLifeCycle { closeConnections(); super.doStop(); - if (_shutdownThreadPool && _threadPool instanceof LifeCycle) - ((LifeCycle)_threadPool).stop(); } /* ------------------------------------------------------------ */ From b6f5edecb59b90a4992b33b01229656fd9ae6344 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 10 Jan 2012 19:02:48 +0100 Subject: [PATCH 66/92] 368240 - Better handling of locally created ThreadPool. Forgot to null out field. --- .../src/main/java/org/eclipse/jetty/client/HttpClient.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java index 671806f4704..c52c25c858c 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java @@ -453,7 +453,10 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri super.doStop(); if (_threadPool instanceof LocalQueuedThreadPool) + { removeBean(_threadPool); + _threadPool = null; + } removeBean(_connector); } From 49b3239aa66e0eb38dda73caaff22f2b615df170 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Tue, 10 Jan 2012 13:45:39 -0600 Subject: [PATCH 67/92] clear up the last of the maven warnings I see --- jetty-jndi/pom.xml | 1 - jetty-nosql/pom.xml | 1 - jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 9 --------- jetty-osgi/test-jetty-osgi/pom.xml | 10 ---------- jetty-server/pom.xml | 1 - tests/test-webapps/test-webapp-rfc2616/pom.xml | 1 - 6 files changed, 23 deletions(-) diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 5eaf6fef291..bd9764512d6 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -66,7 +66,6 @@ javax.mail mail - ${javax-mail-version} javax.activation diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 75b77f019a9..43b99da8fe2 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -68,7 +68,6 @@ junit junit - ${junit4-version} test diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index fbb16968697..665b3af9679 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -10,27 +10,20 @@ Jetty :: OSGi :: Example Equinox Tools Jetty OSGi Example Equinox Tools - v20110513 - 7.4.1.v20110513 - 3.6.0.v20100517 - 3.2.100.v20100503 ${project.groupId}.equinoxtools org.eclipse.jetty jetty-webapp - ${project.version} org.eclipse.jetty jetty-continuation - ${project.version} org.eclipse.jetty jetty-websocket - ${project.version} org.eclipse.jetty @@ -39,12 +32,10 @@ org.eclipse.osgi org.eclipse.osgi - ${osgi-version} org.eclipse.osgi org.eclipse.osgi.services - ${osgi-services-version} diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index f2a0795b5db..eedcb97f358 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -48,13 +48,11 @@ org.eclipse.jetty jetty-webapp - ${project.version} runtime org.eclipse.jetty jetty-deploy - ${project.version} runtime @@ -66,7 +64,6 @@ org.eclipse.jetty jetty-servlet - ${project.version} runtime @@ -78,13 +75,11 @@ org.eclipse.jetty jetty-jmx - ${project.version} runtime org.eclipse.jetty jetty-util - ${project.version} runtime @@ -96,7 +91,6 @@ org.eclipse.jetty jetty-websocket - ${project.version} runtime - - junit.framework.Assert - junit.framework.TestCase - - - junit - junit - - - org.eclipse.jdt.core.compiler - ecj - - ecj - - - org.mortbay.jetty - jsp-2.1-glassfish - - - - - ch.qos.logback - logback-core - - ch.qos.logback.core.joran.JoranConfiguratorBase - - liblogback-java - - - - org.apache.geronimo.specs - geronimo-jaspic_1.0_spec - - - - - org.eclipse.equinox.http - servlet - eclipse-platform - - - org.eclipse.osgi - services - - - - - org.apache.geronimo.specs - geronimo-jta_1.1_spec - libgeronimo-jta-1.1-spec-1.1.1-java - - - - org.eclipse - osgi - - org.osgi.framework.BundleContext - - - - - - org.slf4j - jcl-over-slf4j - libslf4j-java - - - - asm - asm-commons - libasm3-java - - - - ant - ant - ant - ant - - - asm - asm - libasm3-java - - - - asm - asm-tree - libasm3-java - - - - javax.mail - mail - - javax.mail.Authenticator - javax.mail.PasswordAuthentication - javax.mail.Session - - libgnumail-java - sun-mail - - - org.apache.geronimo.specs - geronimo-annotation_1.0_spec - - - - - org.slf4j - log4j-over-slf4j - libslf4j-java - - - - org.testng - testng - testng - - - - org.mortbay.jetty - servlet-api - 3.0.20100224 - - javax.servlet.AsyncContext - javax.servlet.AsyncEvent - javax.servlet.AsyncListener - - - - - - org.slf4j - slf4j-api - - org.slf4j.Logger - - libslf4j-java - - - - org.mortbay.jetty - jetty-util - - - - - javax.activation - activation - libgnujav-java - sun-jaf - - - - - jetty-annotations - jetty-jaspi - jetty-plus - example-jetty-embedded - test-continuation - test-continuation-jetty6 - test-jetty-servlet - - - - jetty-osgi - jetty-osgi-boot - jetty-osgi-boot-jsp - jetty-osgi-boot-logback - jetty-osgi-boot-warurl - jetty-httpservice - - - - jetty-server - jetty-client - jetty-servlet - jetty-webapp - jetty-plus - jetty-all-server - jetty-all - - - test-sessions-common - test-jdbc-sessions - test-hash-sessions - test-integration - test-webapp-rfc2616 - - - - debian/jetty.init - rpm/jetty.init - - - From 2d999a157bc051b79e01cd4724d8f50cc96dca07 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Wed, 11 Jan 2012 11:02:36 +1100 Subject: [PATCH 69/92] 368291 Change warning to info for NoSuchFieldException on BeanELResolver.properties --- .../org/eclipse/jetty/servlet/listener/ELContextCleaner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java index 285de0f3035..19c035e5173 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java @@ -76,7 +76,7 @@ public class ELContextCleaner implements ServletContextListener } catch (NoSuchFieldException e) { - LOG.warn("Cannot purge classes from javax.el.BeanELResolver", e); + LOG.info("Not cleaning cached beans: no such field javax.el.BeanELResolver.properties"); } } From cb22cfdbe51d024718288c9f4092d0be7ac08fa6 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 11:06:14 +1100 Subject: [PATCH 70/92] 368240: renamed to use manage/unmanage instead of join/disjoin --- .../org/eclipse/jetty/client/HttpClient.java | 4 +- .../jetty/deploy/DeploymentManager.java | 6 ++ .../jetty/server/AbstractConnector.java | 5 + .../server/ssl/SslSelectChannelConnector.java | 6 ++ .../util/component/AggregateLifeCycle.java | 94 ++++++++----------- .../component/AggregateLifeCycleTest.java | 14 +-- 6 files changed, 65 insertions(+), 64 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java index c52c25c858c..0b5581ed984 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java @@ -170,7 +170,9 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri } /* ------------------------------------------------------------ */ - /** + /** Set the ThreadPool. + * The threadpool passed is added via {@link #addBean(Object)} so that + * it's lifecycle may be managed as a {@link AggregateLifeCycle}. * @param threadPool the threadPool to set */ public void setThreadPool(ThreadPool threadPool) diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java index fb8e1a5d36b..afe06a80e1f 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java @@ -139,6 +139,12 @@ public class DeploymentManager extends AggregateLifeCycle } } + /* ------------------------------------------------------------ */ + /** Set the AppProviders. + * The providers passed are added via {@link #addBean(Object)} so that + * their lifecycles may be managed as a {@link AggregateLifeCycle}. + * @param providers + */ public void setAppProviders(Collection providers) { if (isRunning()) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index 7a95f4d5fd2..2dd058a615a 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -127,6 +127,11 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht } /* ------------------------------------------------------------ */ + /** Set the ThreadPool. + * The threadpool passed is added via {@link #addBean(Object)} so that + * it's lifecycle may be managed as a {@link AggregateLifeCycle}. + * @param threadPool the threadPool to set + */ public void setThreadPool(ThreadPool pool) { removeBean(_threadPool); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java index e7746cbb5c6..de82d510de1 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java @@ -33,6 +33,7 @@ import org.eclipse.jetty.io.nio.AsyncConnection; import org.eclipse.jetty.io.nio.SslConnection; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.nio.SelectChannelConnector; +import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.ssl.SslContextFactory; /* ------------------------------------------------------------ */ @@ -54,6 +55,11 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements } /* ------------------------------------------------------------ */ + /** Construct with explicit SslContextFactory. + * The SslContextFactory passed is added via {@link #addBean(Object)} so that + * it's lifecycle may be managed with {@link AggregateLifeCycle}. + * @param sslContextFactory + */ public SslSelectChannelConnector(SslContextFactory sslContextFactory) { _sslContextFactory = sslContextFactory; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java index 75e4a50253b..05448362f92 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java @@ -14,18 +14,22 @@ import org.eclipse.jetty.util.log.Logger; /** * An AggregateLifeCycle is an {@link LifeCycle} implementation for a collection of contained beans. *

      - * Beans can be added the AggregateLifeCycle either as joined beans, as disjoint beans. A joined bean is started, stopped and destroyed with the aggregate. - * A disjointed bean is associated with the aggregate for the purposes of {@link #dump()}, but it's lifecycle must be managed externally. + * Beans can be added the AggregateLifeCycle either as managed beans or as unmanaged beans. A managed bean is started, stopped and destroyed with the aggregate. + * An umanaged bean is associated with the aggregate for the purposes of {@link #dump()}, but it's lifecycle must be managed externally. *

      - * When a bean is added, if it is a {@link LifeCycle} and it is already started, then it is assumed to be a disjoined bean. - * Otherwise the methods {@link #addBean(LifeCycle, boolean)}, {@link #join(LifeCycle)} and {@link #disjoin(LifeCycle)} can be used to + * When a bean is added, if it is a {@link LifeCycle} and it is already started, then it is assumed to be an unmanaged bean. + * Otherwise the methods {@link #addBean(LifeCycle, boolean)}, {@link #manage(LifeCycle)} and {@link #unmanage(LifeCycle)} can be used to * explicitly control the life cycle relationship. *

      + * If adding a bean that is shared between multiple {@link AggregateLifeCycle} instances, then it should be started before being added, so it is unmanged, or + * the API must be used to explicitly set it as unmanaged. + *

      */ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable, Dumpable { private static final Logger LOG = Log.getLogger(AggregateLifeCycle.class); private final List _beans=new CopyOnWriteArrayList(); + private boolean _started=false; private class Bean { @@ -34,12 +38,12 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable _bean=b; } final Object _bean; - volatile boolean _joined=true; + volatile boolean _managed=true; } /* ------------------------------------------------------------ */ /** - * Start the joined lifecycle beans in the order they were added. + * Start the managed lifecycle beans in the order they were added. * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() */ @Override @@ -47,13 +51,15 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable { for (Bean b:_beans) { - if (b._joined && b._bean instanceof LifeCycle) + if (b._managed && b._bean instanceof LifeCycle) { LifeCycle l=(LifeCycle)b._bean; if (!l.isRunning()) l.start(); } } + // indicate that we are started, so that addBean will start other beans added. + _started=true; super.doStart(); } @@ -65,12 +71,13 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable @Override protected void doStop() throws Exception { + _started=false; super.doStop(); List reverse = new ArrayList(_beans); Collections.reverse(reverse); for (Bean b:reverse) { - if (b._joined && b._bean instanceof LifeCycle) + if (b._managed && b._bean instanceof LifeCycle) { LifeCycle l=(LifeCycle)b._bean; if (l.isRunning()) @@ -91,7 +98,7 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable Collections.reverse(reverse); for (Bean b:reverse) { - if (b._bean instanceof Destroyable && b._joined) + if (b._bean instanceof Destroyable && b._managed) { Destroyable d=(Destroyable)b._bean; d.destroy(); @@ -119,76 +126,51 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable * @param bean * @return True if the aggregate contains the bean and it is joined */ - public boolean isJoined(Object bean) + public boolean isManaged(Object bean) { for (Bean b:_beans) if (b._bean==bean) - return b._joined; + return b._managed; return false; } /* ------------------------------------------------------------ */ /** * Add an associated bean. - * If the bean is a {@link LifeCycle}, it is added as neither joined or disjoint and - * that status will be determined when the Aggregate bean is started. + * If the bean is a {@link LifeCycle}, then it will be managed if it is not + * already started and umanaged if it is already started. The {@link #addBean(Object, boolean)} + * method should be used if this is not correct, or the {@link #manage(Object)} and {@link #unmanage(Object)} + * methods may be used after an add to change the status. * @param o the bean object to add * @return true if the bean was added or false if it has already been added. */ public boolean addBean(Object o) { - if (contains(o)) - return false; - - Bean b = new Bean(o); - _beans.add(b); - - // extra LifeCycle handling - if (o instanceof LifeCycle) - { - LifeCycle l=(LifeCycle)o; - - // If it is running, then assume it is disjoint - if (l.isRunning()) - b._joined=false; - - // else if we are running, then start the bean - else if (isRunning()) - { - try - { - l.start(); - } - catch(Exception e) - { - throw new RuntimeException (e); - } - } - } - - return true; + // beans are joined unless they are started lifecycles + return addBean(o,!((o instanceof LifeCycle)&&((LifeCycle)o).isStarted())); } /* ------------------------------------------------------------ */ /** Add an associated lifecycle. * @param o The lifecycle to add - * @param joined True if the LifeCycle is to be joined, otherwise it will be disjoint. + * @param managed True if the LifeCycle is to be joined, otherwise it will be disjoint. * @return */ - public boolean addBean(Object o, boolean joined) + public boolean addBean(Object o, boolean managed) { if (contains(o)) return false; Bean b = new Bean(o); - b._joined=joined; + b._managed=managed; _beans.add(b); if (o instanceof LifeCycle) { LifeCycle l=(LifeCycle)o; - if (joined && isStarted()) + // Start the bean if we are started + if (managed && _started) { try { @@ -205,17 +187,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable /* ------------------------------------------------------------ */ /** - * Join a bean to this aggregate, so that it is started/stopped/destroyed with the + * Manage a bean by this aggregate, so that it is started/stopped/destroyed with the * aggregate lifecycle. - * @param bean The bean to join (must already have been added). + * @param bean The bean to manage (must already have been added). */ - public void join(Object bean) + public void manage(Object bean) { for (Bean b :_beans) { if (b._bean==bean) { - b._joined=true; + b._managed=true; return; } } @@ -224,17 +206,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable /* ------------------------------------------------------------ */ /** - * Disjoin a bean to this aggregate, so that it is not started/stopped/destroyed with the + * Unmanage a bean by this aggregate, so that it is not started/stopped/destroyed with the * aggregate lifecycle. - * @param bean The bean to join (must already have been added). + * @param bean The bean to manage (must already have been added). */ - public void disjoin(Object bean) + public void unmanage(Object bean) { for (Bean b :_beans) { if (b._bean==bean) { - b._joined=false; + b._managed=false; return; } } @@ -372,7 +354,7 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable { i++; - if (b._joined) + if (b._managed) { out.append(indent).append(" +- "); if (b._bean instanceof Dumpable) diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/component/AggregateLifeCycleTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/component/AggregateLifeCycleTest.java index 2b5ec8d6e86..495c6fd587f 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/component/AggregateLifeCycleTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/component/AggregateLifeCycleTest.java @@ -149,7 +149,7 @@ public class AggregateLifeCycleTest // Now add it a0.addBean(a1); - Assert.assertFalse(a0.isJoined(a1)); + Assert.assertFalse(a0.isManaged(a1)); a0.start(); Assert.assertEquals(1,started.get()); @@ -176,8 +176,8 @@ public class AggregateLifeCycleTest Assert.assertEquals(1,stopped.get()); Assert.assertEquals(0,destroyed.get()); - a0.join(a1); - Assert.assertTrue(a0.isJoined(a1)); + a0.manage(a1); + Assert.assertTrue(a0.isManaged(a1)); a0.stop(); Assert.assertEquals(1,started.get()); @@ -196,8 +196,8 @@ public class AggregateLifeCycleTest Assert.assertEquals(0,destroyed.get()); - a0.disjoin(a1); - Assert.assertFalse(a0.isJoined(a1)); + a0.unmanage(a1); + Assert.assertFalse(a0.isManaged(a1)); a0.destroy(); Assert.assertEquals(2,started.get()); @@ -262,8 +262,8 @@ public class AggregateLifeCycleTest a0.dumpStdErr(); System.err.println("--"); - a0.disjoin(aa); - a2.disjoin(aa0); + a0.unmanage(aa); + a2.unmanage(aa0); a0.dumpStdErr(); } From d66f45f2daef85c71a1d5d8e4987036fb8f871d9 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 11:16:31 +1100 Subject: [PATCH 71/92] 368240: renamed to use manage/unmanage instead of join/disjoin --- .../main/java/org/eclipse/jetty/client/SelectConnector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index 363349d150e..e1c282e74db 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -48,7 +48,8 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector /* ------------------------------------------------------------ */ /** - * @param httpClient the HttpClient this connector is associated to + * @param httpClient the HttpClient this connector is associated to. It is + * added via the {@link #addBean(Object, boolean)} as an unmanaged bean. */ SelectConnector(HttpClient httpClient) { From d0b81a185c260ffceecb9d7470b3ddfbfeda4c11 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 11:51:04 +1100 Subject: [PATCH 72/92] 367638: 361316: protected multipart filter from DoS --- .../jetty/server/handler/ContextHandler.java | 5 ++++- .../org/eclipse/jetty/servlets/MultiPartFilter.java | 13 ++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index 3538d75f96d..f827bdd9c68 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -75,7 +75,10 @@ import org.eclipse.jetty.util.resource.Resource; *

      * If the context init parameter "org.eclipse.jetty.server.context.ManagedAttributes" is set to a comma separated list of names, then they are treated as * context attribute names, which if set as attributes are passed to the servers Container so that they may be managed with JMX. - * + *

      + * The maximum size of a form that can be processed by this context is controlled by the system properties org.eclipse.jetty.server.Request.maxFormKeys + * and org.eclipse.jetty.server.Request.maxFormContentSize. These can also be configured with {@link #setMaxFormContentSize(int)} and {@link #setMaxFormKeys(int)} + * * @org.apache.xbean.XBean description="Creates a basic HTTP context" */ public class ContextHandler extends ScopedHandler implements Attributes, Server.Graceful diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java index 049f37072b1..a2dd4492ed1 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java @@ -59,6 +59,13 @@ import org.eclipse.jetty.util.TypeUtil; *

      * If the init parameter "delete" is set to "true", any files created will be deleted when the * current request returns. + *

      + * 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 deleteFiles controls if uploaded files are automatically deleted after the request + * completes. * */ public class MultiPartFilter implements Filter @@ -69,6 +76,7 @@ public class MultiPartFilter implements Filter private boolean _deleteFiles; private ServletContext _context; private int _fileOutputBuffer = 0; + private int _maxFormKeys = Integer.getInteger("org.eclipse.jetty.server.Request.maxFormKeys",1000).intValue(); /* ------------------------------------------------------------------------------- */ /** @@ -82,6 +90,9 @@ public class MultiPartFilter implements Filter if(fileOutputBuffer!=null) _fileOutputBuffer = Integer.parseInt(fileOutputBuffer); _context=filterConfig.getServletContext(); + String mfks = filterConfig.getInitParameter("maxFormKeys"); + if (mfks!=null) + _maxFormKeys=Integer.parseInt(mfks); } /* ------------------------------------------------------------------------------- */ @@ -134,7 +145,7 @@ public class MultiPartFilter implements Filter String content_transfer_encoding=null; - outer:while(!lastPart) + outer:while(!lastPart && params.size()<_maxFormKeys) { String type_content=null; From 2d24eb824070b85baf217da0db3d4777ca19d511 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 12:17:26 +1100 Subject: [PATCH 73/92] 368191: fixed numerical overflow converting seconds to ms --- .../org/eclipse/jetty/nosql/NoSqlSession.java | 2 +- .../jetty/server/handler/DefaultHandler.java | 2 +- .../jetty/server/session/AbstractSession.java | 4 ++-- .../server/session/HashSessionManager.java | 24 +++++++++---------- .../jetty/server/session/HashedSession.java | 2 +- .../server/session/JDBCSessionIdManager.java | 4 ++-- .../server/session/JDBCSessionManager.java | 18 +++++++------- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java index 76f85ae8a5c..63ac8212242 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java @@ -79,7 +79,7 @@ public class NoSqlSession extends AbstractSession __log.debug("NoSqlSession:access:active "+_active); if (_active.incrementAndGet()==1) { - int period=_manager.getStalePeriod()*1000; + long period=_manager.getStalePeriod()*1000L; if (period==0) refresh(); else if (period>0) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java index 6ac3dcc2ff2..dba7f5bd117 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java @@ -50,7 +50,7 @@ public class DefaultHandler extends AbstractHandler { private static final Logger LOG = Log.getLogger(DefaultHandler.class); - final long _faviconModified=(System.currentTimeMillis()/1000)*1000; + final long _faviconModified=(System.currentTimeMillis()/1000)*1000L; byte[] _favicon; boolean _serveIcon=true; boolean _showContexts=true; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java index 73a4b6f81b8..690c917393b 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java @@ -62,7 +62,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI _accessed=_created; _lastAccessed=_created; _requests=1; - _maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000:-1; + _maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000L:-1; if (LOG.isDebugEnabled()) LOG.debug("new session & id "+_nodeId+" "+_clusterId); } @@ -430,7 +430,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI /* ------------------------------------------------------------- */ public void setMaxInactiveInterval(int secs) { - _maxIdleMs=(long)secs*1000; + _maxIdleMs=(long)secs*1000L; } /* ------------------------------------------------------------- */ diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java index 3b59213b516..04cf643c21c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java @@ -53,9 +53,9 @@ public class HashSessionManager extends AbstractSessionManager private Timer _timer; private boolean _timerStop=false; private TimerTask _task; - int _scavengePeriodMs=30000; - int _savePeriodMs=0; //don't do period saves by default - int _idleSavePeriodMs = 0; // don't idle save sessions by default. + long _scavengePeriodMs=30000; + long _savePeriodMs=0; //don't do period saves by default + long _idleSavePeriodMs = 0; // don't idle save sessions by default. private TimerTask _saveTask; File _storeDir; private boolean _lazyLoad=false; @@ -134,7 +134,7 @@ public class HashSessionManager extends AbstractSessionManager */ public int getScavengePeriod() { - return _scavengePeriodMs/1000; + return (int)(_scavengePeriodMs/1000); } @@ -160,7 +160,7 @@ public class HashSessionManager extends AbstractSessionManager if (_idleSavePeriodMs <= 0) return 0; - return _idleSavePeriodMs / 1000; + return (int)(_idleSavePeriodMs / 1000); } /* ------------------------------------------------------------ */ @@ -174,7 +174,7 @@ public class HashSessionManager extends AbstractSessionManager */ public void setIdleSavePeriod(int seconds) { - _idleSavePeriodMs = seconds * 1000; + _idleSavePeriodMs = seconds * 1000L; } /* ------------------------------------------------------------ */ @@ -182,7 +182,7 @@ public class HashSessionManager extends AbstractSessionManager public void setMaxInactiveInterval(int seconds) { super.setMaxInactiveInterval(seconds); - if (_dftMaxIdleSecs>0&&_scavengePeriodMs>_dftMaxIdleSecs*1000) + if (_dftMaxIdleSecs>0&&_scavengePeriodMs>_dftMaxIdleSecs*1000L) setScavengePeriod((_dftMaxIdleSecs+9)/10); } @@ -192,7 +192,7 @@ public class HashSessionManager extends AbstractSessionManager */ public void setSavePeriod (int seconds) { - int period = (seconds * 1000); + long period = (seconds * 1000L); if (period < 0) period=0; _savePeriodMs=period; @@ -235,7 +235,7 @@ public class HashSessionManager extends AbstractSessionManager if (_savePeriodMs<=0) return 0; - return _savePeriodMs/1000; + return (int)(_savePeriodMs/1000); } /* ------------------------------------------------------------ */ @@ -247,8 +247,8 @@ public class HashSessionManager extends AbstractSessionManager if (seconds==0) seconds=60; - int old_period=_scavengePeriodMs; - int period=seconds*1000; + long old_period=_scavengePeriodMs; + long period=seconds*1000L; if (period>60000) period=60000; if (period<1000) @@ -297,7 +297,7 @@ public class HashSessionManager extends AbstractSessionManager for (Iterator i=_sessions.values().iterator(); i.hasNext();) { HashedSession session=i.next(); - long idleTime=session.getMaxInactiveInterval()*1000; + long idleTime=session.getMaxInactiveInterval()*1000L; if (idleTime>0&&session.getAccessed()+idleTime0&&(getMaxInactiveInterval()*1000/10)<_hashSessionManager._scavengePeriodMs) + if (getMaxInactiveInterval()>0&&(getMaxInactiveInterval()*1000L/10)<_hashSessionManager._scavengePeriodMs) _hashSessionManager.setScavengePeriod((secs+9)/10); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java index 5280023e7d1..1647372f198 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java @@ -69,7 +69,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager protected Timer _timer; //scavenge timer protected TimerTask _task; //scavenge task protected long _lastScavengeTime; - protected long _scavengeIntervalMs = 1000 * 60 * 10; //10mins + protected long _scavengeIntervalMs = 1000L * 60 * 10; //10mins protected String _blobType; //if not set, is deduced from the type of the database at runtime protected String _createSessionIdTable; @@ -245,7 +245,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager sec=60; long old_period=_scavengeIntervalMs; - long period=sec*1000; + long period=sec*1000L; _scavengeIntervalMs=period; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java index bcf443eb8d4..931ff5d4484 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java @@ -277,11 +277,11 @@ public class JDBCSessionManager extends AbstractSessionManager super(JDBCSessionManager.this,request); _data = new SessionData(getClusterId(),_jdbcAttributes); if (_dftMaxIdleSecs>0) - _data.setMaxIdleMs(_dftMaxIdleSecs*1000); + _data.setMaxIdleMs(_dftMaxIdleSecs*1000L); _data.setCanonicalContext(canonicalize(_context.getContextPath())); _data.setVirtualHost(getVirtualHost(_context)); int maxInterval=getMaxInactiveInterval(); - _data.setExpiryTime(maxInterval <= 0 ? 0 : (System.currentTimeMillis() + maxInterval*1000)); + _data.setExpiryTime(maxInterval <= 0 ? 0 : (System.currentTimeMillis() + maxInterval*1000L)); } /** @@ -293,7 +293,7 @@ public class JDBCSessionManager extends AbstractSessionManager super(JDBCSessionManager.this,data.getCreated(), accessed, data.getId()); _data=data; if (_dftMaxIdleSecs>0) - _data.setMaxIdleMs(_dftMaxIdleSecs*1000); + _data.setMaxIdleMs(_dftMaxIdleSecs*1000L); _jdbcAttributes.putAll(_data.getAttributeMap()); _data.setAttributeMap(_jdbcAttributes); } @@ -333,7 +333,7 @@ public class JDBCSessionManager extends AbstractSessionManager _data.setAccessed(time); int maxInterval=getMaxInactiveInterval(); - _data.setExpiryTime(maxInterval <= 0 ? 0 : (time + maxInterval*1000)); + _data.setExpiryTime(maxInterval <= 0 ? 0 : (time + maxInterval*1000L)); return true; } return false; @@ -357,7 +357,7 @@ public class JDBCSessionManager extends AbstractSessionManager updateSession(_data); didActivate(); } - else if ((_data._accessed - _data._lastSaved) >= (getSaveInterval() * 1000)) + else if ((_data._accessed - _data._lastSaved) >= (getSaveInterval() * 1000L)) { updateSessionAccessTime(_data); } @@ -506,23 +506,23 @@ public class JDBCSessionManager extends AbstractSessionManager LOG.debug("getSession("+idInCluster+"): not in session map,"+ " now="+now+ " lastSaved="+(session==null?0:session._data._lastSaved)+ - " interval="+(_saveIntervalSec * 1000)); + " interval="+(_saveIntervalSec * 1000L)); else LOG.debug("getSession("+idInCluster+"): in session map, "+ " now="+now+ " lastSaved="+(session==null?0:session._data._lastSaved)+ - " interval="+(_saveIntervalSec * 1000)+ + " interval="+(_saveIntervalSec * 1000L)+ " lastNode="+session._data.getLastNode()+ " thisNode="+getSessionIdManager().getWorkerName()+ " difference="+(now - session._data._lastSaved)); } - if (session==null || ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000))) + if (session==null || ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000L))) { LOG.debug("getSession("+idInCluster+"): no session in session map or stale session. Reloading session data from db."); data = loadSession(idInCluster, canonicalize(_context.getContextPath()), getVirtualHost(_context)); } - else if ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000)) + else if ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000L)) { LOG.debug("getSession("+idInCluster+"): stale session. Reloading session data from db."); data = loadSession(idInCluster, canonicalize(_context.getContextPath()), getVirtualHost(_context)); From 1697fcfa5a58d57dab0704b32b5a253c93af9af4 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 12:23:04 +1100 Subject: [PATCH 74/92] 368060 do not encode sendRedirect URLs --- .../src/main/java/org/eclipse/jetty/server/Response.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index d5fa8321d62..1befeff5ad7 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -466,7 +466,6 @@ public class Response implements HttpServletResponse } } - location=encodeRedirectURL(location); resetBuffer(); setHeader(HttpHeaders.LOCATION,location); setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); From c5e3ed5afe529f52096c3da69d55f2202d607dbf Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 11 Jan 2012 16:39:03 +1100 Subject: [PATCH 75/92] improved test timing --- .../eclipse/jetty/websocket/SafariWebsocketDraft0Test.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java index 9b4af2d27c9..fb39dde130f 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java @@ -95,10 +95,11 @@ public class SafariWebsocketDraft0Test CaptureSocket socket = servlet.captures.get(0); Assert.assertThat("CaptureSocket",socket,notNullValue()); - Assert.assertThat("CaptureSocket.isConnected", socket.awaitConnected(1000), is(true)); + Assert.assertThat("CaptureSocket.isConnected", socket.awaitConnected(10000), is(true)); // Give servlet time to process messages - threadSleep(1,TimeUnit.SECONDS); + for (int i=0;i<100 && socket.messages.size()<5;i++) + threadSleep(100,TimeUnit.MILLISECONDS); // Should have captured 5 messages. Assert.assertThat("CaptureSocket.messages.size",socket.messages.size(),is(5)); From f81a8a3d9cff7e77bca42091e2dd55caf27c86eb Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Wed, 11 Jan 2012 16:53:39 +0100 Subject: [PATCH 76/92] 367716: Enhance maxIdleTests for SelectChannelTimeout Signed-off-by: Simone Bordet --- .../jetty/server/AsyncHttpConnection.java | 20 +++++++++---------- .../server/SelectChannelTimeoutTest.java | 11 +++++----- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index 59e66626e69..cbd9b7ecf39 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -45,6 +45,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async _asyncEndp=(AsyncEndPoint)endpoint; } + @Override public Connection handle() throws IOException { Connection connection = this; @@ -54,10 +55,10 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async try { setCurrentConnection(this); - + // don't check for idle while dispatched (unless blocking IO is done). _asyncEndp.setCheckForIdle(false); - + // While progress and the connection has not changed while (progress && connection==this) @@ -67,7 +68,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async { // Handle resumed request if (_request._async.isAsync()) - { + { if (_request._async.isDispatchable()) handleRequest(); } @@ -126,7 +127,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async } else if (_request.getAsyncContinuation().isAsyncStarted()) { - // The request is suspended, so even though progress has been made, + // The request is suspended, so even though progress has been made, // exit the while loop by setting progress to false LOG.debug("suspended {}",this); progress=false; @@ -137,21 +138,18 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async finally { setCurrentConnection(null); - + // If we are not suspended if (!_request.getAsyncContinuation().isAsyncStarted()) { // return buffers _parser.returnBuffers(); _generator.returnBuffers(); - } - - // reenable idle checking unless request is suspended - if(!_request.getAsyncContinuation().isAsyncStarted()) - { + + // reenable idle checking unless request is suspended _asyncEndp.setCheckForIdle(true); } - + // Safety net to catch spinning if (some_progress) _total_no_progress=0; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java index b0b3af66339..ed0ec70ea08 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java @@ -13,7 +13,6 @@ package org.eclipse.jetty.server; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; @@ -50,7 +49,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setSuspendFor(100); _handler.setResumeAfter(25); - assertTrue(process(null).toUpperCase().contains("RESUMED")); + assertTrue(process(null).toUpperCase().contains("RESUMED")); } @Test @@ -84,7 +83,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest private synchronized String process(String content) throws UnsupportedEncodingException, IOException, InterruptedException { - String request = "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + "Connection: close\r\n"; + String request = "GET / HTTP/1.1\r\n" + "Host: localhost\r\n"; if (content == null) request += "\r\n"; @@ -97,11 +96,13 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest { SelectChannelConnector connector = (SelectChannelConnector)_connector; Socket socket = new Socket((String)null,connector.getLocalPort()); + socket.setSoTimeout(10 * MAX_IDLE_TIME); socket.getOutputStream().write(request.getBytes("UTF-8")); InputStream inputStream = socket.getInputStream(); + long start = System.currentTimeMillis(); String response = IO.toString(inputStream); - Thread.sleep(500); - assertEquals("Socket should be closed and return -1 on reading",-1,socket.getInputStream().read()); + long timeElapsed = System.currentTimeMillis() - start; + assertTrue("Time elapsed should be at least MAX_IDLE_TIME",timeElapsed > MAX_IDLE_TIME); return response; } From 0dcb3bec9a4249757e751095f84024d5540c8a40 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Wed, 11 Jan 2012 11:04:59 -0600 Subject: [PATCH 77/92] remove duplicate dependency plugin usage --- tests/test-integration/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index bf1daf62b96..90bc814ddd0 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -53,12 +53,6 @@ ${project.build.directory}/webapps - - - - org.apache.maven.plugins - maven-dependency-plugin - unpack-jetty-distro process-test-resources From 5c059550a8a0b2a053c5364b4ee9bb44193073ae Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 11 Jan 2012 22:18:24 +0100 Subject: [PATCH 78/92] Improved logging. --- .../main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java index fb3c09145a8..3a72cd2c1c9 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java @@ -246,8 +246,7 @@ public class ChannelEndPoint implements EndPoint } catch (IOException x) { - LOG.debug(x.toString()); - LOG.ignore(x); + LOG.debug("Exception while filling", x); try { if (_channel.isOpen()) From d4f522b9d45a110dfe2e1838118bed8054a8e5a5 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 11 Jan 2012 22:22:42 +0100 Subject: [PATCH 79/92] Corrected SslConnection to clear the _inbound buffer if the input is shutdown and the unwrapping yielded a buffer underflow. This is important because isInputShutdown() returns true only if the _inbound buffer is empty, and the check for the input shutdown is made in several places. Added also more SSL bytes tests that send RST in order to test cases that throw exceptions. --- .../jetty/client/SslBytesServerTest.java | 199 ++++++++++++++---- .../eclipse/jetty/client/SslBytesTest.java | 2 +- .../eclipse/jetty/io/nio/SslConnection.java | 4 +- 3 files changed, 164 insertions(+), 41 deletions(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java index abcdce4d001..b417ce0cc22 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java @@ -45,7 +45,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import static org.hamcrest.Matchers.greaterThan; @@ -226,6 +225,7 @@ public class SslBytesServerTest extends SslBytesTest Assert.assertNull(handshake.get(5, TimeUnit.SECONDS)); // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -304,6 +304,7 @@ public class SslBytesServerTest extends SslBytesTest Assert.assertNull(handshake.get(5, TimeUnit.SECONDS)); // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -333,6 +334,129 @@ public class SslBytesServerTest extends SslBytesTest proxy.flushToClient(record); } + @Test + public void testClientHelloIncompleteThenReset() throws Exception + { + final SSLSocket client = newClient(); + + threadPool.submit(new Callable() + { + public Object call() throws Exception + { + client.startHandshake(); + return null; + } + }); + + // Client Hello + TLSRecord record = proxy.readFromClient(); + byte[] bytes = record.getBytes(); + byte[] chunk1 = new byte[2 * bytes.length / 3]; + System.arraycopy(bytes, 0, chunk1, 0, chunk1.length); + proxy.flushToServer(100, chunk1); + + proxy.sendRSTToServer(); + + // Wait a while to detect spinning + TimeUnit.MILLISECONDS.sleep(500); + Assert.assertThat(sslHandles.get(), lessThan(20)); + Assert.assertThat(sslFlushes.get(), lessThan(20)); + Assert.assertThat(httpParses.get(), lessThan(50)); + + client.close(); + } + + @Test + public void testClientHelloThenReset() throws Exception + { + final SSLSocket client = newClient(); + + threadPool.submit(new Callable() + { + public Object call() throws Exception + { + client.startHandshake(); + return null; + } + }); + + // Client Hello + TLSRecord record = proxy.readFromClient(); + Assert.assertNotNull(record); + proxy.flushToServer(record); + + proxy.sendRSTToServer(); + + // Wait a while to detect spinning + TimeUnit.MILLISECONDS.sleep(500); + Assert.assertThat(sslHandles.get(), lessThan(20)); + Assert.assertThat(sslFlushes.get(), lessThan(20)); + Assert.assertThat(httpParses.get(), lessThan(50)); + + client.close(); + } + + @Test + public void testHandshakeThenReset() throws Exception + { + final SSLSocket client = newClient(); + + SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); + client.startHandshake(); + Assert.assertTrue(automaticProxyFlow.stop(5, TimeUnit.SECONDS)); + + proxy.sendRSTToServer(); + + // Wait a while to detect spinning + TimeUnit.MILLISECONDS.sleep(500); + Assert.assertThat(sslHandles.get(), lessThan(20)); + Assert.assertThat(sslFlushes.get(), lessThan(20)); + Assert.assertThat(httpParses.get(), lessThan(50)); + + client.close(); + } + + @Test + public void testRequestIncompleteThenReset() throws Exception + { + final SSLSocket client = newClient(); + + SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); + client.startHandshake(); + Assert.assertTrue(automaticProxyFlow.stop(5, TimeUnit.SECONDS)); + + threadPool.submit(new Callable() + { + public Object call() throws Exception + { + OutputStream clientOutput = client.getOutputStream(); + clientOutput.write(("" + + "GET / HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "\r\n").getBytes("UTF-8")); + clientOutput.flush(); + return null; + } + }); + + // Application data + TLSRecord record = proxy.readFromClient(); + byte[] bytes = record.getBytes(); + byte[] chunk1 = new byte[2 * bytes.length / 3]; + System.arraycopy(bytes, 0, chunk1, 0, chunk1.length); + proxy.flushToServer(100, chunk1); + + proxy.sendRSTToServer(); + + // Wait a while to detect spinning + TimeUnit.MILLISECONDS.sleep(500); + Assert.assertThat(sslHandles.get(), lessThan(20)); + Assert.assertThat(sslFlushes.get(), lessThan(20)); + Assert.assertThat(httpParses.get(), lessThan(50)); + + client.close(); + } + @Test public void testRequestResponse() throws Exception { @@ -377,6 +501,7 @@ public class SslBytesServerTest extends SslBytesTest } // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -468,6 +593,7 @@ public class SslBytesServerTest extends SslBytesTest } // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(750)); Assert.assertThat(sslFlushes.get(), lessThan(750)); Assert.assertThat(httpParses.get(), lessThan(150)); @@ -492,20 +618,12 @@ public class SslBytesServerTest extends SslBytesTest proxy.flushToClient(record); } - /** - * TODO - * Currently this test does not pass. - * The problem is a mix of Java not being able to perform SSL half closes - * (but SSL supporting it), and the current implementation in Jetty. - * See the test below, that passes and whose only difference is that we - * delay the output shutdown from the client. - * - * @throws Exception if the test fails - */ - @Ignore @Test public void testRequestWithCloseAlertAndShutdown() throws Exception { + // See next test on why we only run in Linux + Assume.assumeTrue(OS.IS_LINUX); + final SSLSocket client = newClient(); SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); @@ -555,10 +673,11 @@ public class SslBytesServerTest extends SslBytesTest Assert.assertEquals(TLSRecord.Type.ALERT, record.getType()); // We can't forward to the client, its socket is already closed - // Socket close - record = proxy.readFromClient(); - Assert.assertNull(String.valueOf(record), record); - proxy.flushToServer(record); + // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); + Assert.assertThat(sslHandles.get(), lessThan(20)); + Assert.assertThat(sslFlushes.get(), lessThan(20)); + Assert.assertThat(httpParses.get(), lessThan(50)); // Socket close record = proxy.readFromServer(); @@ -569,21 +688,16 @@ public class SslBytesServerTest extends SslBytesTest @Test public void testRequestWithCloseAlert() throws Exception { - if ( !OS.IS_LINUX ) - { - // currently we are ignoring this test on anything other then linux - - //http://tools.ietf.org/html/rfc2246#section-7.2.1 + // Currently we are ignoring this test on anything other then linux + // http://tools.ietf.org/html/rfc2246#section-7.2.1 + + // TODO (react to this portion which seems to allow win/mac behavior) + // It is required that the other party respond with a close_notify alert of its own + // and close down the connection immediately, discarding any pending writes. It is not + // required for the initiator of the close to wait for the responding + // close_notify alert before closing the read side of the connection. + Assume.assumeTrue(OS.IS_LINUX); - // TODO (react to this portion which seems to allow win/mac behavior) - //It is required that the other party respond with a close_notify alert of its own - //and close down the connection immediately, discarding any pending writes. It is not - //required for the initiator of the close to wait for the responding - //close_notify alert before closing the read side of the connection. - return; - } - - final SSLSocket client = newClient(); SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); @@ -634,6 +748,7 @@ public class SslBytesServerTest extends SslBytesTest // We can't forward to the client, its socket is already closed // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -692,6 +807,7 @@ public class SslBytesServerTest extends SslBytesTest proxy.flushToClient(record); // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -700,7 +816,7 @@ public class SslBytesServerTest extends SslBytesTest } @Test - public void testRequestWithBigContentWriteBlockedAndResetException() throws Exception + public void testRequestWithBigContentWriteBlockedThenReset() throws Exception { final SSLSocket client = newClient(); @@ -744,11 +860,10 @@ public class SslBytesServerTest extends SslBytesTest // connection, and this will cause an exception in the // server that is trying to write the data - proxy.resetServer(); + proxy.sendRSTToServer(); // Wait a while to detect spinning - TimeUnit.SECONDS.sleep(1); - + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -762,17 +877,17 @@ public class SslBytesServerTest extends SslBytesTest if ( !OS.IS_LINUX ) { // currently we are ignoring this test on anything other then linux - + //http://tools.ietf.org/html/rfc2246#section-7.2.1 - // TODO (react to this portion which seems to allow win/mac behavior) - //It is required that the other party respond with a close_notify alert of its own + // TODO (react to this portion which seems to allow win/mac behavior) + //It is required that the other party respond with a close_notify alert of its own //and close down the connection immediately, discarding any pending writes. It is not //required for the initiator of the close to wait for the responding //close_notify alert before closing the read side of the connection. return; } - + final SSLSocket client = newClient(); SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); @@ -831,6 +946,7 @@ public class SslBytesServerTest extends SslBytesTest // We can't forward to the client, its socket is already closed // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -900,6 +1016,7 @@ public class SslBytesServerTest extends SslBytesTest } // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -953,6 +1070,7 @@ public class SslBytesServerTest extends SslBytesTest } // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(150)); @@ -974,6 +1092,7 @@ public class SslBytesServerTest extends SslBytesTest } // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(150)); @@ -1105,6 +1224,7 @@ public class SslBytesServerTest extends SslBytesTest } // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); @@ -1264,6 +1384,7 @@ public class SslBytesServerTest extends SslBytesTest } // Check that we did not spin + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(100)); @@ -1312,7 +1433,7 @@ public class SslBytesServerTest extends SslBytesTest // Client should close the socket, but let's hold it open. // Check that we did not spin - TimeUnit.MILLISECONDS.sleep(100); + TimeUnit.MILLISECONDS.sleep(500); Assert.assertThat(sslHandles.get(), lessThan(20)); Assert.assertThat(sslFlushes.get(), lessThan(20)); Assert.assertThat(httpParses.get(), lessThan(50)); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesTest.java index 4c8266180c4..9b13bc30e02 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesTest.java @@ -320,7 +320,7 @@ public abstract class SslBytesTest return latch.await(time, unit); } - public void resetServer() throws IOException + public void sendRSTToServer() throws IOException { // Calling setSoLinger(true, 0) causes close() // to send a RST instead of a FIN, causing an diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java index 876db22112d..d531dc606e9 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java @@ -541,6 +541,8 @@ public class SslConnection extends AbstractConnection implements AsyncConnection switch(result.getStatus()) { case BUFFER_UNDERFLOW: + if (_endp.isInputShutdown()) + _inbound.clear(); break; case BUFFER_OVERFLOW: @@ -598,7 +600,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection { return _engine; } - + public AsyncEndPoint getEndpoint() { return _aEndp; From 47b7b6db70a8ba1381555e46e9b05311fb321bae Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 12 Jan 2012 10:33:25 +1100 Subject: [PATCH 80/92] 368113 Support servlet mapping to "" --- .../java/org/eclipse/jetty/http/PathMap.java | 26 ++++++++++++++++--- .../org/eclipse/jetty/http/PathMapTest.java | 5 +++- .../eclipse/jetty/servlet/ServletHandler.java | 6 ++--- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java index 19da9e00104..12abbfee5b5 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java @@ -146,7 +146,16 @@ public class PathMap extends HashMap implements Externalizable @Override public Object put(Object pathSpec, Object object) { - StringTokenizer tok = new StringTokenizer(pathSpec.toString(),__pathSpecSeparators); + String str = pathSpec.toString(); + if ("".equals(str.trim())) + { + Entry entry = new Entry("",object); + entry.setMapped(""); + _exactMap.put("", entry); + return super.put("", object); + } + + StringTokenizer tok = new StringTokenizer(str,__pathSpecSeparators); Object old =null; while (tok.hasMoreTokens()) @@ -218,13 +227,21 @@ public class PathMap extends HashMap implements Externalizable */ public Entry getMatch(String path) { - Map.Entry entry; + Map.Entry entry=null; if (path==null) return null; int l=path.length(); - + + //special case + if (l == 1 && path.charAt(0)=='/') + { + entry = (Map.Entry)_exactMap.get(""); + if (entry != null) + return (Entry)entry; + } + // try exact match entry=_exactMap.getEntry(path,0,l); if (entry!=null) @@ -455,6 +472,9 @@ public class PathMap extends HashMap implements Externalizable */ public static String pathInfo(String pathSpec, String path) { + if ("".equals(pathSpec)) + return path; //servlet 3 spec sec 12.2 will be '/' + char c = pathSpec.charAt(0); if (c=='/') diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java index 630b35a8b9e..eb3e830f816 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java @@ -36,6 +36,7 @@ public class PathMapTest extends TestCase p.put("*.gz", "7"); p.put("/", "8"); p.put("/XXX:/YYY", "9"); + p.put("", "10"); String[][] tests = { { "/abs/path", "1"}, @@ -68,7 +69,7 @@ public class PathMapTest extends TestCase assertEquals("Dir matches", "[/animal/fish/*=4, /animal/*=5, /=8]", p.getMatches("/animal/fish/").toString()); assertEquals("Dir matches", "[/animal/fish/*=4, /animal/*=5, /=8]", p.getMatches("/animal/fish").toString()); assertEquals("Dir matches", "[/=8]", p.getMatches("/").toString()); - assertEquals("Dir matches", "[/=8]", p.getMatches("").toString()); + assertEquals("Dir matches", "[=10, /=8]", p.getMatches("").toString()); assertEquals("pathMatch exact", "/Foo/bar", PathMap.pathMatch("/Foo/bar", "/Foo/bar")); assertEquals("pathMatch prefix", "/Foo", PathMap.pathMatch("/Foo/*", "/Foo/bar")); @@ -125,6 +126,8 @@ public class PathMapTest extends TestCase assertTrue("!match /foo/*", !PathMap.match("/foo/*", "/bar/anything")); assertTrue("match *.foo", PathMap.match("*.foo", "anything.foo")); assertTrue("!match *.foo", !PathMap.match("*.foo", "anything.bar")); + + assertEquals("match / with ''", "10", p.getMatch("/").getValue()); } /** diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java index 500e9074998..39acebbab12 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java @@ -374,8 +374,8 @@ public class ServletHandler extends ScopedHandler String servlet_path_spec=(String)entry.getKey(); String servlet_path=entry.getMapped()!=null?entry.getMapped():PathMap.pathMatch(servlet_path_spec,target); - String path_info=PathMap.pathInfo(servlet_path_spec,target); - + String path_info=PathMap.pathInfo(servlet_path_spec,target); + if (DispatcherType.INCLUDE.equals(type)) { baseRequest.setAttribute(Dispatcher.INCLUDE_SERVLET_PATH,servlet_path); @@ -393,7 +393,7 @@ public class ServletHandler extends ScopedHandler // look for a servlet by name! servlet_holder=(ServletHolder)_servletNameMap.get(target); } - + if (LOG.isDebugEnabled()) LOG.debug("servlet {}|{}|{} -> {}",baseRequest.getContextPath(),baseRequest.getServletPath(),baseRequest.getPathInfo(),servlet_holder); From de418bc0e4140519ba8e425ca17174409cdd4691 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 12 Jan 2012 12:25:44 +1100 Subject: [PATCH 81/92] 368240: updated mbean container to use managed aggregate semantics --- .../eclipse/jetty/embedded/LikeJettyXml.java | 4 ++-- .../jetty/embedded/ManyServletContexts.java | 6 +++--- jetty-jmx/src/main/config/etc/jetty-jmx.xml | 17 ++++++----------- .../org/eclipse/jetty/jmx/MBeanContainer.java | 9 --------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java index 778c9b0b234..914aea63a74 100644 --- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java +++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java @@ -50,10 +50,10 @@ public class LikeJettyXml // Setup JMX MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); + mbContainer.start(); server.getContainer().addEventListener(mbContainer); - server.addBean(mbContainer); + server.addBean(mbContainer,true); mbContainer.addBean(Log.getRootLogger()); - // Setup Threadpool QueuedThreadPool threadPool = new QueuedThreadPool(); diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyServletContexts.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyServletContexts.java index a893c21a34b..8b6491b4d93 100644 --- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyServletContexts.java +++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyServletContexts.java @@ -33,10 +33,10 @@ public class ManyServletContexts // Setup JMX MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); + mbContainer.start(); server.getContainer().addEventListener(mbContainer); - server.addBean(mbContainer); - mbContainer.addBean(Log.getLog()); - + server.addBean(mbContainer,true); + ContextHandlerCollection contexts = new ContextHandlerCollection(); server.setHandler(contexts); diff --git a/jetty-jmx/src/main/config/etc/jetty-jmx.xml b/jetty-jmx/src/main/config/etc/jetty-jmx.xml index b8c38a201d6..7712cc512ee 100644 --- a/jetty-jmx/src/main/config/etc/jetty-jmx.xml +++ b/jetty-jmx/src/main/config/etc/jetty-jmx.xml @@ -30,26 +30,21 @@ - - - + + - - - + - - + - - - + + true diff --git a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java index d784442d9f4..395791ea6dd 100644 --- a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java +++ b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java @@ -86,15 +86,6 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste public MBeanContainer(MBeanServer server) { _server = server; - - try - { - start(); - } - catch (Exception e) - { - LOG.ignore(e); - } } /** From 08f4b79a666c2d28793f3b6ed96a4d082a462cdf Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Wed, 11 Jan 2012 14:39:37 +0100 Subject: [PATCH 82/92] 365302: LogMBean added Signed-off-by: Greg Wilkins --- .../java/org/eclipse/jetty/util/log/Log.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java index c1f42baa85e..f6ce23a42eb 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java @@ -20,6 +20,8 @@ import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; import org.eclipse.jetty.util.IO; @@ -59,6 +61,8 @@ public class Log */ public static boolean __ignored; + public static Map __loggers = new HashMap(); + static { /* Instantiate a default configuration properties (empty) @@ -418,6 +422,26 @@ public class Log if (!initialized()) return null; - return name == null ? LOG : LOG.getLogger(name); + if(name==null) + return LOG; + + Logger logger = __loggers.get(name); + if(logger==null) + { + logger = LOG.getLogger(name); + __loggers.put(name,logger); + } + + return logger; + } + + /** + * Get a map of all configured {@link Logger} instances. + * + * @return a map of all configured {@link Logger} instances + */ + public static Map getLoggers() + { + return __loggers; } } From 3792452c0d31a620a8d3005454a8ad0b1f14cc8c Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 12 Jan 2012 16:41:54 +1100 Subject: [PATCH 83/92] Add exception cause to NamingException --- .../org/eclipse/jetty/jndi/local/localContextRoot.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/local/localContextRoot.java b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/local/localContextRoot.java index a915ad1917d..49c1d57b584 100644 --- a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/local/localContextRoot.java +++ b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/local/localContextRoot.java @@ -457,10 +457,12 @@ public class localContextRoot implements Context { throw e; } - catch (Exception e) + catch (final Exception e) { - __log.warn("",e); - throw new NamingException (e.getMessage()); + throw new NamingException (e.getMessage()) + { + { initCause(e);} + }; } } else From 564cf7329c28f6f4e3293b12643083727f8d7aa4 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 12 Jan 2012 20:39:24 +1100 Subject: [PATCH 84/92] 365302: made map of loggers concurrent and shared in abstract --- .../jmx/DeploymentManager-mbean.properties | 4 +- jetty-jmx/src/main/config/etc/jetty-jmx.xml | 3 +- .../eclipse/jetty/util/log/jmx/LogMBean.java | 48 +++++++++ .../jetty/util/log/jmx/Log-mbean.properties | 8 ++ .../util/log/jmx/Logger-mbean.properties | 3 - .../jmx/ThreadMonitor-mbean.properties | 1 - .../jetty/servlet/jmx/Holder-mbean.properties | 1 - .../jetty/util/log/AbstractLogger.java | 59 +++++++++++ .../eclipse/jetty/util/log/JavaUtilLog.java | 9 +- .../java/org/eclipse/jetty/util/log/Log.java | 20 +++- .../org/eclipse/jetty/util/log/LoggerLog.java | 9 +- .../org/eclipse/jetty/util/log/Slf4jLog.java | 9 +- .../org/eclipse/jetty/util/log/StdErrLog.java | 98 ++++--------------- .../org/eclipse/jetty/util/log/LogTest.java | 8 ++ .../eclipse/jetty/util/log/NamedLogTest.java | 19 +--- .../eclipse/jetty/util/log/StdErrCapture.java | 6 ++ 16 files changed, 185 insertions(+), 120 deletions(-) create mode 100644 jetty-jmx/src/main/java/org/eclipse/jetty/util/log/jmx/LogMBean.java create mode 100644 jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Log-mbean.properties delete mode 100644 jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Logger-mbean.properties create mode 100644 jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java diff --git a/jetty-deploy/src/main/resources/org/eclipse/jetty/deploy/jmx/DeploymentManager-mbean.properties b/jetty-deploy/src/main/resources/org/eclipse/jetty/deploy/jmx/DeploymentManager-mbean.properties index 4149820d535..f640c90a57c 100644 --- a/jetty-deploy/src/main/resources/org/eclipse/jetty/deploy/jmx/DeploymentManager-mbean.properties +++ b/jetty-deploy/src/main/resources/org/eclipse/jetty/deploy/jmx/DeploymentManager-mbean.properties @@ -5,6 +5,6 @@ contexts:MMBean: Deployed Contexts appProviders:MMBean: Application Providers getApps(java.lang.String):MBean:ACTION: List apps that are located at specified App LifeCycle node getApps(java.lang.String)[0]:nodeName: Name of the App LifeCycle node -requestAppGoal(java.lang.String,java.lang.String) ACTION: Request the app to be moved to the specified App LifeCycle node +requestAppGoal(java.lang.String,java.lang.String):ACTION: Request the app to be moved to the specified App LifeCycle node requestAppGoal(java.lang.String,java.lang.String)[0]:appId:App identifier -requestAppGoal(java.lang.String,java.lang.String)[1]:nodeName:Name of the App LifeCycle node \ No newline at end of file +requestAppGoal(java.lang.String,java.lang.String)[1]:nodeName:Name of the App LifeCycle node diff --git a/jetty-jmx/src/main/config/etc/jetty-jmx.xml b/jetty-jmx/src/main/config/etc/jetty-jmx.xml index 7712cc512ee..a685eded058 100644 --- a/jetty-jmx/src/main/config/etc/jetty-jmx.xml +++ b/jetty-jmx/src/main/config/etc/jetty-jmx.xml @@ -48,11 +48,10 @@ - - + diff --git a/jetty-jmx/src/main/java/org/eclipse/jetty/util/log/jmx/LogMBean.java b/jetty-jmx/src/main/java/org/eclipse/jetty/util/log/jmx/LogMBean.java new file mode 100644 index 00000000000..b5fa44b9c8e --- /dev/null +++ b/jetty-jmx/src/main/java/org/eclipse/jetty/util/log/jmx/LogMBean.java @@ -0,0 +1,48 @@ +// ======================================================================== +// Copyright (c) 2009-2009 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.util.log.jmx; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jetty.jmx.ObjectMBean; +import org.eclipse.jetty.util.log.Log; + +/* ------------------------------------------------------------ */ +/** + */ +public class LogMBean extends ObjectMBean +{ + + public LogMBean(Object managedObject) + { + super(managedObject); + } + + public List getLoggers() + { + List keySet = new ArrayList(Log.getLoggers().keySet()); + return keySet; + } + + public boolean isDebugEnabled(String logger) + { + return Log.getLogger(logger).isDebugEnabled(); + } + + public void setDebugEnabled(String logger, Boolean enabled) + { + Log.getLogger(logger).setDebugEnabled(enabled); + } +} diff --git a/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Log-mbean.properties b/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Log-mbean.properties new file mode 100644 index 00000000000..18abcb11fff --- /dev/null +++ b/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Log-mbean.properties @@ -0,0 +1,8 @@ +Log: Jetty Logging implementaton +loggers:MBean: List of all instantiated loggers +debugEnabled:RW: True if debug enabled for root logger Log.LOG +isDebugEnabled(java.lang.String):MBean:INFO: True if debug is enabled for the given logger +isDebugEnabled(java.lang.String)[0]:loggerName: Name of the logger to return isDebugEnabled for +setDebugEnabled(java.lang.String,java.lang.Boolean):MBean:ACTION: Set debug enabled for the given logger +setDebugEnabled(java.lang.String,java.lang.Boolean)[0]:loggerName: Name of the logger to set debug enabled +setDebugEnabled(java.lang.String,java.lang.Boolean)[1]:enabled: true to enable debug, false otherwise diff --git a/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Logger-mbean.properties b/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Logger-mbean.properties deleted file mode 100644 index 416e992e5f3..00000000000 --- a/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Logger-mbean.properties +++ /dev/null @@ -1,3 +0,0 @@ -Logger: Jetty Logging implementaton -debugEnabled: True if debug enabled -name: Logger name diff --git a/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/jmx/ThreadMonitor-mbean.properties b/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/jmx/ThreadMonitor-mbean.properties index 4bdb8981735..c6f5a04f2c1 100644 --- a/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/jmx/ThreadMonitor-mbean.properties +++ b/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/jmx/ThreadMonitor-mbean.properties @@ -1,2 +1 @@ ThreadMonitor: Detect and report spinning and deadlocked threads - diff --git a/jetty-servlet/src/main/resources/org/eclipse/jetty/servlet/jmx/Holder-mbean.properties b/jetty-servlet/src/main/resources/org/eclipse/jetty/servlet/jmx/Holder-mbean.properties index e45e145b391..7730ff40733 100644 --- a/jetty-servlet/src/main/resources/org/eclipse/jetty/servlet/jmx/Holder-mbean.properties +++ b/jetty-servlet/src/main/resources/org/eclipse/jetty/servlet/jmx/Holder-mbean.properties @@ -3,4 +3,3 @@ name: RO:Name displayName: RO:Display Name className: RO:Class Name initParameters: RO:Initial parameters - diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java new file mode 100644 index 00000000000..1320a9fc426 --- /dev/null +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java @@ -0,0 +1,59 @@ +package org.eclipse.jetty.util.log; + + +/* ------------------------------------------------------------ */ +/** Abstract Logger. + * Manages the atomic registration of the logger by name. + */ +public abstract class AbstractLogger implements Logger +{ + public final Logger getLogger(String name) + { + if (isBlank(name)) + return this; + + final String basename = getName(); + final String fullname = (isBlank(basename) || Log.getRootLogger()==this)?name:(basename + "." + name); + + Logger logger = Log.getLoggers().get(fullname); + if (logger == null) + { + Logger newlog = newLogger(fullname); + + logger = Log.getMutableLoggers().putIfAbsent(fullname,newlog); + if (logger == null) + logger=newlog; + } + + return logger; + } + + + protected abstract Logger newLogger(String fullname); + + /** + * A more robust form of name blank test. Will return true for null names, and names that have only whitespace + * + * @param name + * the name to test + * @return true for null or blank name, false if any non-whitespace character is found. + */ + private static boolean isBlank(String name) + { + if (name == null) + { + return true; + } + int size = name.length(); + char c; + for (int i = 0; i < size; i++) + { + c = name.charAt(i); + if (!Character.isWhitespace(c)) + { + return false; + } + } + return true; + } +} diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java index 789bbf77511..dd8995caa40 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java @@ -28,7 +28,7 @@ import java.util.logging.Level; * standard java.util.logging configuration. *

      */ -public class JavaUtilLog implements Logger +public class JavaUtilLog extends AbstractLogger { private Level configuredLevel; private java.util.logging.Logger _logger; @@ -116,9 +116,12 @@ public class JavaUtilLog implements Logger _logger.log(Level.FINE, msg, thrown); } - public Logger getLogger(String name) + /** + * Create a Child Logger of this Logger. + */ + protected Logger newLogger(String fullname) { - return new JavaUtilLog(name); + return new JavaUtilLog(fullname); } public void ignore(Throwable ignored) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java index f6ce23a42eb..30c6bb8d30a 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java @@ -19,10 +19,14 @@ import java.lang.reflect.Method; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.Collection; +import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.Loader; @@ -61,7 +65,11 @@ public class Log */ public static boolean __ignored; - public static Map __loggers = new HashMap(); + /** + * Hold loggers only. + */ + private final static ConcurrentMap __loggers = new ConcurrentHashMap(); + static { @@ -427,14 +435,16 @@ public class Log Logger logger = __loggers.get(name); if(logger==null) - { logger = LOG.getLogger(name); - __loggers.put(name,logger); - } return logger; } + static ConcurrentMap getMutableLoggers() + { + return __loggers; + } + /** * Get a map of all configured {@link Logger} instances. * @@ -442,6 +452,6 @@ public class Log */ public static Map getLoggers() { - return __loggers; + return Collections.unmodifiableMap(__loggers); } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/LoggerLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/LoggerLog.java index 3c2dc5f2826..24eb5597680 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/LoggerLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/LoggerLog.java @@ -18,7 +18,7 @@ import java.lang.reflect.Method; /** * */ -public class LoggerLog implements Logger +public class LoggerLog extends AbstractLogger { private final Object _logger; private final Method _debugMT; @@ -189,11 +189,14 @@ public class LoggerLog implements Logger } } - public Logger getLogger(String name) + /** + * Create a Child Logger of this Logger. + */ + protected Logger newLogger(String fullname) { try { - Object logger=_getLoggerN.invoke(_logger, name); + Object logger=_getLoggerN.invoke(_logger, fullname); return new LoggerLog(logger); } catch (Exception e) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Slf4jLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Slf4jLog.java index 2b8e268d1a4..2dca95127f2 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Slf4jLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Slf4jLog.java @@ -18,7 +18,7 @@ package org.eclipse.jetty.util.log; /** * Slf4jLog Logger */ -public class Slf4jLog implements Logger +public class Slf4jLog extends AbstractLogger { private final org.slf4j.Logger _logger; @@ -114,9 +114,12 @@ public class Slf4jLog implements Logger warn("setDebugEnabled not implemented",null,null); } - public Logger getLogger(String name) + /** + * Create a Child Logger of this Logger. + */ + protected Logger newLogger(String fullname) { - return new Slf4jLog(name); + return new Slf4jLog(fullname); } public void ignore(Throwable ignored) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java index 72192728e0d..c0a2e246ee8 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java @@ -35,7 +35,7 @@ import org.eclipse.jetty.util.DateCache; * used for logging. For named debuggers, the system property name+".LONG" is checked. If it is not not set, then * "org.eclipse.jetty.util.log.LONG" is used as the default. */ -public class StdErrLog implements Logger +public class StdErrLog extends AbstractLogger { private static final String EOL = System.getProperty("line.separator"); private static DateCache _dateCache; @@ -45,11 +45,6 @@ public class StdErrLog implements Logger Log.__props.getProperty("org.eclipse.jetty.util.log.stderr.SOURCE","false"))); private final static boolean __long = Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.stderr.LONG","false")); - /** - * Tracking for child loggers only. - */ - private final static ConcurrentMap __loggers = new ConcurrentHashMap(); - static { String deprecatedProperties[] = @@ -332,28 +327,22 @@ public class StdErrLog implements Logger { if (enabled) { - synchronized (__loggers) - { - this._level = LEVEL_DEBUG; + this._level = LEVEL_DEBUG; - // Boot stomp all cached log levels to DEBUG - for(StdErrLog log: __loggers.values()) - { - log._level = LEVEL_DEBUG; - } + for (Logger log : Log.getLoggers().values()) + { + if (log instanceof StdErrLog) + ((StdErrLog)log).setLevel(LEVEL_DEBUG); } } else { - synchronized (__loggers) + this._level = this._configuredLevel; + + for (Logger log : Log.getLoggers().values()) { - this._level = this._configuredLevel; - - // restore all cached log configured levels - for(StdErrLog log: __loggers.values()) - { - log._level = log._configuredLevel; - } + if (log instanceof StdErrLog) + ((StdErrLog)log).setLevel(((StdErrLog)log)._configuredLevel); } } } @@ -570,67 +559,18 @@ public class StdErrLog implements Logger } } - /** - * A more robust form of name blank test. Will return true for null names, and names that have only whitespace - * - * @param name - * the name to test - * @return true for null or blank name, false if any non-whitespace character is found. - */ - private static boolean isBlank(String name) - { - if (name == null) - { - return true; - } - int size = name.length(); - char c; - for (int i = 0; i < size; i++) - { - c = name.charAt(i); - if (!Character.isWhitespace(c)) - { - return false; - } - } - return true; - } /** - * Get a Child Logger relative to this Logger. - * - * @param name - * the child name - * @return the appropriate child logger (if name specified results in a new unique child) + * Create a Child Logger of this Logger. */ - public Logger getLogger(String name) + protected Logger newLogger(String fullname) { - if (isBlank(name)) - { - return this; - } - - String fullname = name; - if (!isBlank(_name)) - { - fullname = _name + "." + name; - } - - StdErrLog logger = __loggers.get(fullname); - if (logger == null) - { - StdErrLog sel = new StdErrLog(fullname); - // Preserve configuration for new loggers configuration - sel.setPrintLongNames(_printLongNames); - // Let Level come from configured Properties instead - sel.setLevel(_level); - sel.setSource(_source); - sel._stderr = this._stderr; - logger = __loggers.putIfAbsent(fullname,sel); - if (logger == null) - { - logger = sel; - } - } + StdErrLog logger = new StdErrLog(fullname); + // Preserve configuration for new loggers configuration + logger.setPrintLongNames(_printLongNames); + // Let Level come from configured Properties instead - sel.setLevel(_level); + logger.setSource(_source); + logger._stderr = this._stderr; return logger; } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/LogTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/LogTest.java index e5322ca63b9..d371a13a453 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/LogTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/LogTest.java @@ -15,6 +15,9 @@ package org.eclipse.jetty.util.log; import static org.hamcrest.Matchers.is; +import java.util.HashMap; +import java.util.Map; + import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -23,18 +26,23 @@ import org.junit.Test; public class LogTest { private static Logger originalLogger; + private static Map originalLoggers; @SuppressWarnings("deprecation") @BeforeClass public static void rememberOriginalLogger() { originalLogger = Log.getLog(); + originalLoggers = new HashMap(Log.getLoggers()); + Log.getMutableLoggers().clear(); } @AfterClass public static void restoreOriginalLogger() { Log.setLog(originalLogger); + Log.getMutableLoggers().clear(); + Log.getMutableLoggers().putAll(originalLoggers); } @Test diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/NamedLogTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/NamedLogTest.java index dc1a86e84a1..4377d5feaf5 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/NamedLogTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/NamedLogTest.java @@ -1,26 +1,9 @@ package org.eclipse.jetty.util.log; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; public class NamedLogTest { - private static Logger originalLogger; - - @SuppressWarnings("deprecation") - @BeforeClass - public static void rememberOriginalLogger() - { - originalLogger = Log.getLog(); - } - - @AfterClass - public static void restoreOriginalLogger() - { - Log.setLog(originalLogger); - } - @Test public void testNamedLogging() { @@ -37,7 +20,7 @@ public class NamedLogTest red.generateLogs(); green.generateLogs(); blue.generateLogs(); - + output.assertContains(Red.class.getName()); output.assertContains(Green.class.getName()); output.assertContains(Blue.class.getName()); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrCapture.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrCapture.java index b9b536db806..cd55fc125a9 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrCapture.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrCapture.java @@ -43,4 +43,10 @@ public class StdErrCapture String output = new String(test.toByteArray()); Assert.assertThat(output,not(containsString(unexpectedString))); } + + public String toString() + { + err.flush(); + return new String(test.toByteArray()); + } } From bf00fbcf3b33cf14e9b92d5143dda1380e6576f6 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 12 Jan 2012 15:05:38 -0600 Subject: [PATCH 85/92] nop change --- README.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/README.txt b/README.txt index 28a387764c3..0bb3c75dfe5 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,3 @@ - This is a source checkout of the Jetty webserver. To build, use: From d79b023d4bca942aefbadca384080c4663059c6b Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 12 Jan 2012 15:21:46 -0600 Subject: [PATCH 86/92] add some text --- README.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.txt b/README.txt index 0bb3c75dfe5..3412f8ff169 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,4 @@ + This is a source checkout of the Jetty webserver. To build, use: @@ -14,3 +15,5 @@ dependencies. The tests do a lot of stress testing, and on some machines it is necessary to set the file descriptor limit to greater than 2048 for the tests to all pass successfully. + +Bypass tests by building with -Dmaven.test.skip=true but note that this will not produce some test jars that are leveraged in other places in the build. From cd1e2ba88b53fc7fab8e860b6876e22ac4d2b057 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 13 Jan 2012 08:58:38 +1100 Subject: [PATCH 87/92] 368113 Support servlet mapping to "" --- .../java/org/eclipse/jetty/server/handler/IPAccessHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/IPAccessHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/IPAccessHandler.java index 4e6e50b52c6..cf3e48ec1d1 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/IPAccessHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/IPAccessHandler.java @@ -237,7 +237,7 @@ public class IPAccessHandler extends HandlerWrapper pathMap = new PathMap(true); patternMap.put(addr,pathMap); } - if (path != null) + if (path != null && !"".equals(path)) pathMap.put(path,path); if (deprecated) From 04d703c062a23c953ef3e20931854cd0d5be778c Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 13 Jan 2012 13:59:49 +1100 Subject: [PATCH 88/92] 365302: clean up old Logger mbeans --- .../src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java | 2 +- .../src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java | 1 + .../org/eclipse/jetty/util/log/jmx/Slf4jLog-mbean.properties | 1 - .../org/eclipse/jetty/util/log/jmx/StdErrLog-mbean.properties | 1 - .../src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java | 3 +-- test-jetty-webapp/src/main/webapp/WEB-INF/web.xml | 2 +- 6 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Slf4jLog-mbean.properties delete mode 100644 jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/StdErrLog-mbean.properties diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java index 914aea63a74..16bf6fcd8fa 100644 --- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java +++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java @@ -53,7 +53,7 @@ public class LikeJettyXml mbContainer.start(); server.getContainer().addEventListener(mbContainer); server.addBean(mbContainer,true); - mbContainer.addBean(Log.getRootLogger()); + mbContainer.addBean(new Log()); // Setup Threadpool QueuedThreadPool threadPool = new QueuedThreadPool(); diff --git a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java index 395791ea6dd..475a2da3a73 100644 --- a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java +++ b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java @@ -34,6 +34,7 @@ import org.eclipse.jetty.util.component.Container.Relationship; import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.util.thread.ShutdownThread; /** diff --git a/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Slf4jLog-mbean.properties b/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Slf4jLog-mbean.properties deleted file mode 100644 index 58b10abec32..00000000000 --- a/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/Slf4jLog-mbean.properties +++ /dev/null @@ -1 +0,0 @@ -Slf4jLog: SL4J log adapter diff --git a/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/StdErrLog-mbean.properties b/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/StdErrLog-mbean.properties deleted file mode 100644 index 16e56bb70be..00000000000 --- a/jetty-jmx/src/main/resources/org/eclipse/jetty/util/log/jmx/StdErrLog-mbean.properties +++ /dev/null @@ -1 +0,0 @@ -StdErrLog: Log adapter that logs to stderr \ No newline at end of file diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java index 48bfcf391c0..2b7ee1252ff 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java @@ -62,7 +62,7 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; *

      * This servlet needs the jetty-util and jetty-client classes to be available to the web application. *

      - * To facilitate JMX monitoring, the "HttpClient", it's "ThreadPool" and the "Logger" are set as context attributes prefixed with the servlet name. + * To facilitate JMX monitoring, the "HttpClient" and "ThreadPool" are set as context attributes prefixed with the servlet name. *

      * The following init parameters may be used to configure the servlet: *

        @@ -127,7 +127,6 @@ public class ProxyServlet implements Servlet if (_context != null) { - _context.setAttribute(config.getServletName() + ".Logger",_log); _context.setAttribute(config.getServletName() + ".ThreadPool",_client.getThreadPool()); _context.setAttribute(config.getServletName() + ".HttpClient",_client); } diff --git a/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml b/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml index c08ca7fdbd9..0c633bd7655 100644 --- a/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml +++ b/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml @@ -9,7 +9,7 @@ org.eclipse.jetty.server.context.ManagedAttributes - QoSFilter,TransparentProxy.Logger,TransparentProxy.ThreadPool,TransparentProxy.HttpClient + QoSFilter,TransparentProxy.ThreadPool,TransparentProxy.HttpClient From cf30b19f7ee88bc0c929fdc96ba43668a56c2aaa Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 13 Jan 2012 11:03:03 +0100 Subject: [PATCH 89/92] Added one more SSL bytes tests that send RST while the server is read blocked. --- .../jetty/client/SslBytesServerTest.java | 90 ++++++++++++++++--- 1 file changed, 78 insertions(+), 12 deletions(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java index b417ce0cc22..618639ee058 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java @@ -1,6 +1,7 @@ package org.eclipse.jetty.client; import java.io.BufferedReader; +import java.io.EOFException; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; @@ -34,6 +35,7 @@ import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.nio.AsyncConnection; import org.eclipse.jetty.io.nio.SslConnection; +import org.eclipse.jetty.server.AsyncHttpConnection; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; @@ -102,7 +104,7 @@ public class SslBytesServerTest extends SslBytesTest @Override protected AsyncConnection newPlainConnection(SocketChannel channel, AsyncEndPoint endPoint) { - return new org.eclipse.jetty.server.AsyncHttpConnection(this, endPoint, getServer()) + return new AsyncHttpConnection(this, endPoint, getServer()) { @Override protected HttpParser newHttpParser(Buffers requestBuffers, EndPoint endPoint, HttpParser.EventHandler requestHandler) @@ -135,21 +137,32 @@ public class SslBytesServerTest extends SslBytesTest { public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException, ServletException { - request.setHandled(true); - String contentLength = request.getHeader("Content-Length"); - if (contentLength != null) + try { - int length = Integer.parseInt(contentLength); - ServletInputStream input = httpRequest.getInputStream(); - ServletOutputStream output = httpResponse.getOutputStream(); - byte[] buffer = new byte[32 * 1024]; - for (int i = 0; i < length; ++i) + request.setHandled(true); + String contentLength = request.getHeader("Content-Length"); + if (contentLength != null) { - int read = input.read(buffer); - if ("/echo".equals(target)) - output.write(buffer, 0, read); + int length = Integer.parseInt(contentLength); + ServletInputStream input = httpRequest.getInputStream(); + ServletOutputStream output = httpResponse.getOutputStream(); + byte[] buffer = new byte[32 * 1024]; + while (length > 0) + { + int read = input.read(buffer); + if (read < 0) + throw new EOFException(); + length -= read; + if (target.startsWith("/echo")) + output.write(buffer, 0, read); + } } } + catch (IOException x) + { + if (!(target.endsWith("suppress_exception"))) + throw x; + } } }); server.start(); @@ -860,6 +873,59 @@ public class SslBytesServerTest extends SslBytesTest // connection, and this will cause an exception in the // server that is trying to write the data + TimeUnit.MILLISECONDS.sleep(500); + proxy.sendRSTToServer(); + + // Wait a while to detect spinning + TimeUnit.MILLISECONDS.sleep(500); + Assert.assertThat(sslHandles.get(), lessThan(20)); + Assert.assertThat(sslFlushes.get(), lessThan(20)); + Assert.assertThat(httpParses.get(), lessThan(50)); + + client.close(); + } + + @Test + public void testRequestWithBigContentReadBlockedThenReset() throws Exception + { + final SSLSocket client = newClient(); + + SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); + client.startHandshake(); + Assert.assertTrue(automaticProxyFlow.stop(5, TimeUnit.SECONDS)); + + byte[] data = new byte[128 * 1024]; + Arrays.fill(data, (byte)'X'); + final String content = new String(data, "UTF-8"); + Future request = threadPool.submit(new Callable() + { + public Object call() throws Exception + { + OutputStream clientOutput = client.getOutputStream(); + clientOutput.write(("" + + "GET /echo_suppress_exception HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Content-Length: " + content.length() + "\r\n" + + "\r\n" + + content).getBytes("UTF-8")); + clientOutput.flush(); + return null; + } + }); + + // Nine TLSRecords will be generated for the request, + // but we write only 5 of them, so the server goes in read blocked state + for (int i = 0; i < 5; ++i) + { + // Application data + TLSRecord record = proxy.readFromClient(); + Assert.assertEquals(TLSRecord.Type.APPLICATION, record.getType()); + proxy.flushToServer(record, 0); + } + Assert.assertNull(request.get(5, TimeUnit.SECONDS)); + + // The server should be read blocked, and we send a RST + TimeUnit.MILLISECONDS.sleep(500); proxy.sendRSTToServer(); // Wait a while to detect spinning From 30dade6b5a8b27ea20a52c268c2dfe738d10900d Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Thu, 12 Jan 2012 17:33:52 +0100 Subject: [PATCH 90/92] 366472: CrossDomainFilter accepts wildcard domains like *.example.com Signed-off-by: Simone Bordet --- .../jetty/servlets/CrossOriginFilter.java | 31 +++++++++--- .../jetty/servlets/CrossOriginFilterTest.java | 47 +++++++++++++++++++ 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java index f4026369372..173be017da6 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java @@ -18,6 +18,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.servlet.Filter; import javax.servlet.FilterChain; @@ -229,19 +231,34 @@ public class CrossOriginFilter implements Filter if (origin.trim().length() == 0) continue; - boolean allowed = false; for (String allowedOrigin : allowedOrigins) { - if (allowedOrigin.equals(origin)) + if (allowedOrigin.contains("*")) { - allowed = true; - break; + Matcher matcher = createMatcher(origin,allowedOrigin); + if (matcher.matches()) + return true; + } + else if (allowedOrigin.equals(origin)) + { + return true; } } - if (!allowed) - return false; } - return true; + return false; + } + + private Matcher createMatcher(String origin, String allowedOrigin) + { + String regex = parseAllowedWildcardOriginToRegex(allowedOrigin); + Pattern pattern = Pattern.compile(regex); + return pattern.matcher(origin); + } + + private String parseAllowedWildcardOriginToRegex(String allowedOrigin) + { + String regex = allowedOrigin.replace(".","\\."); + return regex.replace("*",".*"); // we want to be greedy here to match multiple subdomains, thus we use .* } private boolean isSimpleRequest(HttpServletRequest request) diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java index e59051ffbf0..fb8d6bba490 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java @@ -76,6 +76,52 @@ public class CrossOriginFilterTest Assert.assertTrue(latch.await(1, TimeUnit.SECONDS)); } + @Test + public void testSimpleRequestWithMatchingWildcardOrigin() throws Exception + { + FilterHolder filterHolder = new FilterHolder(new CrossOriginFilter()); + String origin = "http://subdomain.example.com"; + filterHolder.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "http://*.example.com"); + tester.getContext().addFilter(filterHolder, "/*", FilterMapping.DEFAULT); + + CountDownLatch latch = new CountDownLatch(1); + tester.getContext().addServlet(new ServletHolder(new ResourceServlet(latch)), "/*"); + + String request = "" + + "GET / HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Origin: " + origin + "\r\n" + + "\r\n"; + String response = tester.getResponses(request); + Assert.assertTrue(response.contains("HTTP/1.1 200")); + Assert.assertTrue(response.contains(CrossOriginFilter.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER)); + Assert.assertTrue(response.contains(CrossOriginFilter.ACCESS_CONTROL_ALLOW_CREDENTIALS_HEADER)); + Assert.assertTrue(latch.await(1, TimeUnit.SECONDS)); + } + + @Test + public void testSimpleRequestWithMatchingWildcardOriginAndMultipleSubdomains() throws Exception + { + FilterHolder filterHolder = new FilterHolder(new CrossOriginFilter()); + String origin = "http://subdomain.subdomain.example.com"; + filterHolder.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "http://*.example.com"); + tester.getContext().addFilter(filterHolder, "/*", FilterMapping.DEFAULT); + + CountDownLatch latch = new CountDownLatch(1); + tester.getContext().addServlet(new ServletHolder(new ResourceServlet(latch)), "/*"); + + String request = "" + + "GET / HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Origin: " + origin + "\r\n" + + "\r\n"; + String response = tester.getResponses(request); + Assert.assertTrue(response.contains("HTTP/1.1 200")); + Assert.assertTrue(response.contains(CrossOriginFilter.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER)); + Assert.assertTrue(response.contains(CrossOriginFilter.ACCESS_CONTROL_ALLOW_CREDENTIALS_HEADER)); + Assert.assertTrue(latch.await(1, TimeUnit.SECONDS)); + } + @Test public void testSimpleRequestWithMatchingOrigin() throws Exception { @@ -327,6 +373,7 @@ public class CrossOriginFilterTest public static class ResourceServlet extends HttpServlet { + private static final long serialVersionUID = 1L; private final CountDownLatch latch; public ResourceServlet(CountDownLatch latch) From c0d3266c59d12a1cc5c45715c233afd8f3a8a433 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 13 Jan 2012 13:23:44 +0100 Subject: [PATCH 91/92] 366472: Javadocs. --- .../org/eclipse/jetty/servlets/CrossOriginFilter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java index 173be017da6..67c6e7c5fbd 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java @@ -20,7 +20,6 @@ import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; - import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; @@ -44,7 +43,14 @@ import org.eclipse.jetty.util.log.Logger; *
          *
        • allowedOrigins, a comma separated list of origins that are * allowed to access the resources. Default value is *, meaning all - * origins
        • + * origins.
          + * If an allowed origin contains one or more * characters (for example + * http://*.domain.com), then "*" characters are converted to ".*", "." + * characters are escaped to "\." and the resulting allowed origin + * interpreted as a regular expression.
          + * Allowed origins can therefore be more complex expressions such as + * https?://*.domain.[a-z]{3} that matches http or https, multiple subdomains + * and any 3 letter top-level domain (.com, .net, .org, etc.). *
        • allowedMethods, a comma separated list of HTTP methods that * are allowed to be used when accessing the resources. Default value is * GET,POST
        • From c8870cfabbef5fecbb3f009ef1b7d152a9c96ffc Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Fri, 13 Jan 2012 09:03:52 -0600 Subject: [PATCH 92/92] 366472: address test difference for jetty-8 related to cross origin filter test --- .../org/eclipse/jetty/servlets/CrossOriginFilterTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java index e6c15d11b58..ff78a629ff0 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java @@ -85,7 +85,7 @@ public class CrossOriginFilterTest FilterHolder filterHolder = new FilterHolder(new CrossOriginFilter()); String origin = "http://subdomain.example.com"; filterHolder.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "http://*.example.com"); - tester.getContext().addFilter(filterHolder, "/*", FilterMapping.DEFAULT); + tester.getContext().addFilter(filterHolder, "/*", EnumSet.of(DispatcherType.REQUEST)); CountDownLatch latch = new CountDownLatch(1); tester.getContext().addServlet(new ServletHolder(new ResourceServlet(latch)), "/*"); @@ -108,7 +108,7 @@ public class CrossOriginFilterTest FilterHolder filterHolder = new FilterHolder(new CrossOriginFilter()); String origin = "http://subdomain.subdomain.example.com"; filterHolder.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "http://*.example.com"); - tester.getContext().addFilter(filterHolder, "/*", FilterMapping.DEFAULT); + tester.getContext().addFilter(filterHolder, "/*", EnumSet.of(DispatcherType.REQUEST)); CountDownLatch latch = new CountDownLatch(1); tester.getContext().addServlet(new ServletHolder(new ResourceServlet(latch)), "/*");