New Improved Version 1.1 of WebSession Class
Following Friday's post and the subsequent responses I decided to update my WebSession code to address the problem and make the Domino Directory a global object. In doing so I realised it's about time I made a new version of that class available for download.
When I originally made it available it was as part of the WQO Calendar thingy, which contained numerous other techniques and code sources. It worried me to think that the WebSession class itself could be over-looked so easily and its usefulness as a standalone piece of code could be neglected. It should be a self-contained download of its own.
So, I've created a new bare-bones copy of the database that contains nothing but the class and a demo of its use. It's in the sandbox and you can download it directly here.
It's been nice to see adoption of the concept from others in the community and part of what's changed in this version is based on suggestions I've received. If you're yet to look at the class or work out what use it is then you really should take a quick peak. This one class saves me so much time on a daily basis and has become an integral part of every database I now create.
Just a question: doesn't your FQDN property need some field on the Form to work like that? The CGI Variables are filled in agent context documents (caling an agent), but not when you are using them to serve docs in WQO Agents. That was at least my finding, when I tried to use a websesison class in such agents (template system): I had to add fields with the CGI Names to the webform (which otherwise had only one field visible to return the generated html).
Good point Jan. I'd assumed you'd all work that out, but I forgot to add the "CommonFields" subform, which contains all these CGI fields, and which I add to all forms.
I've updated the download database to include this subform now. Thanks for the pointer!
Thanks!
Default is set to No Access. Well, this puppy won't work in Notes 5 anyway, so not a big deal (if you have your own server).
Woops. Updated now. Thanks for letting me know Fabian.
@Fabian: R5 hit EOL in 2004 and EOS in 2005. The current version is Domino 8, with Domino 8.5 to be released later this year. I wouldn't spend too much time looking for new and exciting code written for R5 here -- or anywhere else.
Stan, you mis-read my posting big time, if you really thought, I was asking to make the download R5 compatible. :-)
I was just referring to the most simple, no-brainer method of opening a database you don't have access to: Full access administration. Not available in Notes 5 (or before).
Hi Jake,
Let Me.BaseURL = "http"+Replace(Me.document.HTTPS(0), "ON", "s")+"://"+Me.FQDN+"/"+Me.path
The HTTPS field will default to 'OFF' so you'll need:
If Me.document.HTTPS(0)="ON" Then
Let Me.BaseURL = "https"+"://"+Me.FQDN+"/"+Me.path
Else
Let Me.BaseURL = "http://"+Me.FQDN+"/"+Me.path
End If
Hi Alistair. Good point! Thanks for that. I've fixed the download copy by double Replacing:
Replace(Replace("ON","s"), "OFF","")
I much prefer less lines of code over "readability" 'o)
Jake
Thank you! This is very useful. Great code.
Jake, I've been using your web session class for ages. I love it.
I have made a couple of changes though that have improved performance. One was in the area of URL Encoding / Decoding. LS Is much slower than the native java methods for this, so I used LS2J to wrap the proper methods and you get a huge performance gain.
Public Function urlEncode(s As String) As String
Set Me.jses=New JAVASESSION()
Set Me.jclass=jses.GetClass("java/net/URLEncoder")
Set Me.jstring=jclass.CreateObject()
urlEncode = Me.jstring.encode(s,"UTF-8")
End Function
Public Function urlDecode(s As String) As String
Set Me.jses=New JAVASESSION()
Set Me.jclass=jses.GetClass("java/net/URLDecoder")
Set Me.jstring=jclass.CreateObject()
urlDecode = Me.jstring.decode(s,"UTF-8")
End Function
Similarly, if you wanted to use Base64 Decoding, LS is very slow for this but there are freely available java libraries that improve performance by a couple of orders of magnitude. That implementation is a bit more long winded so I'll leave it off here.