~~Title: Analyzer factory~~
~~NOTRANS~~
~~NOPDF~~
The analyzer factory creates the default analyzers like:
* StartupAnalyzer
* LoginAnalyzer
* MenuAnalyzer
* WorkScreenAnalyzer
* ErrorAnalyzer
* DownloadUploadAnalyzer
Every analyzer handles the request from the mobile app and adds one or more responses like:
* StartupAnalyzer adds ApplicationMetaData
* LoginAnalyzer adds AuthenticationData (if connected) or LoginView (if not connected) and an optional InformationView (if not connected and change password was detected)
The project uses the DefaultAnalyzerFactory but it's possible to use your own factory. To change the default factory, simply set the init parameter in your deployment descriptor: **analyzerfactory**
Set a full qualified java class and be sure that your class extends **DefaultAnalyzerFactory**.
MobileServlet
com.sibvisions.rad.server.http.rest.ServerServlet
org.restlet.application
com.sibvisions.rad.server.http.rest.ApplicationAdapter
session-timeout
10
analyzerfactory
com.sibvisions.demo.MyAnalyzerFactory
MobileServlet
/services/mobile/*
In your own analyzer, simply override the specific method, e.g.
public LoginAnalyzer createLoginAnalyzer(CommandRouter pRouter, ApplicationRequest pRequest)
{
return MyLoginAnalyzer(pRouter, pRequest);
}
The analyzer itself could look like this example:
public class MyLoginAnalyzer extends LoginAnalyzer
{
protected MyLoginAnalyzer(ApplicationResource pResource, ApplicationRequest pRequest)
{
super(pResource, pRequest);
}
@Override
public void analyze(List pResponse) throws Throwable
{
super.analyze(pResponse);
//your code here
}
}