BBjJettyContextConfiguration::getErrorPageURI

Description

In BBj 19.01 and higher, this method returns the String value of the URI for the error page that will be shown for the given error code.

Syntax

Return Value Method
String getErrorPageURI(String errorCode)

Parameters

Parameter Description
errorCode The error code.

Return Value

this method returns the String value of the URI for the error page that will be shown for the given error code.

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::getErrorPages

BBjJettyContextConfiguration::setDefaultErrorPage

BBjJettyContextConfiguration::setErrorPageURI

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