|
Passage Server Development
Development
Demo
Java API
How To
|
|
|
Programming Concept |
HTTP Front-End Engine |
Java Content Engine and API |
Database Engine |
Data Presentation Engine |
|
Programming Concept
1. Client/Server architecture
Server-side programming language is Java.
Applications are based on Client/Server architecture, where the client is Internet Browser
and the server is Passage Server.
Structurally the server has four modules that work together:
- HTTP Front-End Engine
- Java Content Engine
- Database Engine
- Data Presentation Engine
2. Steps required:
- Creating applications
- Writing and compiling Java requests [.java/.class]
- Creating data sources and writing SQL requests [.sql]
- Creating users and assigning requests to users [if security is needed]
- Creating HTML pages
3. Application
Application is a collection of
- Java requests [.java/.class]
- SQL requests [.sql]
- Data sources [ODBC]
- Databases (Access, SQL Server, MySQL, Oracle Server, ...]
- Users
- HTML pages [.html]
- Data files [.txt, .pdf, .doc, .xls, ...]
- Image files [.jpg, .gif, .png, ...]
- Video files [.swf, .mov, .avi, .wmv, .mp4, ...]
4. Request
Request is a server-side executable code that
- implements business logic
- generates/prepares data
- sets output HTML page
Request can be either Java code [.java/.class] or SQL statement [.sql].
Java request can call other Java or SQL requests.
5. Upload/Download
Passage Server provides Application, Request and file [.html, .css, .jpg, ...] transfer functionality.
It is used for transfering Application components from one server to another. For example from development to production.
Request components, i.e. Java [.java/.class] or SQL [.sql], are stored in [requestname].req file.
Application components, i.e. Requests, HTML pages, Data Sources and Users are stored in [applicationname].app file.
Files *.app and *.req have JAR format, and are used by Passage Studio for upload/download.
6. Software
Typically you would use the following software
- Passage Studio for application development [creating Applications, Requests, Data Sources, Users]
- Java IDE or Notepad for writing Java requests
- Java IDE or command line for Java request compilation
- HTML editor or Notepad for wrinting HTML pages
- Internet browser for running applications
|
HTTP Front-End Engine
Passage Server accepts GET and POST http requests.
HTML link [GET]:
<a href="http://127.0.0.1/AppName/HelloWorld(param1,param2)">Hello World!</a>
HTML form [POST]:
<form method="post">
<input type="hidden" name="server_request" value="HelloWorld(param1,param2)">
<input type="submit" value="Hello World!">
</form>
ENCTYPE="multipart/form-data" is supported.
|
Java Content Engine and API
Request can be either Java code or SQL statement.
Typical Java Request
- takes parameters
- calls other Java or SQL Requests
- gets data from database, text files, ...
- processes data
- creates output table(s)
- puts processed data into output table(s)
- sets output HTML page
Typical SQL Request
- takes parameters
- gets/puts data from/to database
The following features make Passage Server Request code compact, fast, simple and easy to develop:
- Request is a compiled Java code
- Request does not generate HTML page, data presentation is done by the server outside of Request
- Request does not deal with Java exceptions, exceptions are handled by the server outside of Request
- Request does not deal with SQL language, instead it calls Requests written in SQL
- Request does not deal with SQL data sources, it does not create and delete data source connection each time when database access is needed,
instead it uses data source connection pool managed by the server
- Java API is simple, so it makes the balance between your Java business logic code and Java system code 99/1 %, which increases development productivity
For application development you use Passage Studio. For Java Request compilation you use any Java IDE or command line
javac -d . -classpath .;c:\...\ws.jar; *.java
Hello World!
HelloWorld.java
HelloWorldSQL.sql
HelloWorld.html
Passage Server Java API
|
Database Engine
For database access you create
- ODBC Data Source
- Passage Server Data Source with the same name
- SQL Request (SQL statement, data source and parameters)
Then Java Request calls SQL Request and processes data.
|
Data Presentation Engine
Request creates output table(s) with data and sets output HTML page. In order to put data from output table(s) to HTML page
the special data tags are used. The server replaces the tags with actual data at run time and sends HTML page to a browser.
The data tags make HTML page dynamic.
HTML, CSS, JavaScript, JQuery, and Ajax code can be used with no limitations.
#FIELD(tbl,row,col) |
Parameters: |
tbl - the output table number |
row - the output row number |
col - the output column number |
Returns: |
Content of table cell |
Example: |
#FIELD(2,5,10) |
#TABLE(tbl) |
Parameters: |
tbl - the output table number [0,1,2,...] |
Returns: |
HTML table rows <tr><td>...</td><td>...</td></tr> |
Example: |
<table class='...'> #TABLE(0) </table> |
#SELECT(tbl,col_value,col_show) |
Parameters: |
tbl - the output table number |
col_value - the output column number to be used for value <option value='***'>...</option> |
col_show - the output column number to be shown <option value='...'>***</option> |
Returns: |
HTML SELECT options |
Example: |
<select name='...' size='1' class='...'> #SELECT(0,0,1) </select> |
Hello World!
HelloWorld.java
HelloWorldSQL.sql
HelloWorld.html
Passage Server Java API
|
|