Version 4 (modified by 13 years ago) (diff) | ,
---|
FrontController design
How to
The FrontController takes proper care of security and database connections and is highly recommended. In order to map your application services now, you must specify them in your .properties file under 'services'.
- An example of a 'most minimal' mapping of just the basic GUI plus file serving can be found here: http://www.molgenis.org/svn/molgenis_apps/trunk/apps/designgg/org/molgenis/designgg/designgg.properties.
- A more advanced mapping which includes the XREF service (for the Ajax dropdown boxes) can be found here: http://www.molgenis.org/svn/molgenis_apps/trunk/apps/animaldb/org/molgenis/animaldb/animaldb.properties.
- This example includes the mapping to the Captcha service which you need to use the User Registration form. (org.molgenis.auth.service.MolgenisCaptchaService)
- Many API's have also been ported, an example of this can be found here: http://www.molgenis.org/svn/molgenis_apps/trunk/apps/xgap/org/molgenis/xgap/xqtlworkbench/xqtl.properties.
Notice that you should map the file service (core.servlets.FileService?@/) last because the mapping is fall-through. If you experience any problems, please contact a core developer. When in dire need, you can still use the 'WWWServerDeprecated' version to get the old behaviour back. (for now)
Request/response database usage (pseudocode)
Flow in time | Layer | Layer | Layer | Who |
Context | Session | Request | ||
Once: | DataSource(ConnPool=100) or EntityManagerFactory() | FC init() | ||
Begin | <- HttpRequest | User | ||
.. | <- CreateDatabase(Conn=1) or CreateDatabase(EntMan) | FC | ||
.. | Subsequent requests: getDatabase, reuse existing connectionless db | FC | ||
.. | GetConnection(1) or GetEntityManager() | FC | ||
.. | Open 1 connection, ConnPool-1 | FC | ||
.. | new Database(connection) -> | FC | ||
.. | Database (with credentials and 1 conn) | FC | ||
.. | Response = Service.handleRequest() | Application service | ||
.. | Close connection, ConnPool+1 | FC | ||
.. | Send response -> | FC | ||
End | Get response | User |