Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Versioning RAP Javascript resources
Versioning RAP Javascript resources [message #1744617] Wed, 28 September 2016 23:37 Go to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
I'm just going through the headache of deploying RAP 3.1.0 to the same URL as a 2.3.2 application.

Although I can see rap-client.js now has it's URL versioned with the RAP version ( /rwt-resources/310/rap-client.js ) resources.js does not, it's always located at /rwt-resources/resources.js and nothing but purging the IE cache or Control-F5 would fix the problem.

I see that bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=439008 was logged because of caching issues with rap-client.js and resources.js, however only rap-client.js has been versioned.

What about all the other resources stored in /rwt-resources ?

I'm still investigating why the code in org.eclipse.equinox.http.servlet.internal.ResourceServlet.writeResource(HttpServletRequest, HttpServletResponse, String, URL) is causing a 304 response.
Re: Versioning RAP Javascript resources [message #1744628 is a reply to message #1744617] Thu, 29 September 2016 06:46 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
most (even all) resources in "rwt-resources" folder are not changed frequently. To my memories, we didn't change them since RAP 2.x. That's why, I consider resource folder versioning as not important. If you have a use case, where the resource versioning is important, please file an enhancement request.
Regards,
Ivan
Re: Versioning RAP Javascript resources [message #1744749 is a reply to message #1744628] Thu, 29 September 2016 21:35 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
The file rwt-resource/resources.js is generated at runtime. It's contents depend on what extension points register javascript files.

At a minimum, this should be versioned somehow. Perhaps the file name could be generated using a hash of it's contents? It shouldn't take much to do that in org.eclipse.rap.ui.internal.servlet.ResourceRegisterer.registerConcatenatedScript()
import java.util.zip.CRC32;
....
private void registerConcatenatedScript() {
	final CRC32 crc32 = new CRC32();
	final byte[] script = concatenatedScript.getContent();
	crc32.update(script);
	final long crc = crc32.getValue();
	application.addResource("/resources-" + crc + ".js", new ResourceLoader() {
		public InputStream getResourceAsStream(String resourceName) {
			return new ByteArrayInputStream(script);
		}
	});
	applicationContext.getStartupPage().addJsLibrary("rwt-resources/resources-" + crc + ".js");
}

[Updated on: Thu, 29 September 2016 21:46]

Report message to a moderator

Re: Versioning RAP Javascript resources [message #1744939 is a reply to message #1744749] Mon, 03 October 2016 07:41 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Chris,
could you please open an enhancement request about this.
Thanks.
Ivan
Re: Versioning RAP Javascript resources [message #1744987 is a reply to message #1744939] Mon, 03 October 2016 20:16 Go to previous message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=503150
Previous Topic:Building Maven artifacts
Next Topic:[ANN] RAP 3.1.1 Released
Goto Forum:
  


Current Time: Thu Apr 25 05:51:13 GMT 2024

Powered by FUDForum. Page generated in 0.04285 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top