Skip to content

Commit

Permalink
Bump jetty to latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Feb 18, 2017
1 parent 51f108a commit fdc62fd
Show file tree
Hide file tree
Showing 21 changed files with 45 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,15 @@
import org.seleniumhq.jetty9.server.handler.ResourceHandler;
import org.seleniumhq.jetty9.servlet.ServletContextHandler;
import org.seleniumhq.jetty9.servlet.ServletHolder;
import org.seleniumhq.jetty9.util.resource.Resource;
import org.seleniumhq.jetty9.util.ssl.SslContextFactory;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.EnumSet;

import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class JettyAppServer implements AppServer {

Expand Down Expand Up @@ -259,20 +255,10 @@ public void addFilter(
context.addFilter(filter, path, EnumSet.of(dispatches));
}

private static class ResourceHandler2 extends ResourceHandler {
@Override
protected void doDirectory(HttpServletRequest request, HttpServletResponse response, Resource resource) throws IOException {
String listing = resource.getListHTML(request.getRequestURI(), request.getPathInfo() != null && request.getPathInfo().lastIndexOf("/") > 0);
response.setContentType("text/html; charset=UTF-8");
response.getWriter().println(listing);
}

}

protected ServletContextHandler addResourceHandler(String contextPath, Path resourceBase) {
ServletContextHandler context = new ServletContextHandler();

ResourceHandler staticResource = new ResourceHandler2();
ResourceHandler staticResource = new ResourceHandler();
staticResource.setDirectoriesListed(true);
staticResource.setWelcomeFiles(new String[] { "index.html" });
staticResource.setResourceBase(resourceBase.toAbsolutePath().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.openqa.selenium.remote.server.DefaultDriverSessions;
import org.openqa.selenium.remote.server.DriverServlet;
import org.seleniumhq.jetty9.security.AbstractLoginService;
import org.seleniumhq.jetty9.security.ConstraintMapping;
import org.seleniumhq.jetty9.security.ConstraintSecurityHandler;
import org.seleniumhq.jetty9.security.HashLoginService;
Expand All @@ -32,6 +33,10 @@
import org.seleniumhq.jetty9.util.security.Constraint;
import org.seleniumhq.jetty9.util.security.Password;

import java.security.Principal;

import javax.security.auth.Subject;


public class AuthenticatedWebDriverServer {

Expand All @@ -55,9 +60,9 @@ public static void main(String[] args) throws Exception {
securityHandler.addConstraintMapping(constraintMapping);

HashLoginService loginService = new HashLoginService();
loginService.putUser("fluffy", new Password("bunny"), new String[] {
"user"
});
Principal principal = new AbstractLoginService.UserPrincipal("fluffy", new Password("bunny"));
Subject subject = new Subject();
loginService.getIdentityService().newUserIdentity(subject, principal, new String[]{ "user" });
securityHandler.setLoginService(loginService);
securityHandler.setAuthenticator(new BasicAuthenticator());

Expand Down
70 changes: 36 additions & 34 deletions third_party/java/jetty/BUCK
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
JETTY_VERSION = '9.4.1.v20170120'

java_library(
name = 'jetty',
maven_coords = 'org.seleniumhq.selenium:jetty-repacked:9.2.13.v20160825',
maven_coords = 'org.seleniumhq.selenium:jetty-repacked:%s' % JETTY_VERSION,
maven_pom_template = 'jetty.pom',
exported_deps = [
':repackage',
Expand Down Expand Up @@ -68,7 +70,7 @@ for i in REPACK:

prebuilt_jar(
name = out,
maven_coords = 'org.seleniumhq.selenium:%s:9.2.13.v20150730' % out,
maven_coords = 'org.seleniumhq.selenium:%s:%s' % (out, JETTY_VERSION),
binary_jar = ':%s' % name,
deps = [ '//third_party/java/servlet:servlet-api', ],
)
Expand All @@ -78,66 +80,67 @@ export_file(
src = 'jetty-repack-rules',
)


prebuilt_jar(
name = 'jetty-continuation',
maven_coords = 'org.eclipse.jetty:jetty-continuation:jar:9.2.13.v20150730',
binary_jar = 'jetty-continuation-9.2.13.v20150730.jar',
source_jar = 'jetty-continuation-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-continuation:jar:9.4.1.v20170120',
binary_jar = 'jetty-continuation-9.4.1.v20170120.jar',
source_jar = 'jetty-continuation-9.4.1.v20170120-sources.jar',
deps = [
'//third_party/java/servlet:servlet-api'
],
)

prebuilt_jar(
name = 'jetty-http',
maven_coords = 'org.eclipse.jetty:jetty-http:jar:9.2.13.v20150730',
binary_jar = 'jetty-http-9.2.13.v20150730.jar',
source_jar = 'jetty-http-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-http:jar:9.4.1.v20170120',
binary_jar = 'jetty-http-9.4.1.v20170120.jar',
source_jar = 'jetty-http-9.4.1.v20170120-sources.jar',
deps = [
':jetty-util',
'//third_party/java/servlet:servlet-api',
':jetty-io',
':jetty-util'
],
)

prebuilt_jar(
name = 'jetty-io',
maven_coords = 'org.eclipse.jetty:jetty-io:jar:9.2.13.v20150730',
binary_jar = 'jetty-io-9.2.13.v20150730.jar',
source_jar = 'jetty-io-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-io:jar:9.4.1.v20170120',
binary_jar = 'jetty-io-9.4.1.v20170120.jar',
source_jar = 'jetty-io-9.4.1.v20170120-sources.jar',
deps = [
':jetty-util'
],
visibility = [
'//third_party/java/websocket:websocket-client',
'//third_party/java/websocket:websocket-common'
'//third_party/java/websocket:websocket-common',
],
)

prebuilt_jar(
name = 'jetty-jmx',
maven_coords = 'org.eclipse.jetty:jetty-jmx:jar:9.2.13.v20150730',
binary_jar = 'jetty-jmx-9.2.13.v20150730.jar',
source_jar = 'jetty-jmx-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-jmx:jar:9.4.1.v20170120',
binary_jar = 'jetty-jmx-9.4.1.v20170120.jar',
source_jar = 'jetty-jmx-9.4.1.v20170120-sources.jar',
deps = [
':jetty-util'
],
)

prebuilt_jar(
name = 'jetty-security',
maven_coords = 'org.eclipse.jetty:jetty-security:jar:9.2.13.v20150730',
binary_jar = 'jetty-security-9.2.13.v20150730.jar',
source_jar = 'jetty-security-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-security:jar:9.4.1.v20170120',
binary_jar = 'jetty-security-9.4.1.v20170120.jar',
source_jar = 'jetty-security-9.4.1.v20170120-sources.jar',
deps = [
':jetty-server'
],
)

prebuilt_jar(
name = 'jetty-server',
maven_coords = 'org.eclipse.jetty:jetty-server:jar:9.2.13.v20150730',
binary_jar = 'jetty-server-9.2.13.v20150730.jar',
source_jar = 'jetty-server-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-server:jar:9.4.1.v20170120',
binary_jar = 'jetty-server-9.4.1.v20170120.jar',
source_jar = 'jetty-server-9.4.1.v20170120-sources.jar',
deps = [
':jetty-http',
':jetty-io',
Expand All @@ -148,9 +151,9 @@ prebuilt_jar(

prebuilt_jar(
name = 'jetty-servlet',
maven_coords = 'org.eclipse.jetty:jetty-servlet:jar:9.2.13.v20150730',
binary_jar = 'jetty-servlet-9.2.13.v20150730.jar',
source_jar = 'jetty-servlet-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-servlet:jar:9.4.1.v20170120',
binary_jar = 'jetty-servlet-9.4.1.v20170120.jar',
source_jar = 'jetty-servlet-9.4.1.v20170120-sources.jar',
deps = [
':jetty-jmx',
':jetty-security'
Expand All @@ -159,9 +162,9 @@ prebuilt_jar(

prebuilt_jar(
name = 'jetty-servlets',
maven_coords = 'org.eclipse.jetty:jetty-servlets:jar:9.2.13.v20150730',
binary_jar = 'jetty-servlets-9.2.13.v20150730.jar',
source_jar = 'jetty-servlets-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-servlets:jar:9.4.1.v20170120',
binary_jar = 'jetty-servlets-9.4.1.v20170120.jar',
source_jar = 'jetty-servlets-9.4.1.v20170120-sources.jar',
deps = [
':jetty-continuation',
':jetty-http',
Expand All @@ -173,15 +176,14 @@ prebuilt_jar(

prebuilt_jar(
name = 'jetty-util',
maven_coords = 'org.eclipse.jetty:jetty-util:jar:9.2.13.v20150730',
binary_jar = 'jetty-util-9.2.13.v20150730.jar',
source_jar = 'jetty-util-9.2.13.v20150730-sources.jar',
maven_coords = 'org.eclipse.jetty:jetty-util:jar:9.4.1.v20170120',
binary_jar = 'jetty-util-9.4.1.v20170120.jar',
source_jar = 'jetty-util-9.4.1.v20170120-sources.jar',
deps = [
'//third_party/java/servlet:servlet-api'
],
visibility = [
'//third_party/java/websocket:websocket-client',
'//third_party/java/websocket:websocket-common'
'//third_party/java/websocket:websocket-common',
],
)

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit fdc62fd

Please sign in to comment.