Moved the enum config to the proper place. web.xml is in the correct order as per http://java.sun.com/dtd/web-app_2_3.dtd
Thanks again, Ben.
Patch by: amitmanjhi
Review by: rjrjr@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7852 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/server/ExpensesDataServlet.java b/bikeshed/src/com/google/gwt/sample/expenses/server/ExpensesDataServlet.java
index 689a1d4..3fb9d33 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/server/ExpensesDataServlet.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/server/ExpensesDataServlet.java
@@ -30,7 +30,6 @@
import java.io.BufferedInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -40,7 +39,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
import java.util.Set;
import javax.servlet.http.HttpServlet;
@@ -52,7 +50,6 @@
*/
public class ExpensesDataServlet extends HttpServlet {
- private static final String PROPERTY_FILENAME = "servlet.properties";
// TODO: Remove this hack
private static final Set<String> PROPERTY_SET = new HashSet<String>();
static {
@@ -76,15 +73,10 @@
sync(topLevelJsonObject.getString(RequestDataManager.CONTENT_TOKEN),
writer);
} else {
- InputStream is = this.getClass().getClassLoader().getResourceAsStream(PROPERTY_FILENAME);
- if (is == null) {
- throw new IllegalArgumentException("unable to find servlet.properties");
- }
- Properties properties = new Properties();
- properties.load(is);
operation = getOperationFromName(
operationName,
- (Class<RequestDefinition>) Class.forName(properties.getProperty("servlet.serveroperation")));
+ (Class<RequestDefinition>) Class.forName(getServletContext().getInitParameter(
+ "servlet.serverOperation")));
Class<?> domainClass = Class.forName(operation.getDomainClassName());
Method domainMethod = domainClass.getMethod(
operation.getDomainMethodName(), operation.getParameterTypes());
diff --git a/bikeshed/war/WEB-INF/classes/servlet.properties b/bikeshed/war/WEB-INF/classes/servlet.properties
deleted file mode 100644
index ae714e2..0000000
--- a/bikeshed/war/WEB-INF/classes/servlet.properties
+++ /dev/null
@@ -1 +0,0 @@
-servlet.serveroperation=com.google.gwt.sample.expenses.shared.ExpenseRequestFactory$ServerSideOperation
diff --git a/bikeshed/war/WEB-INF/web.xml b/bikeshed/war/WEB-INF/web.xml
index ad7251e..9a43bd7 100644
--- a/bikeshed/war/WEB-INF/web.xml
+++ b/bikeshed/war/WEB-INF/web.xml
@@ -5,6 +5,11 @@
<web-app>
+ <context-param>
+ <param-name>servlet.serverOperation</param-name>
+ <param-value>com.google.gwt.sample.expenses.shared.ExpenseRequestFactory$ServerSideOperation</param-value>
+ </context-param>
+
<!-- Servlets -->
<servlet>
<servlet-name>expensesData</servlet-name>