$!-----------------------------------------------------------------'f$verify(0) $! JAVA.COM $! $! DCL wrapper procedure for supporting Java classes as WASD scripts. $! This procedure resides in the same directory as the classes (scripts), so $! WASD_ROOT:[CGI-BIN] (CGI_BIN:) by default. $! Works in conjunction with the CGIplus class provided in CGIplus.java $! May require modification for local site Java environment. $! Class names must be all lower-case due to way WASD invokes the class file. $! $! 02-DEC-2014 MGD some overdue maintenance $! 24-NOV-2002 MGD WASD v8.1 directory restructure $! 05-MAR-2002 MGD increasing complexity (JDK 1.3.1) $! 03-SEP-1998 MGD changes for JDK 1.1.6 final release $! 09-DEC-1997 MGD initial, JDK1.1 beta kit $!---------------------------------------------------------------------------- $! $!(prepare either Java5 or Java6, depending on what we find installed) $ jsetup = f$edit(f$search("SYS$MANAGER:JAVA$150_SETUP.COM"),"COLLAPSE") $ if f$length(jsetup) .eq. 0 then jsetup = f$edit(f$search("SYS$MANAGER:JAVA$60_SETUP.COM"),"COLLAPSE") $ if f$length(jsetup) .eq. 0 $ then $ write sys$output "Status: 502" $ write sys$output "Content-type: text/html" $ write sys$output "" $ write sys$output "Neither Java5 or Java6 setups found!" $ exit $ endif $! $ if f$trnlnm("WASD_JAVA_DBUG") .nes. "" $ then $ write sys$output "Content-type: text/plain" $ write sys$output "" $ set verify $ @'jsetup' $ show symbol * $ show log /process $ else $ define sys$output nl: $ define sys$error nl: $ @'jsetup' $ deassign sys$output $ deassign sys$error $ endif $! $!(when called from a vanilla CGI environment outputs the Java version) $ if f$type(WWW_SCRIPT_NAME) .nes. "" $ then $ write sys$output "Status: 200" $ write sys$output "Content-type: text/plain" $ write sys$output "Script-Control: X-record0-mode=1" $ write sys$output "" $ java -version $ exit $ endif $! $!(include Java class directory in the local class path) $ if f$trnlnm("JAVA$CLASSPATH") .nes. "" $ then $ path = "" $ count = 0 $ classpath_loop: $ item = f$trnlnm("JAVA$CLASSPATH",,count) $ if item .eqs. "" then goto classpath_loop_end $ if path .nes. "" then path = path + "," $ path = path + item $ count = count + 1 $ goto classpath_loop $ classpath_loop_end: $ if path .nes. "" then path = path + "," $ if f$trnlnm("HT_JAVA_ROOT") .nes. "" $ then path = path + "ht_java_root:[java]" $ else path = path + "cgi-bin:[000000]" $ endif $ define/process/user JAVA$CLASSPATH 'path' $ else $ path = f$trnlnm("CLASSPATH") $ if path .nes. "" then path = path + ":.:" $ if f$trnlnm("HT_JAVA_ROOT") .nes. "" $ then path = path + "/ht_java_root/java/" $ else path = path + "/cgi-bin/" $ endif $ define /user CLASSPATH "''path'" $ endif $!(extract just the class file name from the full file path) $ class = f$edit(f$element(0,".",f$element(1,"]",p1)),"lowercase") $! $ dcgipluseof = f$trnlnm("CGIPLUSEOF") $ if dcgipluseof .nes. "" - then dcgipluseof = """-Dcgipluseof=" + dcgipluseof + """" $!(reading from System.in should give the standard CGI HTTP stream) $ define /user sys$input http$input $! $!(ok, here's the Java command) $ java 'dcgipluseof' 'class' $! $!(bit of tidying up) $ statuslognam = "JAVA$STATUS_" + f$getjpi("","PID") $ if f$trnlnm(statuslognam) then deassign /job 'statuslognam' $! $!----------------------------------------------------------------------------