Server side redirect

We had a great get together yesterday at the Geek Meet and many technical discussions where taking place not to mention all new connections that where made. Extremely fun and very well organized by Johan Molin at E-Kakan.One small subject that came up where how to do a server side redirect from an agent. There are two ways to do this, I call them internal or external. If you want to redirect the web browser to another host, then you will go with the external solution that sends an 302 to the user.The internal way is completely transpararent to the user. Here are a code examples in java:

import lotus.domino.*;
public class JavaAgent extends AgentBase {
    public void NotesMain() {
        try {
            PrintWriter pw = getAgentOutput();
        catch(Exception e) {
  • Fredrik Stöckel

    Nice, and if you want to use POST as method?

  • Johan Känngård

    I have had big problems with internal redirects that sometimes works, sometimes not, and just gives some strange 500 server errors. I haven’t had time to look into the source of that problem though, it might exist a solution. Have you successfully used those internal redirects at all time?

  • Joche

    I have used redirects for over ten years. From the beginning mostly in $$return fields but the last years more and more in agents. It’s especially handy to use when the agent builds up a complex argument list that’s used for opening a web view.

    I have never had any problems with this.

  • Tomas Nielsen

    Johan, could it be the page you are redirecting to is causing the 500?

    Fredrik, do you mean having the redirect in $$Return?

  • Johan Känngård

    No, that was not the reason. But I guess I could try again, last time was in R5 :-P

  • Fredrik Stöckel

    Tomas, no i mean that I want the redirect METHOD to be a POST rather than a GET. But that was before I examined the http headers and how the redirect actually works.