You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by "Emmanouil Batsis (Manos)" <ma...@abiss.gr> on 2012/11/09 15:08:22 UTC

Supporting JSONP for cross-domain ajax? (was: Re: JS-only AJAX client for wicket webapp?)

Thanks Martin. The approach wouldn't really work in my case, so i took 
some time to reestablish the question: Would devs be interested in 
supporting JSONP [1] (i.e. cross domain via json) applications with a 
future version of wicket? What approaches could provide wicket with 
something more usable there?

I believe cross-domain is currently an important feature as far as web 
frameworks go. It should also should provide another reason to reuse and 
maintain existing wicket code.

Manos


On 11/01/2012 04:47 PM, Martin Grigorov wrote:
> I guess it is possible but you judge how complex it sounds to you.
>
> 1. mount a Wicket IResource at a predefined mount point which will
> generate the <script>, e.g. the-bootstrap.js
> This resource will instantiate a Page and then for each component that
> you are interested in this page you can create a callback url.
> To do that use org.apache.wicket.core.request.handler.ComponentRenderingRequestHandler
> + page.urlFor(handler)
>
> So the-bootstrap.js will contain a config object with the callback
> urls for all such components plus your own JS functions which will use
> these urls
>
> You can use PackageTextTemplate to load the .js and populate the config in it.
>
> 2. With Wicket.Ajax.get({u: componentUrl}) you can ask Wicket to
> deliver the HTML for a component. To be able to do that the Page from
> p.1 should be stateless or stored if stateful
>
>
> On Thu, Nov 1, 2012 at 4:32 PM, Emmanouil Batsis (Manos) <ma...@abiss.gr> wrote:
>> On 11/01/2012 04:14 PM, Martin Grigorov wrote:
>>>
>>> I personally didn't get it but to not look too stupid I usually don't
>>> ask second time for more details :-)
>>
>>
>> Please let me try one more time :-)
>>
>> My assumption is that Wicket communicates with the browser via Ajax for
>> keeping component state and modify the client HTML DOM. Usually this process
>> (i.e. a user session) is bootstrapped by an initial HTTP request made by the
>> user for a Wicket page.
>>
>> My question is, can't we have a JS-only bootstrap <script> that loads wicket
>> client stuff and renders the wicket components instead of requesting a
>> wicket page?
>>
>> The objective here is to make a wicket app usable by third party web
>> applications via json. So, suppose I have a static webpage in
>> www.mystaticpage.com and I want to allow users to send me a message, would
>> it be possible to add a
>>
>> <script src="http://my-wicket-app/js-message-botstrap.js" >
>>
>> that would load the wicket client scripts in the static page, create wicket
>> components for a message form on the server and render their HTML
>> counterparts on the browser?
>>
>> Manos
>
>
>


-- 
Manos Batsis, Chief Technologist
          __    _
   ____ _/ /_  (_)_________ ____ ______
  / __ `/ __ \/ / ___/ ___// __ `/ ___/
/ /_/ / /_/ / (__  |__  )/ /_/ / /
\__,_/_.___/_/____/____(_)__, /_/
                         /____/
http://www.Abiss.gr

19, Kalvou Street,
14231, Nea Ionia,
Athens, Greece
Tel: +30 211-1027-900
Fax: +30 211-1027-999

http://calipso.abiss.gr
http://gr.linkedin.com/in/manosbatsis