logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by jpg on Fri 23 Nov 2001 in response to Creating servlets inside the Domino Designer

Get the executable: A SOLUTION

In orger to get the servlet jar without messing with temporary files, do the
following:


Create a new lotuscript agent in the database holding the servlets. Call it
getJar. Paste the following code in the initialize method, modify the aDir$ and
aPath$ variable to match your installation (write permission needed) and you're
done.


Call this agent from a browser:
http://yourServer/yourBase/getJar


Fill the notesID (get it in agent property), return and save the JAR...


--CUT-------------------------------------


On Error Goto trapError

Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim docCtx As NotesDocument
Dim item As Notesitem

Print "Domino Servlet Code Extractor v001 - JwH<br>"

aDir$="E:/lotus/domino/simu/data/domino/html"
aPath$="/"

Set docCtx = session.DocumentContext

ret%=Instr(docCtx.Request_Content(0),"=")

If(ret%<>0 And Len(docCtx.Request_Content(0))>ret%) Then

Set db = session.CurrentDatabase
Set doc = db.GetDocumentByID(Mid$(docCtx.Request_Content(0),ret%+1))

If ( Not(doc Is Nothing)) Then
Set item=doc.getfirstItem("$TITLE")
If ( Not(item Is Nothing)) Then
Dim object As NotesEmbeddedObject
Set object = doc.GetAttachment( "%%object%%.jar" )
If ( Not(object Is Nothing)) Then
object.extractfile(aDir$+aPath$+item.Text+".jar")
Print "Agent: <b>"+item.Text+"</b>,
<i>"+Cstr(object.filesize)+"</i> bytes written <a
href="+aPath$+item.Text+".jar>here</a>.<br>"
Else
Print "<b>"+Mid$(docCtx.Request_Content(0),ret%+1)+"</b>: ** Valid
NotesID, good agent, but not compiled ?"
End If
Else
Print "<b>"+Mid$(docCtx.Request_Content(0),ret%+1)+"</b>: ** Valid
NotesID, but not an agent ?"
End If
Else
Print "<b>"+Mid$(docCtx.Request_Content(0),ret%+1)+"</b>: ** Invalid
NotesID, >> Agent properties >> Last tab >> Last line
(NT0000XXXX)"
End If
End If


finito:
Print |<br><form action="getJar?openagent" method="post"
enctype="multiform/form-data">|
Print |<b>NotesID of Agent</b>:  NT<input type=text name=nid
size=8> (forget leading 0s)|
Print |</form>|
Print |<script>document.forms[0].nid.focus()</script>|

Exit Sub

trapError :
Print "<br>***Erreur ["+Cstr(Err)+"] " + Error + " at line: "+
Cstr(Erl) +"<br>"
Resume finito



--CUT-------------------------------------


Hope that helps
-jpg