4.13 :: File Downloads

Description


File downloads are created using standard WAPL links. By implementing a combination of techniques and tools available within Wapple Architect you can increase security and perform mobile device detection all driven by your own business logic.

This chapter aims to provide an overview of some strategies that can be used to deliver files including ringtones and java games. The priniciples can be applied to any file download.

Simple Example


..snip..
  1.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  2.   <head>
  3.   <title>Simple File Download</title>
  4.   </head>
  5.   <layout>
  6.   <row>
  7.   <cell>
  8.   <externalLink>
  9.   <label>Wapple Download</label>
  10.   <url>http://wapl.info/files/examples/files/wapple.jpg</url>
  11.   </externalLink>
  12.   </cell>
  13.   </row>
  14.   </layout>
  15.  </wapl>


The following features will be described in relation to file downloads:

  • Links

  • getMobileDevice() SOAP method

  • Rules

  • DRM

  • Security Considerations


Links


File downloads are created using WAPL externalLinks. The Links chapter contains more detailed examples.

getMobileDevice()


The getMobileDevice SOAP method not only identifies whether the device is a mobile one, but also returns the model and manufacturer of the device. This is particluarly useful when handling file compatibility within your own application's business logic.

For example, if you wish to deliver JAR files you will need to know the supported devices for each JAR file. Using the data returned in the getMobileDevice SOAP call you would be able to deliver the correct JAR file, if present, and display an appropriate message when no files are available. Responsibility for compatibility and any calculations are handled by your own system.

Rules


You can wrap Rules around your file download links to ensure that the device supports certain criteria.

For example, if you wish to deliver Java Games, you may want to test that Java is supported.
..snip..
  1.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  2.   <head>
  3.   <title>Simple File Download</title>
  4.   </head>
  5.   <layout>
  6.   <rule type="activation" criteria="java_enabled" condition="1">
  7.   <row>
  8.   <cell>
  9.   <externalLink>
  10.   <label>Download Game</label>
  11.   <url>http://wapl.info/files/examples/files/test.jar</url>
  12.   </externalLink>
  13.   </cell>
  14.   </row>
  15.   </rule>
  16.   </layout>
  17.  </wapl>

DRM


You may wish to protect your file downloads using DRM. As the content resides on your server and is managed by your application you can wrap your content using the appropriate DRM headers and use Rules to determine support for DRM. Your application logic can completely control the user experience depending upon the device's capabilities.

Security Considerations


Linking directly to a file is not secure. It is perfectly acceptable for public domain content, however, for purchased or licensed content you may wish to perform certain security checks. One technique is to mask the URL to the file so that it cannot be shared and a finite number of downloads can be controlled.

Here is an example using PHP and Sessions to retrieve the file details:
..snip..
  1.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  2.   <head>
  3.   <title>Simple File Download</title>
  4.   </head>
  5.   <layout>
  6.   <row>
  7.   <cell>
  8.   <externalLink>
  9.   <label>Wapple Download</label>
  10.   <url>https://wapl.info/downloads/getfile.php?PHPSESSID=374bJVC923grvfkhjsd&amp;cid=12334&amp;type=jpg</url>
  11.   </externalLink>
  12.   </cell>
  13.   </row>
  14.   </layout>
  15.  </wapl>

Contents