Manage Learn to apply best practices and optimize your operations.

Creating URL Redirects from the Web

If you've ever needed a way to allow developers access to create their own URL redirects from the Web, here's a quick and dirty solution.

I created a form that mirrors the mapping form in Domino Administrator. After authenticating, the developer has a drop down list of the servers in which they can create redirects. I use JavaScript to validate the fields and from an onClick event, I run an agent that creates a response doc to the server doc called "Mapping". I get a handle to the "WebConfigurations" view in the NAB and a handle to the server doc where I want to add the redirect.

In order for these changes to take effect, I created two program documents to stop and start HTTP overnight. Otherwise, the developer can contact me immediately to determine when I can stop/start HTTP.

Here are the parameters for the program documents:
Program name: nserver
Command line: -c "tell http quit"
Server to run on: <BR> Comments: quits http task </P> <P> Program name: nserver<BR> Command line: -c "load http"<BR> Server to run on: <Server Name><BR> Comments: starts http task </P> <P> Remember to enable the program and select a time to run each document. I found setting them to run within a minute of each other works best. </P> <BR><P> <PRE> Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim view As NotesView Dim doc As NotesDocument Dim redirectDoc As NotesDocument Dim webDoc As NotesDocument Set webDoc = session.documentcontext Set db = New NotesDatabase("","names.nsf") Set view = db.GetView("WebConfigurations") Set doc = view.GetDocumentByKey("<Server Name>") Set redirectDoc = db.CreateDocument Call redirectDoc.MakeResponse(doc) redirectDoc.Form = "Mapping" redirectDoc.ServerName = webDoc.ServerName(0) redirectDoc.MappingType = "3" 'URL -> Redirection URL redirectDoc.MapType = "Redirect" redirectDoc.Type = "Mapping" redirectDoc.RM_MapFrom = webDoc.MapFrom(0) 'incoming URL string redirectDoc.RM_MapTo = webDoc.MapTo(0) 'redirection URL string Call redirectDoc.Save(True,True) End Sub </PRE> </P></body></html>

Dig Deeper on Domino Resources - Part 3

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...