-
30 Jul 2012 1:48 PM #1
url prefix not working
url prefix not working
I have a url prefix of http://localserver:8080/Projectname/
that is defined in the project settings.
that points to my java project, which resides in eclips/tomcat on my local development station.
I then have my ajax requests that I point to a java servlet. The servlets work at http://localserver:8080/projectname/servletname
when I use a url definition of 'ServletName', I get a server error of http://localserver:8080/projectname/...pp/ServletName path not found
when I use a url definition of '/ServletName', It bypases the projectname, and goes straight to the root of the tomcat server, and not /project/servletname.
I thought url prefix was supposed to prepend that string to the begginning of all server calls...?
why is this not working?
-
30 Jul 2012 2:20 PM #2
The prefix isn't prepended to url in the published code. So without the slash it's naturally going to look for the resource in relation to the current document location (app.html). If your data provider is in a different spot you have to hard code the complete url in the proxy's url field.
Interesting though, fetching data into a store from within Architect probably works since it does use the URL prefix to make the call.
-
30 Jul 2012 3:06 PM #3
To confirm, urlPrefix is a development time setting inside of Architect.
It tells Architect how to resolve your relative urls before the project has been placed on a webserver. Because Architect is an application and not a typical browser it doesn't have to abide by the standard restrictions of XHR re: cross domain.Aaron Conran
@aconran
Sencha Architect Development Team
-
31 Jul 2012 5:13 AM #4
so, my only option is to prepend /projectname to each url, so that the url definition looks like this:
url:'/projectname/servlet',
then when publishing, go back, and do a find/replace on the resulting .js files?
-
31 Jul 2012 5:48 AM #5
what I have done when getting data from an external app server is put the full URL to the service in the url....i.e. http://localhost:9000/engine/datastore
-
31 Jul 2012 8:25 AM #6
The intent is that you use relative or absolute urls in your project.
When the code is deployed to the server of your choice then where ever it resides is kind of like the urlPrefix.Aaron Conran
@aconran
Sencha Architect Development Team
-
31 Jul 2012 8:58 AM #7
so, if I click the deploy every time I save, option, would the entire prefix url get prepended to the url config on each ajax call?
I would just have to pick a different location to deploy to, correct?
-
31 Jul 2012 9:29 AM #8
No... your relative urls will continue to work as relative urls.
Maybe you should explain in further detail what your problem is because I don't understand it. Standard Ajax requests are almost always relative/absolute urls without the http(s)://domain.com portion of the url. This makes your code portable in that it can be deployed to various different places.Aaron Conran
@aconran
Sencha Architect Development Team
-
1 Aug 2012 10:46 AM #9
project settings
projectsettings.jpg
that is what I want prepended to url's
If I put an ajax url definition like this:
I get this:Code:Ext.Ajax.request({ url:'/AjaxUserTR1Interface', method: 'POST', params:{fn:'getsessionvar',key:'Authenticated'}, callback:function(opts,suss,resp){
path1.jpg
as expected, since using a forward slash in front of a url should go to the root of the site.
when I use this definition:
I get this:Code:Ext.Ajax.request({ url:'AjaxUserTR1Interface', method: 'POST', params:{fn:'getsessionvar',key:'Authenticated'}, callback:function(opts,suss,resp){
path2.jpg
that is the path that I think should be correct, but it is referencing from within the project...
I need this to work, no matter if the project is published to /Atlas/ajax/AtlasNav,
or to the root of the webserver http://server.com/ajax/AtlasNav
-
1 Aug 2012 10:54 AM #10
I'm going to use ../../ to fix this, however I would think this would be handled in architect, to prepend the prefix url to all requests...
not sure I understand what you were talking about earlier...
I am not deploying though, I am running the project out of the project's saved folder.


Reply With Quote