Controllers system

The request system by XML flow provided by Process internally uses the notion of controller. Visiativ Software offers this mechanism to perform treatments in authenticated mode.

The controllers run in a Process context. It is possible to recover, for example, information assigned to the connected user or any other information of the API objects.

Implementing a controller class

To develop a controller, you just have to create a Java class which extends the basic class named com.axemble.vdoc.sdk.controllers.BaseController.

Each controller is called by the navigation framework on the both following methods:

  • parseRequest : method receiving as parameter the IRequest object (representing the HTTP request);
  • doProcess : method enabling to run a treatment and to provide a response. This second receives as parameter the IExecutionContext object that has all the information assigned to the request execution context.

In this example are presented the access to the process module (WorkflowModule) and the recovering of the connected user context:

public class SimpleController extends BaseController {
	public void parseRequest( IRequest request ) throws IOException {}
	
	public IExecutionContext doProcess( IExecutionContext ec ) throws IOException {
		// retrieve the logged on user context
		IContext context = getWorkflowModule().getLoggedOnUserContext();
		return super.doProcess( ec );
	}
}

To reach the SimpleController controller you just have to build the following URL: /navigation/sdk?Controller=<package-name\>.SimpleController