home mail me! syndication

overthinkings

by Ruben Daniels

Ondisk and Online connecting to the right service url

This is the first snippet i’m writing. Hopefully I’ll manage to get one up every week. A snippet is a really short post about something useful or interesting.

This time it’s about setting up your JPF (Javeline Platform) application in such a way that it’s easy to double click and open from your disk, but also still work online. Because online can be many places; i.e. the test server, acceptance server or the live server, it’s important that relative paths are used there. But locally an absolute path needs to be used.

Start by specifying everywhere in the application relative paths, in teleport but also using data instructions. Then in the appsettings element you can specify a baseurl for all relative paths used throughout your appliaction. Now the magic comes in when using dynamic properties using the { } syntax.

<j:appsettings baseurl="{jpf.host ? jpf.host + '/' : 'http://test.example.com/'}"/>

The baseurl is set based to jpf.host if it’s set (it’s not set for the file:// protocols), otherwise it uses the url to the test server. That’s all. I hope this will be helpful in your future projects.

—-

If you are new to Javeline Platform don’t hesitate to try it out. The new ajax.org website contains the downloads and reference guide which will get your started.

No comments yet »

Your comment

HTML-Tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>