In Gwt where the path of script(appName.gwt.js) which loads gwt app comes from? - eclipse

I have started Gwt last week. And I was trying to create application without using sample app. So initially i have typed following line in html file(Application Name-loginAppGwt, package- LoginAppGwt)
<script type="text/javascript" language="javascript" src="LoginAppGwt/LoginAppGwt.nocache.js"></script>
but it was not loading the gwt module. When i changed it to
<script type="text/javascript" language="javascript" src="loginAppGwt/loginAppGwt.nocache.js"></script>
It was working fine.
But in one of the application which i have created using sample application of gwt, there was written(application name- testingApp, packagename- test)
<script type="text/javascript" language="javascript" src="testingapp/testingapp.nocache.js"></script>
So , my doubt is where this name comes from like in my application loginAppGwt was correct but in sample application testingapp was correct??
Thanks in advance.

Module name can be manipulated via <module rename-to="newname">. Then the path would be newname/newname.nocache.js
Check if your example had something similar in it's module descriptor.
Update:
Loading of JS scripts is affected by filesystem case-sensitivity because scripts are loaded from files. However, GWT-RPC is handled by servlets and is always case sensitive. This is important because, GWT-RPC urls are prepended with package name which seems to be derived from first part of script name in a host file (I just tested this).
So while the main script would be loaded on case-insensitive filesystems regardless of the script name case, the GWT RPC would only work if package names are equal.

Related

EaselJS example code fixes

Anyone had trouble running the code samples provided with EaselJS 1.0.0? I tried running HelloWorld, it failed; but I found if I made the following two changes it seemed to work:
1) Body Onload
<body onload=init();> <!-- WORKS -->
<body onload="init();"> <!-- DOES NOT WORK -->
2) Script tag
<script src="easeljs-NEXT.js"></script> <!-- WORKS -->
<script src="../lib/easeljs.combined.js"></script> <!-- DOES NOT WORK -->
Fix #2 deserves a small explanation -- using search in Finder I find no file named easeljs.combined.js.
Maybe this will help the next person who dives into EaselJS sample code. Feel free to let me know if I'm missing something.
Required to wrap HTML in comments like this above? Preview suggested so.
I am suspicious that your first example doesn't work as shown. Do you have an example handy?
As for the second one, where are those scripts coming from? You would have had to manually include either/or. If you copied example code from GitHub, the lib/ folder lives outside the examples/ folder, so it has to be relatively referenced a directory up.

SAPUI5 creating, but not running preload files

I have set up the following bootstap, with data-sap-ui-preload set to "auto"
<!-- Bootstrap the UI5 core library -->
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-compatVersion="edge"
data-sap-ui-preload="auto"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-resourceroots='xxxxxxxxxxx'>
</script>
This creates a Component-preload.js file in all of my 3 separate apps.
Unfortunately, when I run it, the files aren't minified, and I can access the controller etc directly.
Has anyone else came across this issue?
if I understand correctly you are expecting that "data-sap-ui-preload" creates additional files and also minifies the code. Is that correct?
If i read the documentation correctly this is not what this parameter is used for.
If you are looking of ways on how to "minify" your could you should look into GruntJS. There is also a UI5 Grunt task runner that is used by SAP itself.

Is is possible to load .coffee script file to browser and execute?

I am trying to load coffee script inside a sample.coffee file along with the coffee-script.js file and perform some simple operations on the HTML. But i am not able to load the sample.coffee file.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="sample.coffee" type="text/coffeescript"></script>
<script src="coffee-script.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
Here is the coffeescript code inside sample.coffee
message = "Welcome to Coffeescript"
alert message
I referred the blog http://forgivingworm.wordpress.com/2010/09/27/running-coffeescript-in-browser/
I trying to run this in MVC4 project on .cshtml. So I am running under MS world.
I am not sure if this is possible or not? any insight into this would be greatly appreciated.
I am able to solve this issue by using the CoffeeSharp http://tomlokhorst.github.com/CoffeeSharp/ It gives handler for .coffee files also converts the coffeescript to javascript on the browser.
Also I am able to compile the coffeescript to javascript during the build event itself which solves deployment and performance related issues.
I dont think this will work like you tried it.
You will need something like requirejs and the coffeescript loader
at https://github.com/jrburke/require-cs.
However I would strongly discourage this and rather have it compiled before loading into the browser (require.js is encouraged though). You might find grunt.js helpful for "building" your app before deploying.
That html works fine for me. I used the coffee-script.js found here: https://cdn.rawgit.com/jashkenas/coffeescript/1.11.1/extras/coffee-script.js and my sample.coffee is:
x = ->
alert("hi")
x()
If you open the Javascript console, do you see any errors?

URL rewriting for Alias in webserver

I have two copy of our XYZ Application ( Test, Training). They are two different applications in websphere having two different datatbases. We usually tend to have one webserver per websphere application. Although I know we can have multiple webservers. In my webserver we have created a variable called LoginExternal as shown below which points to a physical folder with the same name in the application server.
Alias /LoginExternal //winxen90/LoginExternal$
We refer to the LoginExternal variable through our HTML as shown below.
<script type="text/javascript" language="JavaScript" src="/**LoginExternal**/Data/LoginAnnouncements.js"></script>
<script type="text/javascript" language="JavaScript" src="/**LoginExternal**/Data/LoginForms.js"></script>
href="JavaScript:LGNEXTUTILS_OpendExternalPage( '/LoginExternal/Pages/LoginAnnouncements.html' );">
The problem we are facing is that with this setup the two applications are forced to use data from one physical folder called LoginExternal because of the webserver alias. I am looking for a solution by which even if we have two physical folders LoginExternal1 , LoginExternal2 one for each application The HTML files from each application should refer to the correct LoginExternal folder. I am hoping we can achieve this by some form of URL rewriting.
Thanks for your help.
I was going to say that this might not be possible without using separate virtual hosts, but...
I think your Rewrite condition can compare the Referrer header against your two web applications' context roots.

GWT lifecycle - Deferred binding at runtime.What happens

Can someone explain what happens after the java code is converted to Javascript by the GWT compiler?
how will the compiled javascript reach the client browser and when does this happen.
Well from your server, you serve a html page which should contain a tag that points to your compiled javascript.
Example of what the script tag would look like
<script type="text/javascript" language="javascript" src="http://example.com/js/project/project.nocache.js"></script>
The GWT compiler generates output files as described here.
At a very high level. There is a very tiny loader file (the .nocache.) which you should include in a script tag in your page. This file's only job is to determine the correct compiled application code files to request from the server. This load happens asynchronously after the nocache script has loaded.