Author: [email protected]
Date: Fri May 20 09:47:34 2011
New Revision: 1145
Log:
[AMDATU-381] Fixed setting context classloader on the current thread to the
bundle classloader during initialization
Modified:
trunk/amdatu-web/rest-wink/src/main/java/org/amdatu/web/rest/wink/service/WinkRestServlet.java
Modified:
trunk/amdatu-web/rest-wink/src/main/java/org/amdatu/web/rest/wink/service/WinkRestServlet.java
==============================================================================
---
trunk/amdatu-web/rest-wink/src/main/java/org/amdatu/web/rest/wink/service/WinkRestServlet.java
(original)
+++
trunk/amdatu-web/rest-wink/src/main/java/org/amdatu/web/rest/wink/service/WinkRestServlet.java
Fri May 20 09:47:34 2011
@@ -15,17 +15,17 @@
*/
package org.amdatu.web.rest.wink.service;
-import java.io.IOException;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.wink.server.internal.RequestProcessor;
-import org.apache.wink.server.internal.servlet.RestServlet;
-import org.apache.wink.server.utils.RegistrationUtils;
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.wink.server.internal.RequestProcessor;
+import org.apache.wink.server.internal.servlet.RestServlet;
+import org.apache.wink.server.utils.RegistrationUtils;
/**
* Extends the default Apache Wink <code>RestServlet</code> to handle multiple
@@ -76,6 +76,20 @@
protected void storeRequestProcessorOnServletContext(RequestProcessor
requestProcessor) {
requestProcessor.storeRequestProcessorOnServletContext(getServletContext(),
m_requestProcessorId);
+ }
+
+ @Override
+ public void init() throws ServletException {
+ // Perform the init with the bundle classloader set as context
classloader on
+ // the current thread, as the ClassUtils.loadClass method of Wink will
try
+ // to load classes from this classloader.
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ super.init();
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
}
public void init(ServletConfig config) throws ServletException {
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits