- The user clicks a link.
- The html code of the page is sent from the MI client’s Tomcat webserver to the Pocket Internet Explorer (IE). The delivery of html code – even if it is done locally on the device – is done via http.
- The Pocket Internet Explorer interprets the html code. If it finds a img tag, it sends a request to the local Tomcat (again via http) and it asks for the image file.
- Tomcat receives the request. It looks into the file system and if the requested image is there reads it with a FileInputStream.
- The image is sent via http to the IE.
- The IE renders the image and displays it.
So here we have some steps we can avoid: Instead of sending the file via http from one application to the other one on the same device, we let the IE read the image directly from the filesystem without the use of Tomcat. This will go faster and we will save very valuable memory. Example: Classic way:
Now Tomcat is not involved anymore and we save the http request/response cycle and the memory otherwise required by the FileInputStream. As you will most likely use JSPs to create your html pages it is easy to use a constant to point to your folder that contains the images. So it can be change in one single location if the path is changing. But enough for today, let’s get the Business in Motion!.