BBjspServletConfiguration (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 17.0 and higher, BBJSP Servlets can be programmatically configured though the AdminAPI.

This class is used to configure a BBjspServlet that will be automatically deployed within a BBjJettyContextConfiguration. The configuration comprises 3 elements.

  • MAPPING - configures how the servlet can be referenced

  • PROGRAM - the source file containing the servlet code

  • CLASS - the class within the source file

  • CONFIG - the BBj configuration file to use during execution

Creation

BBjAPI > BBjAdmin > BBjJettyServerConfiguration > BBjJettyContextConfiguration > BBjspServletConfiguration

The BBjspServletConfiguration is created through the following BBjJettyContextConfiguration methods:

Return Value

Method

BBjspServletConfiguration

addBBjspServlet(string classname, string mapping, string source)

BBjspServletConfiguration

addBBjspServlet(string classname, string mapping, string source, string config)

BBjspServletConfiguration

getBBjspServlet(string mapping)

Methods of BBjspServletConfiguration

Return Value

Method

void

addParam(string name, string value)

void

clearParams()

string

getClassName()

string

getConfig()

string

getMapping()

BBjVector

getParameterNames()

string

getParameter(string name)

string

getSourceName()

string

getTerminalAlias()

string

getUser()

string

getWorkingDir()

void

setConfig(string config)

void

setTerminalAlias(string alias)

void

setUser(string user)

void

setWorkingDir(string directory)

Example

declare BBjAPI api!
declare BBjAdmin admin!
declare BBjJettyServerConfiguration config!
declare BBjJettyContextConfiguration root!
declare BBjspServletConfiguration servletConfig!

api! = BBJAPI()
admin! = api!.getAdmin("admin","admin123")
config! = admin!.getJettyServerConfig()
root! = config!.getCustomContext("store")

vect! = root!.getBBjspServletMappings()

if (vect!.size()) then
    for i = 0 to vect!.size()-1
        mapping$ = vect!.get(i)
        servletConfig! = root!.getBBjspServlet(mapping$)
        print servletConfig!.getMapping() + " = " + servletConfig!.getSourceName() + "::" + servletConfig!.getClassName()

        str$ = servletConfig!.getWorkingDir()
        if str$ <> "" print " Working Directory:"+str$
        
        str$ = servletConfig!.getTerminalAlias()
        if str$ <> "" print " Terminal Alias:"+str$
        
        str$ = servletConfig!.getConfig()
        if str$ <> "" print " Config:"+str$
        
        str$ = servletConfig!.getUser()
        if str$ <> "" print " User Name:"+str$
        
        params! = servletConfig!.getParameterNames()
        if params!.size()
            for j = 0 to params!.size()-1
                paramName$ = params!.get(j)
                print " PARAM " + paramName$ + " = " + servletConfig!.getParameter(paramName$)
            next j
        endif
    next i
endif

See Also