Try using TaskOptions.payload(byte[] payload, java.Lang.String contentType)

TaskOptions task = TaskOptions.Builder
        .withUrl("/mytaskhandler")
        .payload(jsonBody.getBytes(), "application/json");
QueueFactory.getDefaultQueue().add(task);

Nick Verne

On Tue, Jan 10, 2012 at 3:29 AM, AndyD <[email protected]> wrote:
> First off, I'm new to App Engine task queues, and so I may just be going
> against the grain here.  Feel free to redirect me if that's the case.
>
> What I'd like to do is queue a task and supply a JSON payload in the HTTP
> request to the handler
>
> Here's what I'm trying...
>
>     TaskOptions task = TaskOptions.Builder
>         .withUrl("/mytaskhandler")
>         .header("Content-Type", "application/json")
>         .payload(jsonBody);
>     QueueFactory.getDefaultQueue().add(task);
>
> What I'm seeing is that this results in a request that has **both** of the
> following headers:
> Content-Type:application/json
> and
> Content-Type:text/plain
>
> That seems bogus, and it's confusing the REST library (Restlet) that I'm
> using to handle the request content negotiation.  Bug?
>
> -AndyD
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/fEC1iFfb2T0J.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to