{"id":1469,"date":"2022-07-07T04:12:27","date_gmt":"2023-04-17T19:46:23","guid":{"rendered":"https:\/\/www.silicloud.com\/blog\/uncategorized\/one-possible-paraphrase-could-be-example-of-spring-mvc-interceptor-demonstrated-through-the-implementation-of-a-handlerinterceptoradapter-and-handlerinterceptor\/"},"modified":"2024-03-03T14:08:22","modified_gmt":"2024-03-03T14:08:22","slug":"spring-mvc-handlerinterceptoradapter-and-handlerinterceptor","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/","title":{"rendered":"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor."},"content":{"rendered":"<p>Spring Interceptors are utilized to intercept the requests made by clients and execute actions on them. Occasionally, we may want to intercept the HTTP Request and perform certain operations before passing it on to the handler methods of the controller. This is when Spring MVC Interceptors prove to be useful.<\/p>\n<h2>Interceptor for <a href=\"https:\/\/spring.io\/projects\/spring-framework\">Spring framework<\/a>.<\/h2>\n<p>Similar to Struts2 Interceptors, we can develop our own Spring interceptor by either implementing the org.springframework.web.servlet.HandlerInterceptor interface or by overriding the abstract class org.springframework.web.servlet.handler.HandlerInterceptorAdapter, which offers a fundamental implementation of the HandlerInterceptor interface.<\/p>\n<h2>Interceptor in Spring &#8211; HandlerInterceptor<\/h2>\n<p>The Spring HandlerInterceptor interface consists of three methods that determine the location at which we wish to intercept the HTTP request.<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>The &#8216;preHandle&#8217; method in Spring is used to intercept the request before it is handled by the designated method. If this method returns &#8216;true&#8217;, then the request can be processed further by other Spring interceptors or sent to the handler method. If it returns &#8216;false&#8217;, it means that the request has already been handled by the Spring interceptor and no further processing is necessary. In this case, the response object should be used to send a response to the client. The &#8216;handler&#8217; object is the chosen object that will handle the request. If an exception is thrown in this method, Spring MVC Exception Handling can be used to send an error page as a response.<\/ol>\n<\/li>\n<\/ol>\n<p>The &#8216;postHandle&#8217; method is called by the HandlerInterceptor when the HandlerAdapter has invoked the handler, but the DispatcherServlet has not yet rendered the view. This method can be used to add additional attributes to the ModelAndView object, which can then be used in the view pages. Additionally, this Spring interceptor method can be used to determine the time taken by the handler method to process the client request.<\/p>\n<p>The &#8216;afterCompletion&#8217; method is a callback method in the HandlerInterceptor that is called once the handler has been executed and the view has been rendered.<\/p>\n<p>If there are multiple spring interceptors set up, the preHandle() function is executed according to the order of configuration, while the postHandle() and afterCompletion() functions are called in the opposite order. We will now create a simple Spring MVC application where we configure a Spring Interceptor to record the timings of controller handler methods. The resulting example project will resemble the image below, focusing on the relevant components.<\/p>\n<h3>A class within the Spring framework that acts as an interceptor for the Controller component.<\/h3>\n<pre class=\"post-pre\"><code>package com.scdev.spring;\r\n\r\nimport java.text.DateFormat;\r\nimport java.util.Date;\r\nimport java.util.Locale;\r\n\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.ui.Model;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\n\r\n\/**\r\n * Handles requests for the application home page.\r\n *\/\r\n@Controller\r\npublic class HomeController {\r\n\t\r\n\tprivate static final Logger logger = LoggerFactory.getLogger(HomeController.class);\r\n\t\r\n\t@RequestMapping(value = \"\/home\", method = RequestMethod.GET)\r\n\tpublic String home(Locale locale, Model model) {\r\n\t\tlogger.info(\"Welcome home! The client locale is {}.\", locale);\r\n\t\t\/\/adding some time lag to check interceptor execution\r\n\t\ttry {\r\n\t\t\tThread.sleep(1000);\r\n\t\t} catch (InterruptedException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tDate date = new Date();\r\n\t\tDateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);\r\n\t\t\r\n\t\tString formattedDate = dateFormat.format(date);\r\n\t\t\r\n\t\tmodel.addAttribute(\"serverTime\", formattedDate );\r\n\t\tlogger.info(\"Before returning view page\");\r\n\t\treturn \"home\";\r\n\t}\r\n\t\r\n}\r\n<\/code><\/pre>\n<p>I am simply including some delay in the execution of the handler method to observe the functionality of our Spring interceptors.<\/p>\n<h3>Implementation of HandlerInterceptorAdapter in Spring MVC Interceptor.<\/h3>\n<p>To keep things simple, I am using the abstract class HandlerInterceptorAdapter. This class serves as an adapter for the HandlerInterceptor interface, making it easier to implement interceptors that only handle pre or post requests.<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.spring;\r\n\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\n\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.web.servlet.ModelAndView;\r\nimport org.springframework.web.servlet.handler.HandlerInterceptorAdapter;\r\n\r\npublic class RequestProcessingTimeInterceptor extends HandlerInterceptorAdapter {\r\n\r\n\tprivate static final Logger logger = LoggerFactory\r\n\t\t\t.getLogger(RequestProcessingTimeInterceptor.class);\r\n\r\n\t@Override\r\n\tpublic boolean preHandle(HttpServletRequest request,\r\n\t\t\tHttpServletResponse response, Object handler) throws Exception {\r\n\t\tlong startTime = System.currentTimeMillis();\r\n\t\tlogger.info(\"Request URL::\" + request.getRequestURL().toString()\r\n\t\t\t\t+ \":: Start Time=\" + System.currentTimeMillis());\r\n\t\trequest.setAttribute(\"startTime\", startTime);\r\n\t\t\/\/if returned false, we need to make sure 'response' is sent\r\n\t\treturn true;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void postHandle(HttpServletRequest request,\r\n\t\t\tHttpServletResponse response, Object handler,\r\n\t\t\tModelAndView modelAndView) throws Exception {\r\n\t\tSystem.out.println(\"Request URL::\" + request.getRequestURL().toString()\r\n\t\t\t\t+ \" Sent to Handler :: Current Time=\" + System.currentTimeMillis());\r\n\t\t\/\/we can add attributes in the modelAndView and use that in the view page\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void afterCompletion(HttpServletRequest request,\r\n\t\t\tHttpServletResponse response, Object handler, Exception ex)\r\n\t\t\tthrows Exception {\r\n\t\tlong startTime = (Long) request.getAttribute(\"startTime\");\r\n\t\tlogger.info(\"Request URL::\" + request.getRequestURL().toString()\r\n\t\t\t\t+ \":: End Time=\" + System.currentTimeMillis());\r\n\t\tlogger.info(\"Request URL::\" + request.getRequestURL().toString()\r\n\t\t\t\t+ \":: Time Taken=\" + (System.currentTimeMillis() - startTime));\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<p>The concept is quite straightforward &#8211; I am merely recording the durations of the handler method&#8217;s execution and the overall time it takes to process the request, which includes rendering the view page.<\/p>\n<h3>Configure Spring MVC Interceptors<\/h3>\n<p>We need to connect the spring interceptor with the requests, and we can do this by using the mvc:interceptors element to connect all the interceptors. Additionally, we can specify a URI pattern to determine when to include the spring interceptor for a request using the mapping element. The configuration file for our spring bean (spring.xml) should look like the following.<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;beans:beans xmlns=\"https:\/\/www.springframework.org\/schema\/mvc\"\r\n\txmlns:xsi=\"https:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns:beans=\"https:\/\/www.springframework.org\/schema\/beans\"\r\n\txmlns:context=\"https:\/\/www.springframework.org\/schema\/context\"\r\n\txsi:schemaLocation=\"https:\/\/www.springframework.org\/schema\/mvc https:\/\/www.springframework.org\/schema\/mvc\/spring-mvc.xsd\r\n\t\thttps:\/\/www.springframework.org\/schema\/beans https:\/\/www.springframework.org\/schema\/beans\/spring-beans.xsd\r\n\t\thttps:\/\/www.springframework.org\/schema\/context https:\/\/www.springframework.org\/schema\/context\/spring-context.xsd\"&gt;\r\n\r\n\t&lt;!-- DispatcherServlet Context: defines this servlet's request-processing \r\n\t\tinfrastructure --&gt;\r\n\r\n\t&lt;!-- Enables the Spring MVC @Controller programming model --&gt;\r\n\t&lt;annotation-driven \/&gt;\r\n\r\n\t&lt;!-- Handles HTTP GET requests for \/resources\/** by efficiently serving \r\n\t\tup static resources in the ${webappRoot}\/resources directory --&gt;\r\n\t&lt;resources mapping=\"\/resources\/**\" location=\"\/resources\/\" \/&gt;\r\n\r\n\t&lt;!-- Resolves views selected for rendering by @Controllers to .jsp resources \r\n\t\tin the \/WEB-INF\/views directory --&gt;\r\n\t&lt;beans:bean\r\n\t\tclass=\"org.springframework.web.servlet.view.InternalResourceViewResolver\"&gt;\r\n\t\t&lt;beans:property name=\"prefix\" value=\"\/WEB-INF\/views\/\" \/&gt;\r\n\t\t&lt;beans:property name=\"suffix\" value=\".jsp\" \/&gt;\r\n\t&lt;\/beans:bean&gt;\r\n\r\n\t&lt;!-- Configuring interceptors based on URI --&gt;\r\n\t&lt;interceptors&gt;\r\n\t\t&lt;interceptor&gt;\r\n\t\t\t&lt;mapping path=\"\/home\" \/&gt;\r\n\t\t\t&lt;beans:bean class=\"com.scdev.spring.RequestProcessingTimeInterceptor\"&gt;&lt;\/beans:bean&gt;\r\n\t\t&lt;\/interceptor&gt;\r\n\t&lt;\/interceptors&gt;\r\n\r\n\t&lt;context:component-scan base-package=\"com.scdev.spring\" \/&gt;\r\n\r\n&lt;\/beans:beans&gt;\r\n<\/code><\/pre>\n<p>Since we are not interested in and they do not have any specific spring interceptor related configuration, I will not provide an explanation for all the other components of the web application.<\/p>\n<h3>Testing the application with Spring MVC Interceptor.<\/h3>\n<p>Simply install the application in the servlet container and call upon the home controller. As a result, you will observe the logger generating an output similar to the one mentioned below.<\/p>\n<pre class=\"post-pre\"><code>INFO : com.scdev.spring.RequestProcessingTimeInterceptor - Request URL::https:\/\/localhost:9090\/SpringInterceptors\/home:: Start Time=1396906442086\r\nINFO : com.scdev.spring.HomeController - Welcome home! The client locale is en_US.\r\nINFO : com.scdev.spring.HomeController - Before returning view page\r\nRequest URL::https:\/\/localhost:9090\/SpringInterceptors\/home Sent to Handler :: Current Time=1396906443098\r\nINFO : com.scdev.spring.RequestProcessingTimeInterceptor - Request URL::https:\/\/localhost:9090\/SpringInterceptors\/home:: End Time=1396906443171\r\nINFO : com.scdev.spring.RequestProcessingTimeInterceptor - Request URL::https:\/\/localhost:9090\/SpringInterceptors\/home:: Time Taken=1085\r\n<\/code><\/pre>\n<p>The result affirms that the spring interceptor methods are executed in the specified sequence. That concludes the usage of spring interceptors. You can access the Spring Interceptor example project from the link below and experiment with multiple interceptors, testing different configuration orders.<\/p>\n<p>Please obtain the Spring Interceptors Project by downloading it.<\/p>\n<p>&nbsp;<\/p>\n<p>More Tutor<\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/tutorial-on-hibernate-tomcat-jndi-datasource\/\" target=\"_blank\" rel=\"noopener\">Tutorial on how to set up a Hibernate Tomcat JNDI DataSource.<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/broadcastreceiver-android-tutor\/\" target=\"_blank\" rel=\"noopener\">BroadcastReceiver Example Tutorial on Android<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Interceptors are utilized to intercept the requests made by clients and execute actions on them. Occasionally, we may want to intercept the HTTP Request and perform certain operations before passing it on to the handler methods of the controller. This is when Spring MVC Interceptors prove to be useful. Interceptor for Spring framework. Similar [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1469","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring MVC HandlerInterceptorAdapter and HandlerInterceptor. - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"This is when Spring MVC Interceptors prove to be useful. Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.\" \/>\n<meta property=\"og:description\" content=\"This is when Spring MVC Interceptors prove to be useful. Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-17T19:46:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-03T14:08:22+00:00\" \/>\n<meta name=\"author\" content=\"Sophia Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:site\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sophia Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/\"},\"author\":{\"name\":\"Sophia Anderson\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/19a24313de9c988db3d69226b4a40a30\"},\"headline\":\"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.\",\"datePublished\":\"2023-04-17T19:46:23+00:00\",\"dateModified\":\"2024-03-03T14:08:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/\"},\"wordCount\":732,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/\",\"name\":\"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor. - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\"},\"datePublished\":\"2023-04-17T19:46:23+00:00\",\"dateModified\":\"2024-03-03T14:08:22+00:00\",\"description\":\"This is when Spring MVC Interceptors prove to be useful. Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.silicloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"name\":\"Silicon Cloud Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\",\"name\":\"Silicon Cloud Blog\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"contentUrl\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"width\":1024,\"height\":1024,\"caption\":\"Silicon Cloud Blog\"},\"image\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\",\"https:\/\/twitter.com\/SiliCloudGlobal\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/19a24313de9c988db3d69226b4a40a30\",\"name\":\"Sophia Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c726c09aa40e37115fb5c62d0c3ed62c16ca255d3763e2e3ae83a70ddf8c2175?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c726c09aa40e37115fb5c62d0c3ed62c16ca255d3763e2e3ae83a70ddf8c2175?s=96&d=mm&r=g\",\"caption\":\"Sophia Anderson\"},\"url\":\"https:\/\/www.silicloud.com\/blog\/author\/sophiaanderson\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor. - Blog - Silicon Cloud","description":"This is when Spring MVC Interceptors prove to be useful. Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/","og_locale":"en_US","og_type":"article","og_title":"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.","og_description":"This is when Spring MVC Interceptors prove to be useful. Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.","og_url":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/","og_site_name":"Blog - Silicon Cloud","article_publisher":"https:\/\/www.facebook.com\/SiliCloudGlobal\/","article_published_time":"2023-04-17T19:46:23+00:00","article_modified_time":"2024-03-03T14:08:22+00:00","author":"Sophia Anderson","twitter_card":"summary_large_image","twitter_creator":"@SiliCloudGlobal","twitter_site":"@SiliCloudGlobal","twitter_misc":{"Written by":"Sophia Anderson","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/#article","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/"},"author":{"name":"Sophia Anderson","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/19a24313de9c988db3d69226b4a40a30"},"headline":"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.","datePublished":"2023-04-17T19:46:23+00:00","dateModified":"2024-03-03T14:08:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/"},"wordCount":732,"commentCount":0,"publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/","url":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/","name":"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor. - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/#website"},"datePublished":"2023-04-17T19:46:23+00:00","dateModified":"2024-03-03T14:08:22+00:00","description":"This is when Spring MVC Interceptors prove to be useful. Spring MVC HandlerInterceptorAdapter and HandlerInterceptor.","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/blog\/spring-mvc-handlerinterceptoradapter-and-handlerinterceptor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silicloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Spring MVC HandlerInterceptorAdapter and HandlerInterceptor."}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/blog\/#website","url":"https:\/\/www.silicloud.com\/blog\/","name":"Silicon Cloud Blog","description":"","publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.silicloud.com\/blog\/#organization","name":"Silicon Cloud Blog","url":"https:\/\/www.silicloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","contentUrl":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","width":1024,"height":1024,"caption":"Silicon Cloud Blog"},"image":{"@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SiliCloudGlobal\/","https:\/\/twitter.com\/SiliCloudGlobal"]},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/19a24313de9c988db3d69226b4a40a30","name":"Sophia Anderson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c726c09aa40e37115fb5c62d0c3ed62c16ca255d3763e2e3ae83a70ddf8c2175?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c726c09aa40e37115fb5c62d0c3ed62c16ca255d3763e2e3ae83a70ddf8c2175?s=96&d=mm&r=g","caption":"Sophia Anderson"},"url":"https:\/\/www.silicloud.com\/blog\/author\/sophiaanderson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/1469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/comments?post=1469"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/1469\/revisions"}],"predecessor-version":[{"id":1640,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/1469\/revisions\/1640"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/media?parent=1469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/categories?post=1469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/tags?post=1469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}