Monday May 26, 2008

Workarounding Cross-domain Restriction With Jersey

Having a JSON generating REST resource, you can consume provided
data in your web page using JavaScript pretty easily. To access data
at your own site you can obviously make a HttpRequest from JavaScript code.
To access data from another site, you will need to workaround
a cross-domain restriction somehow. Two possible approaches are described
at Dan Theurer's blog entries here and here.

In this entry i will show how to add the JavaScript representation option to your Jersey based REST resource, so that besides


{ some JSON data}

when your client asks for http://.../myResource.json,
you will be able to return also something like

myFunc({ some JSON data})

when it asks for http://.../myResource.js?callback=myFunc...

[Read More]
About

Jakub Podlesak

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today