Examples of TaskOptions


Examples of com.google.appengine.api.taskqueue.TaskOptions

     *            ignored.
     * @return a newly created {@link TaskOptions} instance containing data from
     *         <code>exchange</code>.
     */
    public TaskOptions writeRequest(GTaskEndpoint endpoint, Exchange exchange, TaskOptions request) {
        TaskOptions answer = TaskOptions.Builder.withUrl(getWorkerRoot(endpoint) + endpoint.getPath());
        writeRequestHeaders(endpoint, exchange, answer);
        writeRequestBody(endpoint, exchange, answer);
        // TODO: consider TaskOptions method (POST, GET, ...)
        return answer;
    }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

    @Test
    public void testWriteRequestHeaders() throws Exception {
        exchange.getIn().setHeader("test", "abc");
        exchange.getIn().setHeader(Exchange.HTTP_QUERY, "x=y");
        TaskOptions options = withDefaults();
        binding.writeRequestHeaders(endpoint, exchange, options);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("abc", getHeader(info, "test"));
        assertNull(getHeader(info, Exchange.HTTP_QUERY));
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

    }
   
    @Test
    public void testWriteRequestBody() {
        exchange.getIn().setBody("test");
        TaskOptions options = withDefaults();
        binding.writeRequestBody(endpoint, exchange, options);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("test", info.getBody());
        assertNull("application/octet-stream", getHeader(info , Exchange.CONTENT_TYPE));
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

    }
   
    @Test
    public void testWriteRequestWithDefaultWorkerRoot() throws Exception {
        exchange.getIn().setBody("anything");
        TaskOptions options = binding.writeRequest(endpoint, exchange, null);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("/worker/test", info.getUrl());
    }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

   
    @Test
    public void testWriteRequestWithCustomWorkerRoot() throws Exception {
        GTaskEndpoint custom = createEndpoint("test?workerRoot=lazy");
        exchange.getIn().setBody("anything");
        TaskOptions options = binding.writeRequest(custom, exchange, null);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("/lazy/test", info.getUrl());
    }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

  @Override
  public void addWork(String workId, String url, Map<String, String> params)
    throws MalformedURLException, InterruptedException, ExecutionException {
    Queue queue = QueueFactory.getQueue(workId);
    TaskOptions options = TaskOptions.Builder.withUrl(url);
    options.method(Method.POST);
    for(String name : params.keySet()) {
      options.param(name, params.get(name));
    }
    options.header("Host", BackendServiceFactory.getBackendService().getBackendAddress("worker",0));
    queue.add(options);      
  }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

  @Override
  public void addWork(String workId, String url, Map<String, String> params)
    throws MalformedURLException, InterruptedException, ExecutionException {
    Queue queue = QueueFactory.getQueue(workId);
    TaskOptions options = TaskOptions.Builder.withUrl(url);
    options.method(Method.POST);
    for(String name : params.keySet()) {
      options.param(name, params.get(name));
    }
    queue.add(options);
  }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

      error(resp, "Malformed JSON could not be parsed: " + e.toString());
      return;
    }
    LOG.info("JSON received: " + json.toString());
    JSONObject o;
    TaskOptions task;
    String email = userService.getEmail();
    for (int i = 0; i < json.length(); i++) {
      try {
        o = json.getJSONObject(i);
        task = TaskOptions.Builder.withUrl(UploadDataTask.URL).method(Method.POST)
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

     *
     * @return a newly created {@link TaskOptions} instance containing data from
     *         <code>exchange</code>.
     */
    public TaskOptions writeRequest(GTaskEndpoint endpoint, Exchange exchange, TaskOptions request) {
        TaskOptions answer = TaskOptions.Builder.withUrl(getWorkerRoot(endpoint) + endpoint.getPath());
        writeRequestHeaders(endpoint, exchange, answer);
        writeRequestBody(endpoint, exchange, answer);
        // TODO: consider TaskOptions method (POST, GET, ...)
        return answer;
    }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskOptions

      if (md.hasProblem()) {
        md.setWhen(new Date());
        String key = AMessageDAO.createMessageDescriptor(md);

        Queue queue = QueueFactory.getQueue("serverError");
        TaskOptions taskOptions = TaskOptions.Builder.withUrl("/sendAll").param(SendMessageServlet.PARAMETER_SERVER, key).method(Method.POST);
        queue.add(taskOptions);
      }
    }

    writeStatusListToResponse(resp, statusList);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.