SearchSearch   

Ajax call in Javascript to request on same server but diff..

 
   Webmaster Forums (Home) -> Javascript RSS
Next:  Exception when creating another object  
Author Message
Jimmy

External


Since: Aug 03, 2007
Posts: 7



(Msg. 1) Posted: Sun Aug 12, 2007 11:47 am
Post subject: Ajax call in Javascript to request on same server but different port
Archived from groups: comp>lang>javascript (more info?)

Assuming there're 2 different instances of Tomcat.

e.g.
Tomcat #1 runs on http://localhost:10001/webapp1
Tomcat #2 runs on http://localhost:10002/webapp2

If there's Javascript in JSP which runs in webpp1 contains the
following ...
AjaxAnywhere.getAJAX("http://localhost:10002/webapp2",
"zoneInJsp1Webapp1");

Is there a way to make this work? Or if there's a better to do
it? ... preferably to do it right in Javascript (in JSP of webapp1 in
Tomcat #1) ... knowing there's a security concern here but in theory,
they are still using the same domain but just different port.

Thanks,
Jimmy
Back to top
Thomas 'PointedEars' Lahn

External


Since: Sep 05, 2004
Posts: 3405



(Msg. 2) Posted: Sun Aug 12, 2007 7:19 pm
Post subject: Re: Ajax call in Javascript to request on same server but different
Archived from groups: per prev. post (more info?)

Jimmy wrote:
> Assuming there're 2 different instances of Tomcat.
>
> e.g.
> Tomcat #1 runs on http://localhost:10001/webapp1
> Tomcat #2 runs on http://localhost:10002/webapp2
>
> If there's Javascript in JSP which runs in webpp1 contains the
> following ...
> AjaxAnywhere.getAJAX("http://localhost:10002/webapp2",
> "zoneInJsp1Webapp1");
>
> Is there a way to make this work?

Use

AjaxAnywhere.getAJAX("http://localhost:10001/webapp2",
"zoneInJsp1Webapp1");

and http://tuckey.org/urlrewrite/


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Back to top
Jimmy

External


Since: Aug 03, 2007
Posts: 7



(Msg. 3) Posted: Sun Aug 12, 2007 8:15 pm
Post subject: Re: Ajax call in Javascript to request on same server but different port
Archived from groups: per prev. post (more info?)

Instead of ...
AjaxAnywhere.getAJAX("http://localhost:10001/webapp2",
"zoneInJsp1Webapp1");

It should be ...
AjaxAnywhere.getAJAX("http://localhost:10002/webapp2",
"zoneInJsp1Webapp1"); // didn't actually send request to webapp2

webapp2 is running in different instance of Tomcat (different port on
localhost) than webapp1.

How come different port on the same domain doesn't work?

Thanks,
Jimmy
Back to top
Thomas 'PointedEars' Lahn

External


Since: Sep 05, 2004
Posts: 3405



(Msg. 4) Posted: Mon Aug 13, 2007 8:55 am
Post subject: Re: Ajax call in Javascript to request on same server but different
Archived from groups: per prev. post (more info?)

Jimmy wrote:
> Instead of ...
> AjaxAnywhere.getAJAX("http://localhost:10001/webapp2",
> "zoneInJsp1Webapp1");
>
> It should be ...
> AjaxAnywhere.getAJAX("http://localhost:10002/webapp2",
> "zoneInJsp1Webapp1"); // didn't actually send request to webapp2

No, it should not. I wrote what I wrote on purpose.

> webapp2 is running in different instance of Tomcat (different port on
> localhost) than webapp1.

Which is what matters. However, URL rewrite allows you to access a resource
with another port (or protocol, host name, or path) than the retrieved
resource is usually available at.

> How come different port on the same domain doesn't work?

It is all the same problem. The Same Origin Policy imposes that protocol,
second-level domain (and, it appears, with XHR even the host name as
document.domain has no meaning for that), and port number of the request URI
be the same to grant access from one resource to another. I (and others)
have explained that (to you) numerous times before. RTFFAQ.[1]

As I have explained and made a polite request to you repeatedly that you
quote the relevant parts of what you are replying to, as I (and others) have
demonstrated to you numerous times now. I will not ask you again.


PointedEars
___________
[1] http://jibbering.com/faq/
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Back to top
Display posts from previous:   
       Webmaster Forums (Home) -> Javascript
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum