I recently ran into SOP issues when deploying my app behind a reverse proxy, and figured out that the problem was that I was using absolute data paths when contacting the server.
However, when trying to change the paths in my datasources, I can't get it to work. I started out with absolute paths like so:
and this would successfully contact the server, as I wanted. Now, however, when trying to change the paths to relative ones, what I'm left with is:
I've tried specifying the resource without slashes, with only trailing slash, and with both starting and trailing slashes, but the only thing that happens is that my datasource tries to fetch data from the folder "resource" in the war directory, it's not making a call to my server as I would have expected.
My datasource looks like this:
The start of the error I get looks like so (and then it goes on to describing the directory "resource" in my war folder):
I can also say that using the relative data url when making manual calls to the server works just as it should, as shown below:
I am running Windows 7, latest versions of Chrome and Firefox, and a smartgwt build from about a month ago. Got any idea what I'm doing wrong? How can I get my datasource to understand that it needs to contact my server?
However, when trying to change the paths in my datasources, I can't get it to work. I started out with absolute paths like so:
Code:
this.setDataURL(GWT.getModuleBaseURL() + "resource");
Code:
this.setDataURL("/resource");
My datasource looks like this:
Code:
public class MyDataSource extends DataSource { private static final String FETCH_URL = "resource"; public MyDataSource() { this.setClientOnly(false); this.setDataFormat(DSDataFormat.JSON); DataSourceField idField = new DataSourceField("id", FieldType.TEXT, "Id"); this.setFields(idField); this.setDataURL(FETCH_URL); } }
Code:
13:05:10.808 [ERROR] [resource] 13:05:10.824:XRP6:WARN:DataSource:isc_MyDataSource_0:Error evaluating JSON: SyntaxError: illegal XML character, JSON text: <HTML><HEAD><TITLE>Directory: /resource/</TITLE></HEAD><BODY> <H1>Directory: /resource/</H1><TABLE BORDER=0><TR><TD><A HREF=/resource/../ ...
Code:
String url = URL.encode(FETCH_URL); RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); builder.sendRequest(null, new RequestCallback() //.. and so on... //
Comment