-
Notifications
You must be signed in to change notification settings - Fork 0
Sling Rendering Script Resolution
bartoszWesolowski edited this page May 7, 2020
·
4 revisions

Default error handling rendering script is located under /libs/sling/servlet/errorhandler. To implement custom error handlers this structure must be copied to /apps
** 4##/5## reponses**
When handling error code responses Sling uses the status code as request extension. So for 404 error code a file that matches 404 is looked up with resource type sling/servlet/errorhandler
Example handlers for error responses:
/apps/sling/servlet/errorhandler/404.html/apps/sling/servlet/errorhandler/500.jsp
Custom exception handler
- similar for custom status code handler - in this case exception class name is used as rendering script exception (supports exception hierarchy - if script for exception name is not found Sling will look for parent exceptions)
- a rendering script for method different than GET can be used - the method name must be included in script name, for example
componentName.POST.esp . - selectors can be used to change which rendering script will be used
- selectors can be used to display same content in a different way, for example Google Accelerated Mobile Pages selector
ampcan be introduce to render components in a friendly way