1. 程式人生 > >springCloud異常:下游服務經過Gateway閘道器過濾之後拿不到HttpServletRequest

springCloud異常:下游服務經過Gateway閘道器過濾之後拿不到HttpServletRequest

下游服務controller:

public class BaseController { 
protected String sessionId = null; 
protected void getSessionIdFromRequest(HttpServletRequest request) {
 this.sessionId = request.getHeader().get("Session-Id");
 }
}

報錯資訊:

No primary or default constructor found for interface javax.servlet.http.HttpServletReques

原因:Gateway中不支援HttpServletRequest,換成ServerHttpRequest