Skip to content

Commit

Permalink
Replaced jetty 9.2 with jetty 6.1.26
Browse files Browse the repository at this point in the history
  • Loading branch information
svcarlsen committed Nov 2, 2015
1 parent b091279 commit 9d6470a
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 52 deletions.
8 changes: 7 additions & 1 deletion archive/archive-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@
<artifactId>jaxen</artifactId>
<version>1.1</version>
</dependency>

<!--
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
</dependency>
-->
<!-- ArcRepositoryApplication -->

<dependency>
Expand Down
35 changes: 34 additions & 1 deletion common/common-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,39 @@
<version>2.3</version>
</dependency>

<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.26</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.26</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-sslengine</artifactId>
<version>6.1.26</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-ajp</artifactId>
<version>6.1.26</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
</dependency>


<!--
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
Expand All @@ -91,7 +124,7 @@
<artifactId>jetty-runner</artifactId>
<version>9.2.2.v20140723</version>
</dependency>

-->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.mortbay.jetty.Request;
import org.mortbay.jetty.Server;
/*
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.AbstractHandler;
*/
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.handler.AbstractHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -113,7 +119,8 @@ protected HTTPRemoteFileRegistry() {
*/
protected void startServer() {
server = new Server();
ServerConnector connector = new ServerConnector(server);
//ServerConnector connector = new ServerConnector(server);
SocketConnector connector = new SocketConnector();
connector.setPort(port);
server.addConnector(connector);
server.setHandler(new HTTPRemoteFileRegistryHandler());
Expand Down Expand Up @@ -253,8 +260,10 @@ protected class HTTPRemoteFileRegistryHandler extends AbstractHandler {
* HttpServletResponse), HttpServletResponse, int)
*/
@Override
public void handle(String string, Request baseRequest, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws IOException, ServletException {
public void handle(String string,
//Request baseRequest,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse, int i) throws IOException, ServletException {
// since this is a jetty handle method, we know it is a Jetty
// request object.
Request request = ((Request) httpServletRequest);
Expand Down Expand Up @@ -282,6 +291,15 @@ public void handle(String string, Request baseRequest, HttpServletRequest httpSe
}
}
}


/*
public void handle(String arg0, HttpServletRequest arg1,
HttpServletResponse arg2, int arg3) throws IOException,
ServletException {
// TODO Auto-generated method stub
}*/
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManagerFactory;

import org.mortbay.jetty.Server;
import org.mortbay.jetty.security.SslSocketConnector;
import org.apache.commons.io.IOUtils;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory;
//import org.eclipse.jetty.server.HttpConfiguration;
//import org.eclipse.jetty.server.HttpConnectionFactory;
//import org.eclipse.jetty.server.SecureRequestCustomizer;
//import org.eclipse.jetty.server.Server;
//import org.eclipse.jetty.server.ServerConnector;
//import org.eclipse.jetty.server.SslConnectionFactory;
//import org.eclipse.jetty.util.ssl.SslContextFactory;

import dk.netarkivet.common.exceptions.IOFailure;
import dk.netarkivet.common.utils.Settings;
Expand Down Expand Up @@ -133,8 +134,8 @@ protected String getProtocol() {
* Start the server, including a handler that responds with registered files, removes registered files on request,
* and gives 404 otherwise. Connection to this web host only possible with the shared certificate.
*/
@Override
protected void startServer() {
protected void startServerOld() {
/*
server = new Server();
SslContextFactory sslContextFactory = new SslContextFactory();
Expand Down Expand Up @@ -162,8 +163,31 @@ protected void startServer() {
server.start();
} catch (Exception e) {
throw new IOFailure("Cannot start HTTPSRemoteFile registry", e);
}
} */
}

protected void startServer() {
server = new Server();
//This sets up a secure connector
SslSocketConnector connector = new SslSocketConnector();
connector.setKeystore(KEYSTORE_PATH);
connector.setPassword(KEYSTORE_PASSWORD);
connector.setKeyPassword(KEY_PASSWORD);
connector.setTruststore(KEYSTORE_PATH);
connector.setTrustPassword(KEYSTORE_PASSWORD);
connector.setNeedClientAuth(true);
connector.setPort(port);
//This initialises the server.
server.addConnector(connector);
server.addHandler(new HTTPRemoteFileRegistryHandler());
try {
server.start();
} catch (Exception e) {
throw new IOFailure("Cannot start HTTPSRemoteFile registry", e);
}
}



/**
* Open a connection to an URL in this registry. Thus opens SSL connections using the certificate above.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@

import java.io.File;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.webapp.WebAppContext;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.DefaultHandler;
import org.mortbay.jetty.handler.HandlerList;
import org.mortbay.jetty.webapp.WebAppContext;
//import org.eclipse.jetty.server.Server;
//import org.eclipse.jetty.server.handler.DefaultHandler;
//import org.eclipse.jetty.server.handler.HandlerList;
//import org.eclipse.jetty.webapp.WebAppContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,27 @@
import java.util.Map;
import java.util.Set;

import javax.el.ELContext;
import javax.servlet.AsyncContext;
import javax.servlet.DispatcherType;

//import javax.el.ELContext;
//import javax.servlet.AsyncContext;
//import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
//import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRegistration;
//import javax.servlet.ServletRegistration;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
import javax.servlet.descriptor.JspConfigDescriptor;
import javax.servlet.http.HttpSession;
//import javax.servlet.SessionCookieConfig;
//import javax.servlet.SessionTrackingMode;
//import javax.servlet.descriptor.JspConfigDescriptor;
//import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.el.ExpressionEvaluator;
Expand Down Expand Up @@ -117,12 +119,12 @@ public void setCharacterEncoding(String string) throws UnsupportedEncodingExcept
public int getContentLength() {
throw new NotImplementedException("Not implemented");
}

/*
@Override
public long getContentLengthLong() {
return 0;
}

*/
public String getContentType() {
throw new NotImplementedException("Not implemented");
}
Expand Down Expand Up @@ -222,7 +224,7 @@ public String getLocalAddr() {
public int getLocalPort() {
return 0;
}

/*
@Override
public ServletContext getServletContext() {
return null;
Expand Down Expand Up @@ -258,6 +260,7 @@ public AsyncContext getAsyncContext() {
public DispatcherType getDispatcherType() {
return null;
}
*/
}

public static class TestPageContext extends PageContext {
Expand Down Expand Up @@ -334,12 +337,12 @@ public void setContentLength(int i) {
// To change body of implemented methods use File | Settings
// | File Templates.
}

/*
@Override
public void setContentLengthLong(long l) {
}

*/
public void setContentType(String string) {
// To change body of implemented methods use File | Settings
// | File Templates.
Expand Down Expand Up @@ -417,7 +420,7 @@ public int getMinorVersion() {
return 0; // To change body of implemented methods use File
// | Settings | File Templates.
}

/*
@Override
public int getEffectiveMajorVersion() {
return 0;
Expand All @@ -427,7 +430,7 @@ public int getEffectiveMajorVersion() {
public int getEffectiveMinorVersion() {
return 0;
}

*/
public String getMimeType(String string) {
return null; // To change body of implemented methods use
// File | Settings | File Templates.
Expand Down Expand Up @@ -517,12 +520,12 @@ public Enumeration getInitParameterNames() {
return null; // To change body of implemented methods use
// File | Settings | File Templates.
}

/*
@Override
public boolean setInitParameter(String s, String s2) {
return false;
}

*/
public Object getAttribute(String string) {
return null; // To change body of implemented methods use
// File | Settings | File Templates.
Expand All @@ -547,7 +550,7 @@ public String getServletContextName() {
return null; // To change body of implemented methods use
// File | Settings | File Templates.
}

/*
@Override
public ServletRegistration.Dynamic addServlet(String s, String s2) {
return null;
Expand Down Expand Up @@ -667,6 +670,7 @@ public void declareRoles(String... strings) {
public String getVirtualServerName() {
return null;
}
*/
};
}

Expand Down Expand Up @@ -753,11 +757,12 @@ public VariableResolver getVariableResolver() {
return null; // To change body of implemented methods use File |
// Settings | File Templates.
}

/*
public ELContext getELContext() {
return null; // To change body of implemented methods use File |
// Settings | File Templates.
}
*/
}

public static PageContext getDummyPageContext(final Locale l, final ServletRequest request) {
Expand Down Expand Up @@ -805,12 +810,12 @@ public void setCharacterEncoding(String string) {

public void setContentLength(int i) {
}

/*
@Override
public void setContentLengthLong(long l) {
}

*/
public void setContentType(String string) {
}

Expand Down Expand Up @@ -913,10 +918,11 @@ public ExpressionEvaluator getExpressionEvaluator() {
public VariableResolver getVariableResolver() {
return null;
}

/*
public ELContext getELContext() {
return null;
}
*/
};
}
}
Loading

0 comments on commit 9d6470a

Please sign in to comment.