BBjJettyContextConfiguration::getDefaultErrorPage

Description

In BBj 19.01 and higher, this method gets the default error page for the context that will be displayed if an error occurs.

Syntax

Return Value Method
String getDefaultErrorPage()

Parameters

None.

Return Value

Returns a String denoting the URI path to the error page set for the context.

Remarks

The default error page is 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::getErrorPages

BBjJettyContextConfiguration::getErrorPageURI

BBjJettyContextConfiguration::setDefaultErrorPage

BBjJettyContextConfiguration::setErrorPageURI

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