HTTP Requests
The application engine acts as a general service and is called by different http requests with query string parameters. For example the request /engine?service=classmanager:1234&cmd=insert&id=100 will insert a record with id 100 into the class identified by the number 1234. Usually, the application engine creates these request by itself, but you can also compose them yourself.
In some requests you may need to tell the application engine to execute a "follow-up" request on certain conditions, for example the successfully insert of a new record into the database. These follow-up request may be passed using the query string parameters. Some examples:
| succeeded | request to be made when the original request succeeded |
| failed | request to be made when the original request failed |
| source | request to be made when the user presses the "back button". Example: returning the search results. |
So let's say we want to show a predefined velocity page containing a confirmation message after the succesful insert of a newsletter application form. The request may look like this:
/engine?service=classmanager:1234&cmd=insert&32453=vanessa@gmail.com&succeeded=/myapp/thankyou.vm
This works fine but what if you also need to pass parameters to (in this case) the succeeded page? It is not allowed to use the question mark twice in a http request! Also, the ampersand cannot be used, because those parameters will then be considered to be part of the main request.
The solution is to replace the question mark and ampersand with their respective hexadecimal values. For the question mark this is %3F, the ampersand becomes %26. An example:
If your request is submitted by a form there is another solution. Just put the parameters containing the follow-up request(s) in a hidden variable. The browser will convert the value into the proper code itself. Here is a logon form as an example:
<form method="post" action="/engine?app=myapp&service=application&cmd=login">
<input type="hidden" name="failed" value="/myapp/loginpage.vm?result=notok">
<input type="text" name="loginname">
<input type="password name="password">
</form>