- 
      
 - 
        
Save moqimoqidea/dd0c78949bdaad4d1337d83e42a719d8 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
ankushs92 revised this gist
Dec 22, 2015 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,15 +3,15 @@ public class SomeInterceptor extends HandlerInterceptorAdapter{ public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler) throws Exception { /*Assume the URI is user/{userId}/post/{postId} and our interceptor is registered for this URI. * This map would then be a map of two elements,with keys 'userId' and 'postId' */ final Map<String, String> pathVariables = (Map<String, String>) request .getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); //You'll have to convert the String to Long or Integer or any other type manually. For instance.. //final Integer userId = Integer.valueOf(pathVariables.get("userId")); //final Long postId = Long.valueOf(pathVariables.get("postId")); } }  - 
        
ankushs92 revised this gist
Dec 22, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ public boolean preHandle(final HttpServletRequest request,final HttpServletRespo /*Assume the URI is user/{userId}/post/{postId} and our interceptor is registered for this URI. * This map would then be a map of two elements,with keys 'userId' and 'postId' */ final Map<String, String> pathVariables = (Map<String, String>) request .getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); //You'll have to convert the String to Long or Integer or any other type manually. For instance..  - 
        
ankushs92 revised this gist
Dec 22, 2015 . No changes.There are no files selected for viewing
 - 
        
ankushs92 revised this gist
Dec 22, 2015 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,11 +3,11 @@ public class SomeInterceptor extends HandlerInterceptorAdapter{ public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler) throws Exception { /*Assume the URI is user/{userId}/post/{postId} and our interceptor is registered for this URI. * This map would then be a map of two elements,with keys 'userId' and 'postId' */ final Map<String, String> pathVariables = (Map<String, String>) request .getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); //You'll have to convert the String to Long or Integer or any other type manually. For instance.. //final Integer userId = Integer.valueOf(pathVariables.get("userId"));  - 
        
ankushs92 created this gist
Dec 22, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ public class SomeInterceptor extends HandlerInterceptorAdapter{ @Override public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler) throws Exception { /*Assume the URI is user/{userId}/post/{postId} and our interceptor is registered for this URI. * This map would then be a map of two elements,with keys 'userId' and 'postId' */ final Map<String, String> pathVariables = (Map<String, String>) request .getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); //You'll have to convert the String to Long or Integer or any other type manually. For instance.. //final Integer userId = Integer.valueOf(pathVariables.get("userId")); //final Long postId = Long.valueOf(pathVariables.get("postId")); } }