2

I'm working on a GWT project, in which I have to fetch some JSON data from a real web-domain. Due to SOP policy, GWT fails to get those data.

To address this, as suggested in GWT docs, I have created some proxy servlets within GWT, which in turn should call the actual JSON provider external url.

Does anybody know how should I retrieve json data from an external url, within a servlet?

Thanks

green-i
  • 315
  • 2
  • 16

1 Answers1

1

Use java.net.URLConnection.

InputStream input = new URL("http://example.com/data.json").openStream();

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555