Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stopped using local servletContext

  • Loading branch information...
commit 47a497bb2ea646a0c04933e5f313d1c02d9b0afe 1 parent 51b7dc2
@afeinberg afeinberg authored
View
2  build.properties
@@ -33,4 +33,4 @@ tomcat.manager.password=tomcat
tomcat.context=/voldemort
## Release
-curr.release=0.81.1.li4
+curr.release=0.81.1.li5
View
17 src/java/voldemort/server/http/gui/ReadOnlyStoreManagementServlet.java
@@ -21,6 +21,7 @@
import java.util.List;
import java.util.Map;
+import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -74,12 +75,13 @@ public ReadOnlyStoreManagementServlet(VoldemortServer server, VelocityEngine eng
}
@Override
- public void init() throws ServletException {
- super.init();
- VoldemortServer server = (VoldemortServer) getServletContext().getAttribute(VoldemortServletContextListener.SERVER_KEY);
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ VoldemortServer server = (VoldemortServer) config.getServletContext()
+ .getAttribute(VoldemortServletContextListener.SERVER_KEY);
initStores(server);
- initVelocity();
+ initVelocity(config);
setFetcherClass(server);
}
@@ -87,8 +89,9 @@ public void initStores(VoldemortServer server) {
this.stores = getReadOnlyStores(server);
}
- public void initVelocity() {
- this.velocityEngine = (VelocityEngine) Utils.notNull(getServletContext().getAttribute(VoldemortServletContextListener.VELOCITY_ENGINE_KEY));
+ public void initVelocity(ServletConfig config) {
+ this.velocityEngine = (VelocityEngine) Utils.notNull(config.getServletContext()
+ .getAttribute(VoldemortServletContextListener.VELOCITY_ENGINE_KEY));
}
private void setFetcherClass(VoldemortServer server) {
@@ -125,7 +128,6 @@ private void setFetcherClass(VoldemortServer server) {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
- initStores((VoldemortServer) getServletContext().getAttribute(VoldemortServletContextListener.SERVER_KEY));
Map<String, Object> params = Maps.newHashMap();
params.put("stores", stores);
velocityEngine.render("read-only-mgmt.vm", params, resp.getOutputStream());
@@ -209,7 +211,6 @@ private String getRequired(HttpServletRequest req, String name) throws ServletEx
}
private ReadOnlyStorageEngine getStore(String storeName) throws ServletException {
- initStores((VoldemortServer) getServletContext().getAttribute(VoldemortServletContextListener.SERVER_KEY));
for(ReadOnlyStorageEngine store: this.stores)
if(store.getName().equals(storeName))
return store;
Please sign in to comment.
Something went wrong with that request. Please try again.