}
public void processReferrer(ItsNatServletRequest request, ItsNatServletResponse response)
{
ItsNatDocument itsNatDoc = request.getItsNatDocument();
HTMLDocument doc = (HTMLDocument)itsNatDoc.getDocument();
Element outElem = doc.getElementById("outId");
ItsNatDocument itsNatDocRef = request.getItsNatDocumentReferrer();
if (itsNatDocRef == null)
{
String msg = "There is no referrer. Adding markup to transport";
Element div = doc.createElement("div");
Text text = doc.createTextNode(msg);
div.appendChild(text);
doc.getBody().appendChild(div);
//outElem.appendChild(div);
Element h = doc.createElement("h3");
h.appendChild(doc.createTextNode("Markup Transported"));
outElem.appendChild(h);
Element link = doc.getElementById("testReloadId");
link.setAttribute("style",""); // Visible
}
else
{
synchronized(itsNatDocRef)
{
Document docRef = itsNatDocRef.getDocument();
String docNameRef = itsNatDocRef.getItsNatDocumentTemplate().getName();
if (docNameRef.equals("test_referrer_pull") || // Reload
docNameRef.equals("test_referrer_pull_next")) // Back button
{
Element outRefElem = docRef.getElementById("outId");
Node contentNode = ItsNatDOMUtil.extractChildren(outRefElem);
contentNode = doc.importNode(contentNode,true);
outElem.appendChild(contentNode);
if (docNameRef.equals("test_referrer_pull"))
{
// Reload
Element link1 = doc.getElementById("nextPageToTestBackButtonId");
link1.setAttribute("style",""); // Visible
Element link2 = doc.getElementById("closeButtonId");
link2.setAttribute("style",""); // Visible
}
else if (docNameRef.equals("test_referrer_pull_next"))
{
// Back button
Element link = doc.getElementById("closeButtonId");
link.setAttribute("style",""); // Visible
}
}
}
}