BBjAppServer::publish

Description

In BBj 12.00 and higher, this method publishes a BBjApplication to the BBjAppServer. This makes the application available to users through the web interface.

Syntax

Return Value Method
void publish(BBjApplication application)

Parameters

Parameter Description
application The BBjApplication to publish.

Return Value

None.

Example

This example publishes a BUI application named buisample. This example is meant to be run as a BBj program. Click here to download the zip file containing the required files to run this sample.

rem ' BBjAppServer::publish

app$ = "buisample"
admin! = bbjapi().getAdmin("admin","admin123")
appServer! = admin!.getWebAppServer()
appConfig! = appServer!.makeEmptyAppConfig()
icon! = fnStaticResource!(dsk("")+dir("")+app$+"icon.jpg","image/jpg")
appConfig!.setApplicationIcon(icon!)
appConfig!.setApplicationUserName("admin")
appConfig!.setBBjApplicationName("BUI Sample")
appConfig!.setClientPollInterval(50)
appConfig!.setConfigFile(dsk("")+dir("")+"config.bbx")
appConfig!.setInterpreterUser(System.getProperty("user.name"))
image! = fnStaticResource!(dsk("")+dir("")+app$+".jpg","image/jpg")
appConfig!.setLoadImage(image!)
args! = bbjapi().makeVector()
appConfig!.setProgramArguments(args!)
appConfig!.setProgramName(dsk("")+dir("")+app$+".src")
appConfig!.setQuiet(1)
appConfig!.setSessionTimeout(300)
appConfig!.setShowBrowserWarning(0)
appConfig!.setShowClientConfirmationDialog(1)
css! = fnStaticResource!(dsk("")+dir("")+app$+".css","text/css")
appConfig!.setStyleSheet(css!)
appConfig!.setTerminal("T0")
appConfig!.setWorkingDirectory(dsk("")+dir(""))

print "BBjAppConfig ",app$,":"
print "getApplicationIcon: ",appConfig!.getApplicationIcon()
print "getApplicationUserName: ",appConfig!.getApplicationUserName()
print "getBBjApplicationName: ",appConfig!.getBBjApplicationName()

rem 'print "getClasspathName:",appConfig!.getClasspathName()
rem 'print "getClientPollInterval:",appConfig!.getClientPollInterval()
print "getConfigFile:",appConfig!.getConfigFile()
print "getInterpreterUser: ",appConfig!.getInterpreterUser()
print "getLoadImage: ",appConfig!.getLoadImage()
print "getProgramName: ",appConfig!.getProgramName()

rem 'print "getProgramArguments: ",appConfig!.getProgramArguments()
rem 'print "getSessionTimeout:",appConfig!.getSessionTimeout()
rem 'print "getSessionTimeout:",appConfig!.getSessionTimeout()
rem 'print "getShowBrowserWarning: ",appConfig!.getShowBrowserWarning()

rem 'print "getShowClientConfirmationDialog: ",appConfig!.getShowClientConfirmationDialog()
print "getStyleSheet: ",appConfig!.getStyleSheet()
print "getTerminal: ",appConfig!.getTerminal()
print "getWorkingDirectory: ",appConfig!.getWorkingDirectory()

rem 'print "isQuiet: ",appConfig!.isQuiet()
application! = appConfig!.buildApplication(app$)
appServer!.unpublish(app$,err=*next)
appServer!.publish(application!)
print "Published ",app$
stop

def fnStaticResource!(filename$,mimetype$)
    iterator! = appServer!.getStaticResources().iterator()
    while iterator!.hasNext()
        resource! = iterator!.next()
        if resource!.getSourceFileName()<>filename$ then continue
        if resource!.getMimeType()<>mimetype$ then continue
        resource!.setSourceFileName(filename$)
        return resource!
    wend
    return appServer!.addStaticResource(filename$,mimetype$)
fnend

See Also

BBjAPI

BBjAppServer

BBjAppServer::unpublish

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.