Did you push your changes to your fork of Wonder on GitHub?
>
> indeed!
>
> overkill!
>
> and I HATE killing overs!
>
> but when you say "ERRest will look at the request" -- isn't that what I'm
> trying to do?
>
> or I should say, how should I bet implement this callback query argument is
> present?
>
> aside from setting up a few keys for jsonp, at this time, I simply set the
> response header to javascript and I "can" the callback method name.
>
> you'll see I had written in some code which I figured would get the requested
> callback name and send via userInfo, which is obviously not needed.
>
> so, can I somehow access the request from here? or how do I otherwise look at
> the request at the right time and do the right thing?
>
>
>
>
>
>
> public class ERXJSONPRestWriter extends ERXJSONRestWriter {
>
> public void appendHeadersToResponse(ERXRestRequestNode node,
> IERXRestResponse response, ERXRestContext context) {
> response.setHeader("text/javascript;charset=UTF-8",
> "Content-Type");
> }
>
> public void appendToResponse(ERXRestRequestNode node, IERXRestResponse
> response, ERXRestFormat.Delegate delegate, ERXRestContext context) {
> String callbackName = (String)
> context.userInfoForKey("callback");
>
> if (callbackName != null)
> response.appendContentString(callbackName + "(");
> else
> response.appendContentString("callback(");
>
>
> node = processNode(node);
> if (node != null) {
> node._removeRedundantTypes();
> }
>
> appendHeadersToResponse(node, response, context);
> Object object = node.toJavaCollection(delegate);
> if (object == null) {
> response.appendContentString("undefined");
> }
> else if (ERXRestUtils.isPrimitive(object)) {
> response.appendContentString(String.valueOf(object));
> }
> else {
>
> response.appendContentString(JSONSerializer.toJSON(object,
> configWithContext(context)).toString());
> }
>
> response.appendContentString(");");
> }
>
> }
>
>
>
> On Jul 13, 2012, at 7:50 PM, Pascal Robert <[email protected]> wrote:
>
>> That's overkill :-) It should be implemented like the window.name transport,
>> e.g. ERRest will look at the request to see if a "callback" query argument
>> was passed, and if yes, wrap it.
>>
>>> I'm adding an ERXJSONPRestWriter in Wonder, to support JSONP in ERRest
>>>
>>> so, like getting any ERRest format request, you can now also get jsonp:
>>>
>>> /ra/Person/306.jsonp
>>>
>>> so far, so good
>>>
>>> the spec. calls for an optional callback method name, requested on the URL
>>>
>>> /ra/Person/306.jsonp?callback=parseResponse
>>>
>>> or, it seems less commonly:
>>>
>>> /ra/Person/306.jsonp?jsonp=parseResponse
>>>
>>> The RestWriter didn't have access to the originating request, so I figured
>>> I'd send in the method name through the userInfo dictionary and I'd be able
>>> to pick that up in the writer?
>>>
>>> So, I thought I'd write something like a ERXJSONPRestResponseWriter?
>>>
>>> But that's not really what I should do? I can see I'm onto the wrong track
>>> here -
>>>
>>> Does anyone know the internals of ERRest well enough to help guide me just
>>> a bit here?
>>>
>>> I suspect if I can get my head around the design, I can check in this stuff
>>> in case anyone needs cross origin or jsonp support for whatever reason.
>>>
>>> Thanks for any advice!
>>>
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca
>>>
>>> This email sent to [email protected]
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]