mirror of
https://github.com/apache/jclouds.git
synced 2025-02-16 15:08:28 +00:00
Constructing the request URL for the 'store' callback using context-specific settings
This commit is contained in:
parent
d8443bec4d
commit
75b336b83f
@ -33,6 +33,7 @@ import java.util.Map;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
@ -109,14 +110,19 @@ public class GuiceServletConfig extends GuiceServletContextListener {
|
|||||||
// submit a job to store tweets for each configured blobstore
|
// submit a job to store tweets for each configured blobstore
|
||||||
for (String name : providerTypeToBlobStoreMap.keySet()) {
|
for (String name : providerTypeToBlobStoreMap.keySet()) {
|
||||||
queue.add(taskFactory.create(HttpRequest.builder()
|
queue.add(taskFactory.create(HttpRequest.builder()
|
||||||
.endpoint(URI.create("http://localhost:8080" + servletContextEvent.getServletContext().getContextPath() + "/store/do"))
|
.endpoint(withUrl(servletContextEvent.getServletContext(), "/store/do"))
|
||||||
.headers(ImmutableMultimap.of("context", name, "X-RUN@cloud-QueueName", "twitter"))
|
.headers(ImmutableMultimap.of("context", name))
|
||||||
.method("GET").build()));
|
.method("GET").build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
super.contextInitialized(servletContextEvent);
|
super.contextInitialized(servletContextEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static URI withUrl(ServletContext servletContext, String url) {
|
||||||
|
return URI.create("http://" + servletContext.getInitParameter("application.host")
|
||||||
|
+ servletContext.getContextPath() + url);
|
||||||
|
}
|
||||||
|
|
||||||
private Properties loadJCloudsProperties(
|
private Properties loadJCloudsProperties(
|
||||||
ServletContextEvent servletContextEvent) {
|
ServletContextEvent servletContextEvent) {
|
||||||
InputStream input = servletContextEvent.getServletContext()
|
InputStream input = servletContextEvent.getServletContext()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user