Generating URLs to model actions

In this topic ...

Generating a URL for an Action in the Current Model

Generating a URL for an Action in Another Model

Related Topics ...

Passing Arguments to a Method Via URL

We can generate the URL for actions in the current model or in another model by calling the getActionURL()  or getURLMapper().getURL() on the webAppAccess object.

To generate the URL for an action in the current model:

The following method call returns the URL for the "actionName" method in the current model:

webAppAccess.getActionURL("actionName");

The returned URL string has the form:

/appcontext/servletname/models/path/to/models/Action!actionName

For example: /MyApp/webengine/test/TestModel/Action!getCustomers

To generate the URL for another model:

The following method call returns the URL for the "GetCustomers" action in the "ModelName" model with the Northeast and Gold profiles explicitly applied to the model:

webAppAccess.getURLMapper().getURL("ModelName", "GetCustomers", "Region!Northeast$ServiceLevel!Gold", null);

Note: The last argument to the getURL() method is the transport protocol. We can also specify "http" or "https" to force the protocol type or we can specify "null" to use the default protocol for the model.

The returned URL string looks has a similar form to the one returned from getActionURL() except that it includes the specified profile information as shown below:

/MyApp/webengine/method/MethodTest2/Action!main/Profile!Region!Northeast$ServiceLevel!Gold