Question
Pega 7 Engine API PublicAPI Interface openHTMLDoc Method
Method openHTMLDoc which is defined:
void openHTMLDoc()
This must be called before getting a stream that is a top-level document.
I wonder if the above method works like the method Show-HTML in PRPC activities?
As part of my research I'm trying to get the HTML contents of a URL. I was able to fetch the contents and save it in a Java String property, but I wonder if I can use this openHTMLDoc to display the contents of my property as a HTML page (in a new window preferably).
Any usage examples (of this method) or alternatives are welcome.
Thanks
Jose
Hello Jose,
There is no direct OOTB rules for your requirement but below activities can be useful for building the logic.
1) DisplayStream (Step#7)
2) ReloadHarness (Step#8)
============================================
Sample OOTB java code:
tools.putParamValue("pyDispatchStream", "true");
StringMap keys = new HashStringMap();
keys.putString("pxObjClass", "Rule-HTML-Section");
keys.putString("pyStreamName", tools
.getParamValue("streamName"));
tools.openHTMLDoc();
try {
ClipboardPage threadPage = tools.getThread()
.getThreadPage();
threadPage.putString("pyHTMLFrame", "");
String stream = tools.getStream(keys, myStepPage);
if (threadPage.containsKey("pxHTMLStream"))
oLog.alert("PEGA0031",
"Overwritten HTML stream", 0, 0, null,
null);
threadPage.putString("pxHTMLStream", stream);
threadPage.putString("pxHTMLStream", stream);
} finally {
tools.closeHTMLDoc();
}
============================================
Thanks,
Ravi Kumar.