"Fossies" - the Fresh Open Source Software Archive

Member "grails-core-5.2.4/grails-docs/src/test/resources/docs/ref/Command Line/create-interceptor.html" (14 Sep 2022, 60103 Bytes) of package /linux/www/grails-core-5.2.4.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the grails-core-5.2.4.tar.gz project site itself.

(Quick Reference)

create-interceptor

Purpose

The create-interceptor command creates an interceptor and associated unit test for the given base name.

Examples

grails create-interceptor
grails create-interceptor Book
grails create-interceptor org.bookstore.book

Description

Creates a new interceptor with an empty before, after and afterView method definitions. The argument is optional, but if you don’t include it the command will ask you for the name of the interceptor.

A interceptor is responsible intercepting incoming web requests and performing actions such as authentication, logging and so on.

The name of the interceptor can include a Java package, such as org.bookstore in the final example above, but if one is not provided a default is used. So the second example will create the file grails-app/controllers/<appname>/BookInterceptor.groovy whereas the last one will create grails-app/controllers/org/bookstore/BookInterceptor.groovy directory. Note that the first letter of the interceptor name is always upper-cased when determining the class name.

If you want the command to default to a different package for interceptors, provide a value for grails.project.groupId in the runtime configuration.

Note that this command is just for convenience and you can also create interceptors in your favourite text editor or IDE if you choose.

Usage:

grails create-interceptor <<name>>