BBjJettyContextConfiguration::setErrorPageURI

Description

In BBj 19.01 and higher, this method sets the error page for the given error code to the given URI path.

Syntax

Return Value Method
void setErrorPageURI(String errorCode, String uri)

Parameters

Parameter Description
errorCode The error code.
uri The URI path to the error page.

Return Value

None.

Remarks

Changing the error pages for the context require it to be restarted. To do so, use BBjJettyContextController::restart.

The error pages can also be set 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::getErrorPageURI

BBjJettyContextConfiguration::setDefaultErrorPage

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