ATG 11.3 JAX-RS
API – FormHandlerExecutor
FormHandlerExecutor class invokes the form handler based on handle
method provided in constructor. Forwards are disabled and the request and
response are wrapped to capture any redirect response in the result instead.
Executor object can be created using the constructor
as below,
FormHandlerExecutor executor =
new FormHandlerExecutor(pFormHandlerPath,pHandleMethod);
Adding inputs to the executor.
executor.addInput(pParamName,pParamValue);
Execute the formhandler using
executor.execute();
As well in ootb have a method
to process the results.
executor.processFormHandlerResult(executor.execute());
This processFormHandlerResult
method process the results and if it has any form exception(s) it will create a
DropletException and add it to the error stack.
Example code for formHandlerExecutor
from CurrentUserRestResource class
@POST
@Path("/login")
...
public Map<String,
String> login(...) throws RestException ... {
...
try {
...
FormHandlerExecutor executor = new FormHandlerExecutor(this.getProfileFormHandlerPath(),
this.getLoginHandleMethod());
this.addInputsForLogin(executor, pLogin, pPassword);
executor.processFormHandlerResult(e.execute());
...
HashMap statusCode1 = new HashMap();
...
...
return statusCode;
} catch (...) {
...
}
}
protected void
addInputsForLogin(FormHandlerExecutor pExecutor, String pLogin, String pPassword)
throws ServletException {
pExecutor.addInput("value.login", pLogin);
pExecutor.addInput("value.password", pPassword);
}
API Doc URL for Ref : http://docs.oracle.com/cd/E69533_01/Platform.11-3/apidoc/atg/droplet/FormHandlerExecutor.html
Thanks.
good explanation Bala gaaru.
ReplyDeleteThanks and I have a swell provide: Who Repairs House Windows Near Me home renovation contractors near me
ReplyDelete