{"id":41835,"date":"2016-11-11T15:44:34","date_gmt":"2016-11-11T10:14:34","guid":{"rendered":"https:\/\/2thenew.online\/blog\/?p=41835"},"modified":"2016-12-19T15:04:04","modified_gmt":"2016-12-19T09:34:04","slug":"grails-3-migrating-from-filters-to-interceptors","status":"publish","type":"post","link":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/","title":{"rendered":"Grails 3 &#8211; Migrating from Filters to Interceptors"},"content":{"rendered":"<p>Grails 3 comes with lots of new features and performance improvements, one\u00a0of them being\u00a0Interceptors which is a kind of a replacement for Filters from earlier versions of <a title=\"Grails Development\" href=\"https:\/\/2thenew.online\/grails-application-development\" target=\"_blank\">Grails<\/a>.<\/p>\n<p>Filters are used to apply logic across the\u00a0whole group of Controllers, URI, or to a particular action and are used in most of the\u00a0Grails projects.<\/p>\n<p>Though, you can still have filters in Grails 3 by adding the plugin and making few tweaks(footnote), but I would recommend moving to Interceptors as it offers a number of benefits over filters. One such benefit is including support for CompileStatic\u00a0which is critical from the performance perspective because an Interceptor is\u00a0executed for every request. Another advantage is flexible configurability. For example &#8211; an Interceptor may define a property by name which matches the configuration in\u00a0application.yml.<\/p>\n<p>So now, let see how we can create an Interceptor in Grails 3:<\/p>\n<p>[sourcecode language=&#8221;shell&#8221;]<br \/>\n    grails create-interceptor DemoInterceptor<br \/>\n[\/sourcecode]<\/p>\n<p>The above command\u00a0will create a groovy class in grails-app\/controller\/interceptorBlog\/DemoInterceptor.groovy.<\/p>\n<p>Similar to filters, interceptors contain code which will be applied to requests before and after calling controller actions. Following is a sample code of <em>DemoInterceptor<\/em>:<\/p>\n<p>[sourcecode language=&#8221;groovy&#8221;]<br \/>\npackage interceptorBlog<\/p>\n<p>class DemoInterceptor {<\/p>\n<p>    boolean before() { true }<\/p>\n<p>    boolean after() { true }<\/p>\n<p>    void afterView() {<br \/>\n      \/\/ no-op<br \/>\n    }<br \/>\n}<\/p>\n<p>[\/sourcecode]<\/p>\n<ul>\n<li>By default, the interceptor will match the controller with the\u00a0same name such as &#8211; DemoInterceptor that will match every request with DemoController.<\/li>\n<li>If the\u00a0method before and after return true the processing continues, further processing of the\u00a0request is ignored.<\/li>\n<li>The afterView\u00a0method is executed after view rendering completes. If an exception occurs, the exception is available using the throwable property.<\/li>\n<\/ul>\n<p>Now, that we understand interceptors a little bit, let&#8217;s see how we can replace existing Filters with Interceptors.<\/p>\n<h3>Creating an Interceptor which should log every request<\/h3>\n<p><a title=\"Grails migration\" href=\"https:\/\/2thenew.online\/blog\/traits-provided-by-grails-3\/\" target=\"_blank\">Grails 3 takes advantage of traits<\/a>,\u00a0a powerful feature of Groovy. All Interceptors implements grails.artefact.Interceptor trait, which provides access to common properties and methods such as &#8211; grailsApplication, params, session, request, render redirect etc and match, matchAll methods which come\u00a0handy while we need to match requests based on patterns or all requests. So, following will be the code inside our Interceptor:<\/p>\n<p>[sourcecode language=&#8221;groovy&#8221;]<br \/>\npackage interceptorBlog<\/p>\n<p>class LogInterceptor {<\/p>\n<p>    LogInterceptor() {<br \/>\n        matchAll()<br \/>\n    }<\/p>\n<p>    boolean before() {<br \/>\n        log.info(&quot;INCOMING REQUEST: ${params.toString()}&quot;)<br \/>\n        true<br \/>\n    }<\/p>\n<p>    boolean after() { true }<\/p>\n<p>    void afterView() {<br \/>\n        \/\/ no-op<br \/>\n    }<br \/>\n}<br \/>\n[\/sourcecode]<\/p>\n<p><strong>Note<\/strong>\u00a0that the default logger name for an interceptor is grails.app.controllers\u00a0so you also need to configure logging in\u00a0logback.groovy as:<\/p>\n<p>[sourcecode language=&#8221;groovy&#8221;]<br \/>\n    logger(&quot;grails.app.controllers.interceptorBlog.LogInterceptor&quot;, INFO, [&#8216;STDOUT&#8217;], false)<br \/>\n[\/sourcecode]<\/p>\n<h3>Create an Interceptor to authenticate my REST call for a valid token<\/h3>\n<p>Here we need to match every request except for AuthController against a valid token. If a\u00a0token is valid then continues processing, otherwise respond 401. So, the\u00a0following is the code for interceptor.<\/p>\n<p>[sourcecode language=&#8221;groovy&#8221;]<br \/>\npackage demo<\/p>\n<p>import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED<\/p>\n<p>class RestInterceptor {<\/p>\n<p>    RestInterceptor() {<br \/>\n        matchAll()<br \/>\n          .excludes(controller: &#8216;auth&#8217;)<br \/>\n    }<\/p>\n<p>    boolean before() {<br \/>\n        String token = session.token ?: request.getHeader(&#8216;token&#8217;)<br \/>\n        if(!token) { \/\/ Please note you could also have your own custom validation logic here<br \/>\n            response.status = SC_UNAUTHORIZED<br \/>\n            return false<br \/>\n        }<br \/>\n        true<br \/>\n    }<\/p>\n<p>    boolean after() { true }<\/p>\n<p>    void afterView() {<br \/>\n        \/\/ no-op<br \/>\n    }<br \/>\n}<br \/>\n[\/sourcecode]<\/p>\n<ul>\n<li>The matchAll\u00a0method defined in <a title=\"Interceptor API\" href=\"http:\/\/docs.grails.org\/3.2.2\/api\/grails\/artefact\/Interceptor.html\">Interceptor API<\/a>, returns the <a title=\"Matcher\" href=\"http:\/\/docs.grails.org\/3.2.2\/api\/grails\/interceptors\/Matcher.html\">Matcher<\/a> instance which can be used to configure how Interceptor matches the request.<\/li>\n<\/ul>\n<h3>I used to authenticate on beforeInterceptor method on older Grails versions, How to do it in Grails 3?.<\/h3>\n<p>As you already know that Before and after interceptors were removed. So all beforeInterceptor and afterInterceptor\u00a0need to be replaced by Stand alone interceptors. For example, the following would not work anymore:<\/p>\n<p>[sourcecode language=&#8221;groovy&#8221;]<br \/>\npackage interceptorBlog<\/p>\n<p>class UserController {<br \/>\n    def beforeInterceptor = [action: this.&amp;auth, except: &#8216;login&#8217;]<\/p>\n<p>    private auth() {<br \/>\n        if (!session.user) {<br \/>\n            redirect(action: &#8216;login&#8217;)<br \/>\n            return false<br \/>\n        }<br \/>\n    }<br \/>\n    def login() {<br \/>\n        \/\/ display login page<br \/>\n    }<br \/>\n}<br \/>\n[\/sourcecode]<\/p>\n<p>Similar functionality in Grails 3 can be achieved by creating a new Interceptor named <em>UserInterceptor.groovy<\/em> as follows:<\/p>\n<p>[sourcecode language=&#8221;groovy&#8221;]<br \/>\npackage interceptorblog<\/p>\n<p>class UserInterceptor {<\/p>\n<p>    UserInterceptor() {<br \/>\n        match(controller: &quot;user&quot;, action: &quot;*&quot;)<br \/>\n                .except(action: &quot;login&quot;)<br \/>\n    }<\/p>\n<p>    boolean before() {<br \/>\n        if (!session.user) {<br \/>\n            redirect(action: &#8216;login&#8217;)<br \/>\n            return false<br \/>\n        }<br \/>\n        true<br \/>\n    }<\/p>\n<p>    boolean after() { true }<\/p>\n<p>    void afterView() {<br \/>\n        \/\/ no-op<br \/>\n    }<br \/>\n}<br \/>\n[\/sourcecode]<\/p>\n<p>To read more about Interceptors please go to Grails Documentation.<\/p>\n<p>If you still feel the need to continue with Filters in Grails 3, there is separate plugin available and you can use it by simply adding following as dependency in your\u00a0build.gradle.<\/p>\n<p>[sourcecode language=&#8221;groovy&#8221;]<br \/>\n  compile &#8216;org.grails:grails-plugin-filters:3.0.12&#8217;<br \/>\n[\/sourcecode]<\/p>\n<p><strong>Please note<\/strong> that you need to move filters out from grails-app\/conf directory to any other source directory such as grails-app\/controllers\u00a0folder as grails-app\/conf\u00a0is not considered as source directory anymore.<\/p>\n<p>Hope it helps.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Grails 3 comes with lots of new features and performance improvements, one\u00a0of them being\u00a0Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the\u00a0whole group of Controllers, URI, or to a particular action and are used in most of the\u00a0Grails projects. Though, you [&hellip;]<\/p>\n","protected":false},"author":57,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":74,"footnotes":""},"categories":[7,1],"tags":[4840,3219,4180,4183,4182,4181,1855],"class_list":["post-41835","post","type-post","status-publish","format-standard","hentry","category-grails","category-technology","tag-grails","tag-grails-3","tag-grails-3-migrationg-filters-to-interceptors","tag-grails-developer","tag-grails-migration","tag-grails-projects","tag-new-in-grails-3-0"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Grails 3 comes with lots of new features and performance improvements, one of them being Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the whole group of Controllers, URI, or to a particular action and are used in most of the Grails projects. Though, you\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Puneet Behl\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Grails 3 \u2013 Migrating from Filters to Interceptors | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Grails 3 comes with lots of new features and performance improvements, one of them being Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the whole group of Controllers, URI, or to a particular action and are used in most of the Grails projects. Though, you\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Grails 3 \u2013 Migrating from Filters to Interceptors | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Grails 3 comes with lots of new features and performance improvements, one of them being Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the whole group of Controllers, URI, or to a particular action and are used in most of the Grails projects. Though, you\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#article\",\"name\":\"Grails 3 \\u2013 Migrating from Filters to Interceptors | TO THE NEW Blog\",\"headline\":\"Grails 3 &#8211; Migrating from Filters to Interceptors\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/puneet-behl\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2016-11-11T15:44:34+05:30\",\"dateModified\":\"2016-12-19T15:04:04+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#webpage\"},\"articleSection\":\"Grails, Technology, Grails, Grails 3, Grails 3 migrationg Filters to Interceptors, grails developer, grails migration, Grails projects, new in Grails 3.0\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#listItem\",\"name\":\"Grails 3 &#8211; Migrating from Filters to Interceptors\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#listItem\",\"position\":3,\"name\":\"Grails 3 &#8211; Migrating from Filters to Interceptors\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/puneet-behl\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/puneet-behl\\\/\",\"name\":\"Puneet Behl\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/9b6468fa-13e0-4dbc-8a73-9fa9d1ecf84e_puneet.behl@tothenew.com.jpg\",\"width\":96,\"height\":96,\"caption\":\"Puneet Behl\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/\",\"name\":\"Grails 3 \\u2013 Migrating from Filters to Interceptors | TO THE NEW Blog\",\"description\":\"Grails 3 comes with lots of new features and performance improvements, one of them being Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the whole group of Controllers, URI, or to a particular action and are used in most of the Grails projects. Though, you\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-3-migrating-from-filters-to-interceptors\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/puneet-behl\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/puneet-behl\\\/#author\"},\"datePublished\":\"2016-11-11T15:44:34+05:30\",\"dateModified\":\"2016-12-19T15:04:04+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Grails 3 \u2013 Migrating from Filters to Interceptors | TO THE NEW Blog","description":"Grails 3 comes with lots of new features and performance improvements, one of them being Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the whole group of Controllers, URI, or to a particular action and are used in most of the Grails projects. Though, you","canonical_url":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#article","name":"Grails 3 \u2013 Migrating from Filters to Interceptors | TO THE NEW Blog","headline":"Grails 3 &#8211; Migrating from Filters to Interceptors","author":{"@id":"https:\/\/2thenew.online\/blog\/author\/puneet-behl\/#author"},"publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"},"datePublished":"2016-11-11T15:44:34+05:30","dateModified":"2016-12-19T15:04:04+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#webpage"},"articleSection":"Grails, Technology, Grails, Grails 3, Grails 3 migrationg Filters to Interceptors, grails developer, grails migration, Grails projects, new in Grails 3.0"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.online\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.online\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#listItem","name":"Grails 3 &#8211; Migrating from Filters to Interceptors"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#listItem","position":3,"name":"Grails 3 &#8211; Migrating from Filters to Interceptors","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.online\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.online\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.online\/blog\/author\/puneet-behl\/#author","url":"https:\/\/2thenew.online\/blog\/author\/puneet-behl\/","name":"Puneet Behl","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/9b6468fa-13e0-4dbc-8a73-9fa9d1ecf84e_puneet.behl@tothenew.com.jpg","width":96,"height":96,"caption":"Puneet Behl"}},{"@type":"WebPage","@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#webpage","url":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/","name":"Grails 3 \u2013 Migrating from Filters to Interceptors | TO THE NEW Blog","description":"Grails 3 comes with lots of new features and performance improvements, one of them being Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the whole group of Controllers, URI, or to a particular action and are used in most of the Grails projects. Though, you","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.online\/blog\/author\/puneet-behl\/#author"},"creator":{"@id":"https:\/\/2thenew.online\/blog\/author\/puneet-behl\/#author"},"datePublished":"2016-11-11T15:44:34+05:30","dateModified":"2016-12-19T15:04:04+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.online\/blog\/#website","url":"https:\/\/2thenew.online\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Grails 3 \u2013 Migrating from Filters to Interceptors | TO THE NEW Blog","og:description":"Grails 3 comes with lots of new features and performance improvements, one of them being Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the whole group of Controllers, URI, or to a particular action and are used in most of the Grails projects. Though, you","og:url":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/","og:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Grails 3 \u2013 Migrating from Filters to Interceptors | TO THE NEW Blog","twitter:description":"Grails 3 comes with lots of new features and performance improvements, one of them being Interceptors which is a kind of a replacement for Filters from earlier versions of Grails. Filters are used to apply logic across the whole group of Controllers, URI, or to a particular action and are used in most of the Grails projects. Though, you","twitter:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"41835","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 13:55:14","updated":"2024-02-29 08:57:15","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tGrails 3 \u2013 Migrating from Filters to Interceptors\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.online\/blog"},{"label":"Technology","link":"https:\/\/2thenew.online\/blog\/category\/technology\/"},{"label":"Grails 3 &#8211; Migrating from Filters to Interceptors","link":"https:\/\/2thenew.online\/blog\/grails-3-migrating-from-filters-to-interceptors\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/41835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/users\/57"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/comments?post=41835"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/41835\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/media?parent=41835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/categories?post=41835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/tags?post=41835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}