I really don't assume this, it's the way I'm going to use it.
In my application, the file is generated by a servlet that writes a
POJO into the file, as shown
response.setContentType("text/javascript");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-
check=0, pre-check=0");
response.setHeader("Pragma", "public");
StringBuilder sb = new StringBuilder();
sb.append("var mypojovar = {");
for (MyPojo myPojo : database.getMyPojoList())
sb.append("\n\t").append(myPojo.getId()).append(":
\"").append(myPojo.getName()).append("\",");
sb.deleteCharAt(sb.length() - 1);
sb.append("\n};");
response.getWriter().print(sb.toString());
response.getOutputStream().flush();
response.getOutputStream().close();
BTW, the mehod is easyly modificable to accetp different file and
variable/dictionary name
public DictionaryOnDemand(String url, String dname){
getJsFile(url);
dictionary = Dictionary.getDictionary(dname);
}
private native void getJsFile(String url) /*- {
var fileref = $doc.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", url);
} -*/;
The key in this behaviour is the 'text/javascript' content type of the
file
Oskar
On 30 nov, 15:04, bennyb <[EMAIL PROTECTED]> wrote:
> Why do you assume every javascript file would have a ".js" extension?
> Some files could be dynamically generated depending on querystring
> parameters so we might request ".php" or ".asp" files
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---