Reverted explicit servlet context setting and corrected a mistakenly committed change to the dispatcher ('/tweets.jsp' was changed to '/tweets' for a test but should not have been committed).

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2599 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
sharedocs1@gmail.com 2010-01-04 21:07:18 +00:00
parent f14eedc747
commit 910e45ddb4
1 changed files with 18 additions and 31 deletions

View File

@ -3,23 +3,26 @@
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com> * Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
* *
* ==================================================================== * ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed to the Apache Software Foundation (ASF) under one
* you may not use this file except in compliance with the License. * or more contributor license agreements. See the NOTICE file
* You may obtain a copy of the License at * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing,
* distributed under the License is distributed on an "AS IS" BASIS, * software distributed under the License is distributed on an
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* See the License for the specific language governing permissions and * KIND, either express or implied. See the License for the
* limitations under the License. * specific language governing permissions and limitations
* under the License.
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.demo.tweetstore.controller; package org.jclouds.demo.tweetstore.controller;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -31,7 +34,6 @@ import javax.annotation.Resource;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import javax.servlet.RequestDispatcher; import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -41,7 +43,6 @@ import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus; import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
import org.jclouds.demo.tweetstore.functions.ServiceToStoredTweetStatuses; import org.jclouds.demo.tweetstore.functions.ServiceToStoredTweetStatuses;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.springframework.web.context.ServletContextAware;
import com.google.appengine.repackaged.com.google.common.collect.Lists; import com.google.appengine.repackaged.com.google.common.collect.Lists;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -54,7 +55,7 @@ import com.google.common.collect.Iterables;
*/ */
@Singleton @Singleton
public class AddTweetsController extends HttpServlet implements public class AddTweetsController extends HttpServlet implements
Function<Set<String>, List<StoredTweetStatus>>, ServletContextAware { Function<Set<String>, List<StoredTweetStatus>> {
/** The serialVersionUID */ /** The serialVersionUID */
private static final long serialVersionUID = 3888348023150822683L; private static final long serialVersionUID = 3888348023150822683L;
@ -64,14 +65,11 @@ public class AddTweetsController extends HttpServlet implements
@Resource @Resource
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
private ServletContext servletContext;
@Inject @Inject
public AddTweetsController(Map<String, BlobStoreContext<?, ?>> contexts, public AddTweetsController(Map<String, BlobStoreContext<?, ?>> contexts,
ServiceToStoredTweetStatuses blobStoreContextToContainerResult) { ServiceToStoredTweetStatuses blobStoreContextToContainerResult) {
this.contexts = checkNotNull(contexts, "contexts"); this.contexts = contexts;
this.blobStoreContextToContainerResult = checkNotNull(blobStoreContextToContainerResult, this.blobStoreContextToContainerResult = blobStoreContextToContainerResult;
"blobStoreContextToContainerResult");
} }
@Override @Override
@ -100,15 +98,4 @@ public class AddTweetsController extends HttpServlet implements
} }
return statuses; return statuses;
} }
@Inject
@Override
public void setServletContext(ServletContext context) {
this.servletContext = context;
}
@Override
public ServletContext getServletContext() {
return (servletContext != null) ? servletContext : super.getServletContext();
}
} }