Skip to content

Instantly share code, notes, and snippets.

@khannedy
Created October 15, 2017 02:01
Show Gist options
  • Save khannedy/5e2ba1585f7431a1f086a440a87a4e4b to your computer and use it in GitHub Desktop.
Save khannedy/5e2ba1585f7431a1f086a440a87a4e4b to your computer and use it in GitHub Desktop.
public class DemoInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String secure = request.getParameter("secure");
if ("true".equals(secure)) {
return true;
} else {
response.setStatus(HttpStatus.UNAUTHORIZED.value());
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment