PDA

View Full Version : The global url in web application



kyousuke
26 Sep 2011, 11:29 PM
How could I define a global url in my app and I could use url like 'xxx/xxxx.jsp' not 'http://localhost:port/xx/xxx/xxxx.jsp' when I load the data.
Thanks!!!

skirtle
27 Sep 2011, 2:51 AM
For the server with the same origin this will already work, so presumably your target server is from a different origin? Have you considered the security implications (and restrictions) for using a server that doesn't have the same origin? What type of request are you going to use to load the data (Ajax, JSONP, etc.)?

For Ajax requests you could use the beforerequest event to manipulate all URLs.

For proxies you could write a subclass of one of the standard proxies with your own buildUrl method. You could then use this custom proxy throughout your app.