首页 > TAG信息列表 > headerMap
Android的网络请求之HttpURLConnection封装
HttpURLConnection封装 OkHttp的封装已经很好了,但是有时候在调用第三方的时候,还是需要自己来处理一下,因此简单封装,便于后面的使用。 public class HttpUtil { private static final int CONNECT_TIME_OUT = 15000; private static final int READ_TIME_OUT = 20000;获取访问action的页面信息
// FacesContext facesContext = FacesContext.getCurrentInstance();// ExternalContext externalContext = facesContext.getExternalContext();// Map<String, Object> headerMap = externalContext.getRequestMap();// String referer = (String) headerMap.get(OkHttp工具类
参考:https://blog.csdn.net/u013802160/article/details/51860541 package com.lonely.utils; import com.ztkj.common.log.interceptors.HttpLogInterceptor; import okhttp3.*; import org.apache.http.client.utils.URIBuilder; import org.slf4j.Logger; import org.sl获取request中传递过来的header信息
1.添加HttpServletRequest注解,也可以作为参数传递 @Autowired protected HttpServletRequest request; 2.获取header /** * <h5>功能: 获取从request中传递过来的header信息</h5> * * @return Map<String, Object> */ public Map<String, Object> getHeaders() { Map