• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Http Get external url socket

 
Jose Maestre
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have to make a function that have to make a get into a public url, it will return me a plain text wich.

Depending on that i will make a validation.

I try to make it with the dojo ajax get method but since is a different domain it will not work ( only on Explorer).

How I can make that call to the external domain and manage the answer.

the url will be something like this.

htt://my.socket:8080/?option1=1&option2=2.

It can be with ajax or just a java class.
 
Panagiotis Kalogeropoulos
Rancher
Posts: 99
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried using the java.net api? Particularly, the URL and URLConnection classes?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Panagiotis Kalogeropoulos wrote:Have you tried using the java.net api? Particularly, the URL and URLConnection classes?
And this answer has nothing to do with JavaScript.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jose Maestre wrote:
I have to make a function that have to make a get into a public url, it will return me a plain text wich.


Can you change the output to JSONP, than it will be easy to make it work in any browser.

Modern day browser support CORS which will let you make cross domain calls. If you have to support older browsers, you need to use a proxy on the same domain or the JSONP call I suggested above.

Eric
 
Panagiotis Kalogeropoulos
Rancher
Posts: 99
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And this answer has nothing to do with JavaScript.


Very true. I did not pay attention to the keyword "dojo" and thought that it referred to core java. Apologies to the topic starter if I mislead him with my answer.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic