Thanks.
Few follow up questions:
1. You wrote: " Your user handler should come before
CreateInvocationParametersHandler"
But according to wink, user handlers are inserted after
CreateInvocationParametersHandler, so how can I insert it before it?
2. You wrote: ", create the invocation parameters and then invoke the method
for that part.".
I can parse each part and create invocation params (actually I already did it
in my POC), but the big questions still remain:
a. I have the resource name in each part. How do I find the method that
I need to invoke?
b. How do I invoke it, in such a way that I'll invoke each part and
aggregate all the responses back to the client?
10x again.
-----Original Message-----
From: Bryant Luk [mailto:[email protected]]
Sent: Tuesday, June 21, 2011 7:49 PM
To: [email protected]
Subject: Re: batch proccessing
Hello,
The classes you are probably interested in would be in the
org.apache.wink.server.handlers.* package (
http://incubator.apache.org/wink/1.1.2/api/index.html ). To register a custom
handler factory, you'll need to initialize a custom property.
https://cwiki.apache.org/WINK/2-apache-wink-building-blocks.html#2ApacheWinkBuildingBlocks-CustomizationoftheHandlersChain
https://cwiki.apache.org/WINK/57-handler-chain-runtime-extension.html
may help.
Your user handler should come before CreateInvocationParametersHandler and
InvokeMethodHandler . You could parse each part, create the invocation
parameters and then invoke the method for that part. I'm not sure if you're
planning to use other types of parameters but you can look at the system
handlers in
org.apache.wink.server.internal.handlers.* like the
CreateInvocationParametersHandler to understand what you would need to do.
On Sun, Jun 19, 2011 at 9:34 AM, Borshtein, Ofer <[email protected]> wrote:
> Hi
>
> Using a custom handler, how can I get the message body, and invoke
> resources ?
>
>
>
> More info:
>
> I want to implement some way of batch requests in REST.
>
>
>
> The input: a message body of JSON/XML, that contain several entries.
>
> Each Entry consists of the target URI and the message body.
>
>
>
> Ex:
>
> --boundary
>
> Content-Type: application/xml
>
>
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><uri>... uri for
> a resource ... </uri> <user>... body ...</user>
>
> --boundary
>
> Content-Type: application/xml
>
>
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><uri>... uri for
> a resource ... </uri> <user>... body ...</user>
>
> --boundary-
>
>
>
> For that, I want to write my own handler, to read above input, parse
> it, and invoke each entry.
>
>
>
> How do I do that?
>
>
>
>