Issue 83: added missing servlet context

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2591 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2010-01-04 03:36:08 +00:00
parent ada30747ea
commit 69b247cbf4
1 changed files with 18 additions and 2 deletions

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.demo.tweetstore.controller;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -29,6 +31,7 @@ import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@ -38,6 +41,7 @@ import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
import org.jclouds.demo.tweetstore.functions.ServiceToStoredTweetStatuses;
import org.jclouds.logging.Logger;
import org.springframework.web.context.ServletContextAware;
import com.google.appengine.repackaged.com.google.common.collect.Lists;
import com.google.common.base.Function;
@ -50,7 +54,7 @@ import com.google.common.collect.Iterables;
*/
@Singleton
public class AddTweetsController extends HttpServlet implements
Function<Set<String>, List<StoredTweetStatus>> {
Function<Set<String>, List<StoredTweetStatus>>, ServletContextAware {
/** The serialVersionUID */
private static final long serialVersionUID = 3888348023150822683L;
@ -60,6 +64,8 @@ public class AddTweetsController extends HttpServlet implements
@Resource
protected Logger logger = Logger.NULL;
private ServletContext servletContext;
@Inject
public AddTweetsController(Map<String, BlobStoreContext<?, ?>> contexts,
ServiceToStoredTweetStatuses blobStoreContextToContainerResult) {
@ -93,4 +99,14 @@ public class AddTweetsController extends HttpServlet implements
}
return statuses;
}
}
@Override
public void setServletContext(ServletContext context) {
this.servletContext = context;
}
@Override
public ServletContext getServletContext() {
return checkNotNull(servletContext, "servletContext");
}
}