diff --git a/datastore_server/.classpath b/datastore_server/.classpath index 8d0f0c284670286a1500b42672912d8cdbff3ee6..6da16166b29c3a7122449d71d0bd5794c4ffe2bd 100644 --- a/datastore_server/.classpath +++ b/datastore_server/.classpath @@ -18,9 +18,6 @@ <classpathentry kind="lib" path="/libraries/jmock/objenesis/objenesis-1.0.jar"/> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/openbis"/> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/server-common"/> - <classpathentry kind="lib" path="/libraries/jetty/jetty.jar" sourcepath="/libraries/jetty/src/jetty.zip"/> - <classpathentry kind="lib" path="/libraries/jetty/jetty-util.jar" sourcepath="/libraries/jetty/src/jetty-util.zip"/> - <classpathentry kind="lib" path="/libraries/jetty/servlet-api-2.5.jar" sourcepath="/libraries/jetty/src/servlet-api-2.5.zip"/> <classpathentry kind="lib" path="/libraries/spring/spring.jar" sourcepath="/libraries/spring/src.jar"/> <classpathentry kind="lib" path="/libraries/cifex/cifex.jar" sourcepath="/cifex/source/java"/> <classpathentry kind="lib" path="/libraries/cisd-base/cisd-base-test.jar" sourcepath="/libraries/cisd-base/cisd-base-src.zip"/> @@ -41,5 +38,12 @@ <attribute name="javadoc_location" value="jar:platform:/resource/libraries/jfreechart/jfreechart-1.0.13-javadocs.zip!/jfreechart-1.0.13-javadocs"/> </attributes> </classpathentry> + <classpathentry kind="lib" path="/libraries/jetty7/lib/common/jetty-io.jar"/> + <classpathentry kind="lib" path="/libraries/jetty7/lib/common/jetty-http.jar"/> + <classpathentry kind="lib" path="/libraries/jetty7/lib/common/jetty-util.jar"/> + <classpathentry kind="lib" path="/libraries/jetty7/lib/server/jetty-server.jar"/> + <classpathentry kind="lib" path="/libraries/jetty7/lib/server/jetty-servlet.jar"/> + <classpathentry kind="lib" path="/libraries/jetty7/lib/server/jetty-security.jar"/> + <classpathentry kind="lib" path="/libraries/jetty7/lib/server/servlet-api-2.5.jar"/> <classpathentry kind="output" path="targets/classes"/> </classpath> diff --git a/datastore_server/build/build.xml b/datastore_server/build/build.xml index 6687913ae28ad9b3972882d2b87fd8f782e250c7..ea4f26b42d2b44fca70db5cdd0c26b0e4875ce0e 100644 --- a/datastore_server/build/build.xml +++ b/datastore_server/build/build.xml @@ -53,12 +53,13 @@ <manifest> <attribute name="Main-Class" value="ch.systemsx.cisd.openbis.dss.generic.DataStoreServer" /> <attribute name="Class-Path" - value="datastore_server-plugins.jar cisd-args4j.jar cisd-base.jar cifex.jar jetty.jar jetty-util.jar - servlet-api-2.5.jar log4j.jar activation.jar mail.jar spring.jar fast-md5.jar + value="datastore_server-plugins.jar cisd-args4j.jar cisd-base.jar cifex.jar + jetty-http.jar jetty-io.jar jetty-security.jar jetty-server.jar jetty-servlet.jar jetty-util.jar + servlet-api-2.5.jar log4j.jar activation.jar mail.jar spring.jar fast-md5.jar commons-codec.jar commons-lang.jar commons-io.jar commons-logging.jar - commons-httpclient.jar commons-pool.jar commons-dbcp.jar eodsql.jar postgresql.jar - ij.jar jaxb-api.jar jaxb-impl.jar jsr173_1-0_api.jar csv.jar - jcommon-1.0.16.jar jfreechart-1.0.13.jar" /> + commons-httpclient.jar commons-pool.jar commons-dbcp.jar eodsql.jar postgresql.jar + ij.jar jaxb-api.jar jaxb-impl.jar jsr173_1-0_api.jar csv.jar + jcommon-1.0.16.jar jfreechart-1.0.13.jar" /> <attribute name="Version" value="${version.number}" /> <attribute name="Build-Number" value="${version.number} (r${revision.number},${clean.flag})" /> @@ -89,12 +90,16 @@ --> <target name="prepare-dist-libs" depends="dss-jar, dist-client"> <copy file="${dss-jar.file}" todir="${dist.datastore_server.lib}" /> - <copy file="${lib}/cisd-base/cisd-base.jar" todir="${dist.datastore_server.lib}" /> + <copy todir="${dist.datastore_server.lib}" flatten="true"> + <fileset dir="${lib}/jetty7/lib"> + <include name="common/*.jar" /> + <include name="server/*.jar" /> + <exclude name="server/jetty-continuation.jar" /> + </fileset> + </copy> + <copy file="${lib}/cisd-base/cisd-base.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/cisd-args4j/cisd-args4j.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/cifex/cifex.jar" todir="${dist.datastore_server.lib}" /> - <copy file="${lib}/jetty/jetty.jar" todir="${dist.datastore_server.lib}" /> - <copy file="${lib}/jetty/jetty-util.jar" todir="${dist.datastore_server.lib}" /> - <copy file="${lib}/jetty/servlet-api-2.5.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/activation/activation.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/mail/mail.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/log4j/log4j.jar" todir="${dist.datastore_server.lib}" /> diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreServer.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreServer.java index 0b14c66cafcc683e2895cdb5da6e5272813c8416..fdb0da2114b7dbb8faaa42eb571bc9ad73da1ef7 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreServer.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreServer.java @@ -24,17 +24,18 @@ import java.util.Enumeration; import java.util.List; import java.util.Properties; +import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.bio.SocketConnector; -import org.mortbay.jetty.security.SslSocketConnector; -import org.mortbay.jetty.servlet.Context; -import org.mortbay.jetty.servlet.ServletHolder; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.bio.SocketConnector; +import org.eclipse.jetty.server.ssl.SslSocketConnector; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter; import org.springframework.util.StringUtils; @@ -184,7 +185,8 @@ public class DataStoreServer private static void initializeContext(final ApplicationContext applicationContext, final ConfigParameters configParameters, final Server thisServer) { - final Context context = new Context(thisServer, "/", Context.SESSIONS); + final ServletContextHandler context = + new ServletContextHandler(thisServer, "/", ServletContextHandler.SESSIONS); context.setAttribute(APPLICATION_CONTEXT_KEY, applicationContext); context.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ServiceProvider.APPLICATION_CONTEXT); @@ -204,7 +206,7 @@ public class DataStoreServer // TODO 2010-06-01, CR : The registration process here needs to be made cleaner. // Perhaps by using Spring and the dssApplicationContext.xml more effectively, or perhaps by // using annotations and reflection. - private static void initializeRpcServices(final Context context, + private static void initializeRpcServices(final ServletContextHandler context, final ApplicationContext applicationContext, final ConfigParameters configParameters) { // Get the spring bean and do some additional configuration @@ -243,19 +245,28 @@ public class DataStoreServer rpcNameServer.addSupportedInterfaceVersion(nameServerVersion); } - private static void registerPluginServlets(Context context, List<PluginServlet> pluginServlets) + @SuppressWarnings("unchecked") + private static void registerPluginServlets(ServletContextHandler context, + List<PluginServlet> pluginServlets) { for (PluginServlet pluginServlet : pluginServlets) { - Class<?> classInstance; + Class<? extends Servlet> classInstance; try { - classInstance = Class.forName(pluginServlet.getServletClass()); + classInstance = + (Class<? extends Servlet>) Class.forName(pluginServlet.getServletClass()); } catch (ClassNotFoundException ex) { throw EnvironmentFailureException.fromTemplate( "Error while loading servlet plugin class '%s': %s", pluginServlet .getClass(), ex.getMessage()); + } catch (ClassCastException ex) + { + throw EnvironmentFailureException.fromTemplate( + "Error while loading servlet plugin class '%s': %s. " + + "Servlet implementation expected.", pluginServlet.getClass(), ex + .getMessage()); } ServletHolder holder = context.addServlet(classInstance, pluginServlet.getServletPath());