Showing posts with label HttpServletRequest. Show all posts
Showing posts with label HttpServletRequest. Show all posts

Thursday, April 23, 2020

Get token value from request header in java

  1. public class TechFact555 {
  2.  public String getHeader(HttpServletRequest request) {
  3.    String token = request.getHeader("header-key");
  4.    // Validate token string
  5.     return token;
  6.   }
  7. }

To get value in request, use HttpServletRequest object with exact key.

  • NOTE: Header key is case-sensitive.