I am now using spring cloud gateway, from the spring could gateway filter I could get the ServerHttpRequest which come from org.springframework.http.server like this:
ServerHttpRequest request = (ServerHttpRequest) exchange.getRequest();
but the public library function just only accept HttpServletRequest which was in the package javax.servlet.http, is it possible to translate the two type of object? or must I write a overload function with different type of parameter? should I implement twice with the same function? BTW, this is my public function:
public static void handleLoginCheck(HttpServletRequest httpServletRequest) {
AutoHeaderInfoRequest autoHeaderInfoRequest = AuthUtil.getAutoHeaderInfoRequest(httpServletRequest);
if (autoHeaderInfoRequest.getAccessToken() == null) {
throw ServiceException.NOT_LOGGED_IN_EXCEPTION;
}
if (!AuthUtil.verifyAccessToken(autoHeaderInfoRequest.getAccessToken())) {
throw GlobalException.ACCESS_TOKEN_INVALID_EXCEPTION;
}
setRequestGlobalHeader(autoHeaderInfoRequest);
}
this function and all invoked function use HttpServletRequest.