So I'm sure a servlet would be "better strong faster" but do think its worth it in terms of deployment?
What I have is a page of html & javascript. As part of that page, I want to insert the body of a notes document. What I've done is to insert on the page where I want the inserted body to go, the following:
<script src='/mydatabase.nsf/testAgent?Openagent&id=232232434234234234234234'></script>
Now, testAgent is a java agent, that does a URL call to the document of the unid that matches "id". The way it calls that url, the body of the document is rendered with tags around it, so it can be easily stripped out by the java agent.
The java agent takes that html, applies URLEncode.encode() to it, then a String.replace('+', ' '), and finally returns it wrapped with:
document.write(unescape('" javas string "'));
What happens is slick as hell -- the java agents returns a dynamic javascript script, that has it print the html that makes up the rich text. Its way cooler than copying the rich text fields around because it doesn't bother with objects or graphics -- just the references to them. Its also cooler than pre-computing and saving the html, because the java agent can run as web user, and any embedded computed text in the document still fires.
Well, I like it.
So I know that it won't "SCALE" this way -- and I know I could make this into a servlet with little more than cut paste and an hour or two of banging my head on the desk.
But is it worth it? D6 serves this agent really damn fast already.
more thinking.... I doubt there's much real difference unless something gets added... [Comment]
Condering the load on the server.....
Either way, the second http call gets made, the second document gets rendered by the render engine, the string manipulation stuff within the agent fires. About the only real advantage in this case for the servlet would be the agent load process itself, since nothing is being cached.
If I were to track unids in a hashed index and say keep the html associated with them for some period of time -- or even better until some other call to the same servlet notified it that the document had been updated within domino, that would save some power on the server, but it ratchets up complexity.
Given that I want to distribute the template, calling on the server operator to load a servlet seems like a bit hassle without much payoff for most.
Comment Entry |
Please wait while your document is saved.