Extending : Channel policy management and extension : Extending the ExtendHtmlPresentationHandler class
  
Extending the ExtendHtmlPresentationHandler class
The protected void prepareResponse(HttpServletResponse res, JSONObject response) throws IOException method is provided in the com.ibm.btt.cs.html.ExtendHtmlPresentationHandler class for extending the class to update the JSON string of the Web response page.
To extend the ExtendHtmlPresentationHandler class, complete the following steps:
1 Create the following extension class by extending the com.ibm.btt.cs.html.ExtendHtmlPresentationHandler class.
com.ibm.btt.application.op.fvt.v8107.BC010. MyExtendHtmlPresentationHandler
2 Override the protected void prepareResponse(HttpServletResponse res, JSONObject response) throws IOException method by using the following sample codes.
package com.ibm.btt.application.op.fvt.v8107.BC010;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ibm.btt.cs.html.ExtendHtmlPresentationHandler;
import com.ibm.json.java.JSONObject;
public class MyExtendHtmlPresentationHandler extends
ExtendHtmlPresentationHandler {

//Extension point: update the response page
protected void prepareResponse(HttpServletResponse res, JSONObject response) throws IOException{
String tempRes=response.toString().replaceAll("Account", "Banking Account");
//res.getWriter().print(response.toString());
//System.out.println("***********************888"+tempRes);
res.getWriter().print(tempRes);
}

}
3 In the btt.xml file, update the presentationHandler field in the html tag and remoteBTTApp tag.
The following codes show an example.
<kColl id="html">
<field id="encoding" value="UTF-8"/>
<field id="cookies" value="true"/>
...
<!--filed id="presentationHandler"
value="com.ibm.btt.cs.html.ExtendHtmlPresentationHandler" /--><field id="presentationHandler" value="com.ibm.btt.application.op.fvt.v8107.BC010.MyExtendHtmlPresentationHandler" />...
<kColl id="remoteBTTApp"
description="Channel Handler for remote BTT operation/flow calling">
<field id="encoding" value="UTF-8"/>
...
<field id="requestHandler" value="com.ibm.btt.cs.html.remote.RemoteRequestHandler"/>
<!--filed id="presentationHandler"
value="com.ibm.btt.cs.html.ExtendHtmlPresentationHandler" /--><field id="presentationHandler" value="com.ibm.btt.application.op.fvt.v8107.BC010.MyExtendHtmlPresentationHandler" /></kColl>
For sample codes for extending the ExtendHtmlPresentationHandler class, see Reference.
See also
Channel policy management and extension