BBjJettyContextConfiguration::getErrorPages

Description

In BBj 19.01 and higher, this method returns a BBjVector of Strings of all the error codes that have a defined error page.

Syntax

Return Value Method
BBjVector getErrorPages()

Parameters

None.

Return Value

This method returns a BBjVector of Strings of all the error codes that have a defined error page. To get the URI for each error code, use BBjJettyContextConfiguration::getErrorPageURI.

Remarks

The error pages are also shown in Enterprise Manger in the HTTP Error Pages settings, found by selecting Web > Context Configuration.

Example

declare BBjAPI api!
declare BBjAdmin admin!
declare BBjJettyServerConfiguration config!
declare BBjJettyContextConfiguration context!
declare BBjJettyServer server!
declare BBjJettyContextController controller!
context$ = "NewContext"

api! = BBjAPI()
admin! = api!.getAdmin("admin","admin123")
config! = admin!.getJettyServerConfig()
context! = config!.createCustomContext(context$)
context!.setDefaultErrorPage("https://basis.cloud")
rem The following URIs are placeholders and can be updated for viable pages.
context!.setErrorPageURI("404","https://page404.html")
context!.setErrorPageURI("500","https://page500.html")
config!.saveConfig()

server! = admin!.getJettyServer()
controller!=server!.getContext(context$)

if controller!.isStarted() then
    controller!.restart()
else
    controller!.start()
endif

print "Error pages:" + $0A$

if context!.getDefaultErrorPage() <> NULL()
  print "The default error page is: " + context!.getDefaultErrorPage()
else
  print "There is no default error page for: " + context$
endif

errors! = context!.getErrorPages()
if errors!.size() then
    for i = 0 to errors!.size()-1
        code$ = errors!.get(i)
        uri$ = context!.getErrorPageURI(code$)
        print "The error page for code " + code$ + " is: " + uri$
    next i
endif
Example Type: BBj

See Also

BBjAPI

BBjJettyContextConfiguration::getDefaultErrorPage

BBjJettyContextConfiguration::getErrorPageURI

BBjJettyContextConfiguration::setDefaultErrorPage

BBjJettyContextConfiguration::setErrorPageURI

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