GWT.getModuleBaseURL() returns an incorrect value - gwt

I am running a GWT application in development mode out of Glassfish 3.1.1 (launched with a -noserver argument).
When I call GWT.getModuleBaseURL(), the following URL is returned: http://localhost:8080/appName/appName/
The correct URL should be http://localhost:8080/appName/. I wonder what I did wrong, so that the application name is appended twice.
By the way, GWT.getHostPageBaseURL(); returns the correct URL.

Your comment is spot on - that is what getModuleBaseURL() does, it returns the path to inside the compiled module, where the generated JavaScript and images are stored. If you launch the app from the url http://localhost:8080/appName, that is the host page, but if you look in firebug or another inspector, you probably see a request for http://localhost:8080/appName/appName/appName.nocache.js which is the bootstrap JS file. It is the directory where that is contained that the module base url refers to.

Related

IONIC 4: How to call iOs file resource from custom script within app

Here is the situation:
Ionic 4: (cli-5.2.7)
XCode 10.3
We have a custom eReader that lives in our assets folder.
When we want to download an eBook from our server and read it, we download the file and save it using the Native File plugin.
When we start up the reader, we send it the container in which we want the reader to be created and built, and an internal url to the file resource we want to read.
After window.Ionic.WebView.convertFileSrc, the file ref looks like:
ionic://localhost/_app_file_/var/mobile/Containers/Data/Application/[APP-ID]/Library/NoCloud/[BOOK-ID]/vol-001-chapter-006.xhtml
The reader will then build the iframe and send a simple XMHttpRequest to the provided url, then place the resulting html into the iframe.
The problem is that it only works on first load of the eBook from our server
I can see the file being downloaded, and written to its own folder in the apps file system (File.dataDirectory).
When I debug the XMLHttpRequest in our eReader.js, I can see the call being made to the resource and the HTML returning to the request, which is then rendered on the page.
BUT, if I close the app, reopen it, and try to access the already-downloaded book, the XMLHttpRequest in our eReader.js returns nothing.
I can verify that the file exists at the resource location after a reload, but the XMLHttpRequest acts like it cannot find anything at the provided location.
AND, this is only on iOs. Android works as intended.
My questions is, what am I missing? Is this something to do with the iOs permissions or persistence?
Any help would be appreciated.

SAPUI5 load file in the workspace

I need to upload files in the Workspace:
I dont know which URL i should give as parameter to my file Uploader. Considering that i working with the SAP WebIDE personal Edition and my file are located in the following path:
file:///C:/SAPWebIDE/eclipse/serverworkspace/Al/ALine/OrionContent/testApp/webapp/model/
What should i please set as Url here?
var oFileUploader2 = new sap.ui.commons.FileUploader({
name: "upload2",
uploadOnChange: false,
uploadUrl: "???"
});
I think you have misunderstood how the FileUploader works.
The "uploadUrl" parameter should be used to specify a path on the "web server" (e.g. application server, web container) on which your application is hosted. UI5 is a web user interface framework, it does not know how to handle (server-side) upload requests. This means that the server (backend) itself should have some implementation for handing the file upload.
After you select the file and trigger the upload, a POST HTTP request is made to the path specified in this "uploadUrl" parameter. If you have no web server to know to handle it, then it will invariably give back an error HTTP response.
Based on the title of your question, I understand that you would want to upload the file inside your workspace. IMO, this does not really make sense (as you are mixing in the design time environment with your run-time environment (i.e. your application should never depend on the IDE).
Nevertheless, you can try and import a file via the import menu (right click on package, import, from file system) and see what URL is the request triggered against (using the dev console). I looked around a little and roughly this is the request URL: http://localhost:[Web IDE Port]/xfer/import/[User Name]-OrionContent/[Project Name]. In the Slug header you would have the file name. You might not be able to make a POST request towards this URL directly (because of XSS / CSS limitations), so you might need to create a route mapping for it.

text/html return from REST Service

I am returning text/html(MediaType.TEXT_HTML) from REST web service which I want to show in browser.
Return string from web Service Method=<html>
<body background=\"WEB-INF\\DSCN0651.JPG\">
<h1>Hello World!!!</h1>Visit W3Schools.com!
<audio autoplay><source src=\"WEB-INF\\Coolest_Sms_All_Time.mp3\" type="audio/mpeg"</audio>
</body></html>
The problem I am facing is the background = DSCN0651.JPG is not rendered in browser
The audio autoplay is not working as I am not able to hear sound in browser.
Though I am only able to see Hello World!!! and link www.w3schools.com! in browser after REST call.
I checked the deployment area both image and mp3 are deployed fine under WEB-INF folder
I am using IE/chrome browser to make a call to my WebService get method.
Please let me know what I am doing wrong.
To link images or audio (or whatever resource), you need to give a relative URL which the client browser can understand, by asking the server for that resource. If you have a webpage like the above at URL http://example.com/foo/bar, the browser will try to look up http://example.com/foo/bar/WEB-INF\DSCN0651.JPG, but that's an invalid URL. I suggest you check that by trying out the real URL yourself, and by seeing with Developer tools what the browser does with your page.
That URL is invalid at least because it uses a backward slash \ instead of a forward slash /. That's wrong in URLs.
Actually, what you're showing uses \" and \\, but those should appear only when you embed them as a string in source code, to represent respectively " and \. You might want to inspect the output to ensure that's correct.
Moreover, that URL contains WEB-INF. I assume you're using a Java application server. However, the content of the WEB-INF folder is handled specially by Java application servers — in fact, resources there are not accessible to the public! So you should probably move them elsewhere and update the path (the right place depends on what you're exactly doing). Probably moving them up, outside of WEB-INF, and updating the URLs already works.

Tomcat java servlet redirecting to wrong URL

I have a login servlet that is supposed to send a redirect to a specified url but instead I seem to be getting sent to an older version. I am using Tomcat 7 in eclipse and thinking it must be somewhere in the meta data that is screwie.
response.sendRedirect("../xyz/home.jsp");
but instead of going to xyz/home.jsp I am going to xyz1/home.jsp.
I had an old project called xyz1 which I then did a refracter to change the name to xyz. Now it seems that the login servlet keeps referring to xyz1/home.jsp. My other links are fine since I am using href and relative paths. I did a search through the meta-data to see if there was any older references to xyz1 and there were so I changed them and I also did a search in the server configuration files which I had also fixed. Not sure what other options there are.
Thanks,
-Tommy
Also the debugger is kind of useless since it goes through .class files that cant be read ...
I renamed xyz to be xyz1 and then just made a blank project called xyz. Only moved my source files and let the metadata fill in itself. I also made a new server just to be safe.

Associating a custom preview URL with a .cfm file in ColdFusion Builder (Eclipse)

In my usual ColdFusion directory layout all files are accessed via a controller called r.cfm that uses an include to pull in the actual .cfm file, so a file called "salaries.cfm" would be invoked via http://servername.com/r.cfm?name=salaries
In Eclipse with the ColdFusion extensions I could set the file properties so the default url for salaries.cfm would be http://localhost/r.cfm?name=salaries - when I ran the debugger that url would launch, not http://localhost/salaries.cfm - how do I set that up in the ColdFusion Bulder beta, the debug configuration is always non editable per file.
I have played around with server prefixes but that does not seem to do it.
Thanks for any tips
I don't think this is currently possible in CFBuilder -- as you said, this setting is not per-file. You could put in an Enhancement Request, though, if you wanted: https://bugbase.adobe.com