Kernel::WebApp::Controller::API::Role::ProvidesSimpleRedirect

NAME

Kernel::WebApp::Controller::API::Role::ProvidesSimpleRedirect – Provides redirects for legacy routes.

PUBLIC INTERFACE

Provides a simple way to define redirects for legacy URLs.

Endpoints just need to consume this role and provide a "RedirectPath()".

RedirectPath()

Consuming endpoints just have to provide a RedirectPath that will be used to construct the target path. It can have placeholders similar to the RequestPath; these will be populated with data from the URI or Query parameters.

See for example Kernel::WebApp::Controller::API::Frontend::Legacy::Redirects::CustomerTicketZoom:

    # Redirects to the customer ticket detail view with the value of the "TicketNumber" query parameter.
    sub RedirectPath { return '/external/ticket/number/:TicketNumber'; }

    # Query parameter placeholders are also supported:
    sub RedirectPath { return '/external/some/route?TicketNumber=:TicketNumber'; }
Scroll to Top