Pathinfo Providers
By default, the URL mapping processor will detect routes by looking at the CGI.PATH_INFO
variable, but you can override this and provide your own function. This feature can be useful to set flags for each request based on a URL and then clean or parse the URL to a more generic form to allow for simple route declarations. Uses may include internationalization (i18n) and supporting multiple experiences based on devices such as Desktop, Tablet, Mobile and TV.
To modify the URI used by the Routing Services before route detection occurs simply follow the convention of adding a function called pathInfoProvider()
to your application Router (config/Router.cfc
).
The pathInfoProvider()
function is responsible for returning the string used to match a route.
The Rewrite rules section has another useful example for a pathInfo provider
Last updated