HttpClientUtil

【HTTP请求工具类】HttpClientUtil public class HttpClientUtil { private static final Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); public static final Charset UTF8 = Charset.forName("UTF-8"); public static final Charset GB18030 = Charset.forName("GB18030");. 阅读详情

package com.yunlu.demo;


import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONObject;

import org.apache.http.HttpEntity;
import org.apache.http.HttpException;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.params.HttpClientParams;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.springframework.util.Assert;

public class HttpClientUtil {
    /**
     * 连接超时时间
     */
    public static final int CONNECTION_TIMEOUT_MS = 360000;

    /**
     * 读取数据超时时间
     */
    public static final int SO_TIMEOUT_MS = 360000;

    public static final String CONTENT_TYPE_JSON_CHARSET = "application/json;charset=utf-8";

    public static final String CONTENT_TYPE_XML_CHARSET = "application/xml;charset=utf-8";
    
    
    public static final String CONTENT_TYPE_JSON_CHARSET_UTF8 = "application/json;charset=utf-8";

    public static final String CONTENT_TYPE_XML_CHARSET_UTF8 = "application/xml;charset=utf-8";


    /**
     * httpclient读取内容时使用的字符集
     */
    public static final String CHARSET_GBK = "GBK";

    public static final String CHARSET_UTF8 = "UTF-8";
    
    public static final Charset UTF_8 = Charset.forName(CHARSET_UTF8);

    public static final Charset GBK = Charset.forName(CHARSET_GBK);
    
    public static String JsonPostInvoke(String url, Map<String, Object> params, String charsets) 
            throws Exception{  
        System.out.println("post方式提交json数据开始......");
        // 接收参数json列表  
        JSONObject jsonParam = new JSONObject();  
        // http客户端
        HttpClient httpClient = buildHttpClient(false);
        // post请求
        HttpPost method = new HttpPost(url);  
        if(null != params){
            for(String key : params.keySet()){
                jsonParam.put(key, params.get(key));
            }
            // 参数实体
            StringEntity entity = new StringEntity(jsonParam.toString(), CHARSET_UTF8);//解决中文乱码问题    
            entity.setContentEncoding(CHARSET_UTF8);    
            entity.setContentType(CONTENT_TYPE_JSON_CHARSET_UTF8);    
            method.setEntity(entity);  
        }
        // 执行响应操作
        HttpResponse result = httpClient.execute(method);  
        // 请求结束,返回结果  
        String data = EntityUtils.toString(result.getEntity()); 
        System.out.println(data);
        System.out.println("post方式提交json数据结束......");
        return data;
    } 
    public static String JsonGetInvoke(String url, String charsets) 
            throws ClientProtocolException, IOException{  
        System.out.println("get方式提交json数据开始......");
        // 接收参数json列表  
        JSONObject jsonParam = new JSONObject();  
        // http客户端
        HttpClient httpClient = buildHttpClient(false);
        // post请求
        HttpGet method = new HttpGet(url);  
        
        // 执行响应操作
        HttpResponse result = httpClient.execute(method);  
        // 请求结束,返回结果  
        String data = EntityUtils.toString(result.getEntity()); 
        System.out.println(data);
        System.out.println("get方式提交json数据结束......");
        return data;
    } 
    
    /***
     * 只传入url和参数不需要编码
     * @param url
     * @param params
     * @return
     * @throws ClientProtocolException
     * @throws IOException
     */
    public static String JsonPostInvoke(String url, Map<String, Object> params) 
            throws ClientProtocolException, IOException{  
        System.out.println("post方式提交json数据开始......");
        // 接收参数json列表  
        JSONObject jsonParam = new JSONObject();  
        // http客户端
        HttpClient httpClient = buildHttpClient(false);
        // post请求
        HttpPost method = new HttpPost(url);  
        if(null != params){
            for(String key : params.keySet()){
                jsonParam.put(key, params.get(key));
            }
            // 参数实体
            StringEntity entity = new StringEntity(jsonParam.toString(), CHARSET_UTF8);//解决中文乱码问题    
            entity.setContentEncoding(CHARSET_UTF8);    
            entity.setContentType(CONTENT_TYPE_JSON_CHARSET_UTF8);    
            method.setEntity(entity);  
        }
        // 执行响应操作
        HttpResponse result = null;
        String data="";
        try {
            result = httpClient.execute(method);
            data= EntityUtils.toString(result.getEntity()); 
        } catch (Exception e) {
            data="请求错误";
            e.printStackTrace();
        }  
        // 请求结束,返回结果  
       
        System.out.println(data);
        System.out.println("post方式提交json数据结束......");
        return data;
    } 
    
    
    
    /**
     * 简单get调用
     * 
     * @param url
     * @param params
     * @return
     * @throws ClientProtocolException
     * @throws IOException
     * @throws URISyntaxException
     */
    public static String simpleGetInvoke(String url, Map<String, String> params)
            throws ClientProtocolException, IOException, URISyntaxException {
        return simpleGetInvoke(url, params, CHARSET_UTF8);
    }

    /**
     * 简单get调用
     * 
     * @param url
     * @param params
     * @return
     * @throws ClientProtocolException
     * @throws IOException
     * @throws URISyntaxException
     */
    public static String simpleGetInvoke(String url, Map<String, String> params, String charset)
            throws ClientProtocolException, IOException, URISyntaxException {
        HttpClient client = buildHttpClient(false);
        HttpGet get = buildHttpGet(url, params);
        HttpResponse response = client.execute(get);
        assertStatus(response);
        HttpEntity entity = response.getEntity();
        if (entity != null) {
            String returnStr = EntityUtils.toString(entity, charset);
            return returnStr;
        }
        return null;
    }

    /**
     * 简单post调用
     * 
     * @param url
     * @param params
     * @return
     * @throws URISyntaxException
     * @throws ClientProtocolException
     * @throws IOException
     */
    public static String simplePostInvoke(String url, Map<String, String> params)
            throws URISyntaxException, ClientProtocolException, IOException {
        return simplePostInvoke(url, params, CHARSET_UTF8);
    }

    /**
     * 简单post调用
     * 
     * @param url
     * @param params
     * @return
     * @throws URISyntaxException
     * @throws ClientProtocolException
     * @throws IOException
     */
    public static String simplePostInvoke(String url, Map<String, String> params, String charset)
            throws URISyntaxException, ClientProtocolException, IOException {
        HttpClient client = buildHttpClient(false);
        HttpPost postMethod = buildHttpPost(url, params, charset);
        HttpResponse response = client.execute(postMethod);
        assertStatus(response);
        HttpEntity entity = response.getEntity();
        if (entity != null) {
            String returnStr = EntityUtils.toString(entity, charset);
            return returnStr;
        }
        return null;
    }

    /**
     * 创建HttpClient
     * 
     * @param isMultiThread
     * @return
     */
    public static HttpClient buildHttpClient(boolean isMultiThread) {
        CloseableHttpClient client;
        if (isMultiThread)
            client = HttpClientBuilder.create().setConnectionManager(new PoolingHttpClientConnectionManager()).build();
        else
            client = HttpClientBuilder.create().build();
        // 设置代理服务器地址和端口
        // client.getHostConfiguration().setProxy("proxy_host_addr",proxy_port);
        return client;
    }

    /**
     * 构建httpPost对象
     * 
     * @param url
     * @param headers
     * @return
     * @throws UnsupportedEncodingException
     * @throws URISyntaxException
     */
    public static HttpPost buildHttpPost(String url, Map<String, String> params, String charset)
            throws UnsupportedEncodingException, URISyntaxException {
        Assert.notNull(url, "构建HttpPost时,url不能为null");
        HttpPost post = new HttpPost(url);
        setCommonHttpMethod(post);
        HttpEntity he = null;
        if (params != null) {
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            for (String key : params.keySet()) {
                formparams.add(new BasicNameValuePair(key, params.get(key)));
            }
            he = new UrlEncodedFormEntity(formparams, Charset.forName(charset));
            post.setEntity(he);
        }
        // 在RequestContent.process中会自动写入消息体的长度,自己不用写入,写入反而检测报错
        // setContentLength(post, he);
        return post;

    }

    /**
     * 构建httpGet对象
     * 
     * @param url
     * @param headers
     * @return
     * @throws URISyntaxException
     */
    public static HttpGet buildHttpGet(String url, Map<String, String> params) throws URISyntaxException {
        Assert.notNull(url, "构建HttpGet时,url不能为null");
        HttpGet get = new HttpGet(buildGetUrl(url, params));
        return get;
    }

    /**
     * build getUrl str
     * 
     * @param url
     * @param params
     * @return
     */
    private static String buildGetUrl(String url, Map<String, String> params) {
        StringBuffer uriStr = new StringBuffer(url);
        if (params != null) {
            List<NameValuePair> ps = new ArrayList<NameValuePair>();
            for (String key : params.keySet()) {
                ps.add(new BasicNameValuePair(key, params.get(key)));
            }
            uriStr.append("?");
            uriStr.append(URLEncodedUtils.format(ps, UTF_8));
        }
        return uriStr.toString();
    }

    /**
     * 设置HttpMethod通用配置
     * 
     * @param httpMethod
     */
    public static void setCommonHttpMethod(HttpRequestBase httpMethod) {
        httpMethod.setHeader(HTTP.CONTENT_ENCODING, CHARSET_UTF8);// setting
        // contextCoding
        // httpMethod.setHeader(HTTP.CHARSET_PARAM, CONTENT_CHARSET);
        httpMethod.setHeader(HTTP.CONTENT_TYPE, CONTENT_TYPE_JSON_CHARSET);
        // httpMethod.setHeader(HTTP.CONTENT_TYPE, CONTENT_TYPE_XML_CHARSET);
    }

    /**
     * 设置成消息体的长度 setting MessageBody length
     * 
     * @param httpMethod
     * @param he
     */
    public static void setContentLength(HttpRequestBase httpMethod, HttpEntity he) {
        if (he == null) {
            return;
        }
        httpMethod.setHeader(HTTP.CONTENT_LEN, String.valueOf(he.getContentLength()));
    }

    /**
     * 构建公用RequestConfig
     * 
     * @return
     */
    public static RequestConfig buildRequestConfig() {
        // 设置请求和传输超时时间
        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(SO_TIMEOUT_MS)
                .setConnectTimeout(CONNECTION_TIMEOUT_MS).build();
        return requestConfig;
    }

    /**
     * 强验证必须是200状态否则报异常
     * 
     * @param res
     * @throws HttpException
     */
    static void assertStatus(HttpResponse res) throws IOException {
        Assert.notNull(res, "http响应对象为null");
        Assert.notNull(res.getStatusLine(), "http响应对象的状态为null");
        switch (res.getStatusLine().getStatusCode()) {
        case HttpStatus.SC_OK:
            // case HttpStatus.SC_CREATED:
            // case HttpStatus.SC_ACCEPTED:
            // case HttpStatus.SC_NON_AUTHORITATIVE_INFORMATION:
            // case HttpStatus.SC_NO_CONTENT:
            // case HttpStatus.SC_RESET_CONTENT:
            // case HttpStatus.SC_PARTIAL_CONTENT:
            // case HttpStatus.SC_MULTI_STATUS:
            break;
        default:
            throw new IOException("服务器响应状态异常,失败.");
        }
    }

    private HttpClientUtil() {
    }
    public static String getContent(String url) throws Exception{  
        String backContent = null;  
        //先建立一个客户端实例,将模拟一个浏览器  
        HttpClient httpclient = null;  
        HttpGet httpget = null;
        HttpPost httpPost=null;
        try {  
            //************************************************************  
            // 设置超时时间  
            // 创建 HttpParams 以用来设置 HTTP 参数  
            HttpParams params = new BasicHttpParams();  
            // 设置连接超时和 Socket 超时,以及 Socket 缓存大小  
            HttpConnectionParams.setConnectionTimeout(params, 180 * 1000);  
            HttpConnectionParams.setSoTimeout(params, 180 * 1000);  
            HttpConnectionParams.setSocketBufferSize(params, 8192);  
            // 设置重定向,缺省为 true  
            HttpClientParams.setRedirecting(params, false);  
            //************************************************************     
            httpclient = new DefaultHttpClient(params);  
//          httpclient = new DefaultHttpClient();  
            // 建立一个get方法请求,提交刷新  
            httpget = new HttpGet(url);       
              
            HttpResponse response = httpclient.execute(httpget);   
            //HttpStatus.SC_OK(即:200)服务器收到并理解客户端的请求而且正常处理了  
//          if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {  
//              //对象呼叫中止  
//              httpget.abort();  
//              backContent = "获取不到";  
//          }  
            HttpEntity entity = response.getEntity();  
            if (entity != null) {              
                //start 读取整个页面内容  
                InputStream is = entity.getContent();  
                BufferedReader in = new BufferedReader(new InputStreamReader(is));   
                StringBuffer buffer = new StringBuffer();   
                String line = "";  
                while ((line = in.readLine()) != null) {  
                    buffer.append(line);  
                }  
                //end 读取整个页面内容  
                backContent = buffer.toString();  
            }  
        } catch (Exception e) {  
            httpget.abort();  
            backContent = "有异常,获取不到";     
            System.out.println("-------------异常开始");  
            e.printStackTrace();  
            System.out.println("-------------异常结束");  
        }finally{  
            //HttpClient的实例不再需要时,降低连接,管理器关闭,以确保立即释放所有系统资源  
            if(httpclient != null)  
                httpclient.getConnectionManager().shutdown();  
        }          
        //返回结果  
        return backContent;  
    }  
    public static void main(String[] args) 
            throws Exception {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("account", "我们测试");
        params.put("tsn", "6590300");
        params.put("tname", "千万千万有限公司");
        params.put("uopenId", "cc4b6be78725463ab6511ebbfb1510d2");
        params.put("uname", "uuuu");
        params.put("pwd", "jZae727K08KaOmKSgOaGzww/XVqGr/PKEgIMkjrcbJI=");
        params.put("mobile", "13552438933");
        params.put("email", null);
        params.put("state", 0);
        params.put("systemId", "10000048130074");
        params.put("fullName", "21321");
        
    Map<String, Object> map=new HashMap<String, Object>();
    map.put("systemId", "10000055300000");
    map.put("uri", "");
    Map<String, Object> data=new HashMap<String, Object>();
    data.put("account", "uctest");
    map.put("data", data);
    
        System.out.println(JsonPostInvoke("http://172.17.11.38:8080/api/getUserInfoByAcc.ht",map));
        //System.out.println(JsonPostInvoke("http://182.50.1.8:15380/platform/system/api/tenantAdd.ht",params));
        
        /*    Map<String, Object> params=new HashMap<String, Object>();
            params.put("data", "{pwd=htG1exdb5F1HnAAfZ9CvZ7JsoiEd8ClOGH7bZn48lPs=, email=null, topenId=0d78e1dff6af4b21a8b28c3d8f2f960b, uname=hbzxcl, state=0, tname=湖北正信齿轮制造有限公司, systemId=10000048280000, fullName=管理员, uopenId=9ac9ad6b9aa64298bb3cbe0bc26a567c, tsn=6690301, mobile=13907294647}");
            ThreadUtil threadUtil=new ThreadUtil( params, "http://kangju.casicloud.com:9090/platform/system/api/tenantAdd.ht");
            ThreadUtil threadUtil2=new ThreadUtil( params, "http://kangju.casicloud.com:9090/platform/system/api/tenantAdd.ht");
            Sync sync=new Sync(threadUtil);
            Sync sync2=new Sync(threadUtil2);
            sync.start();
            sync2.start();*/
            

    }
    
    
    /**
     * 用urlconnect  json post 传递参数
     */
    public static String urlPost(String url,String jsonString){
        if (url==null || StringUtil.isEmpty(url)){
            return "";
        }
        if (jsonString==null || StringUtil.isEmpty(jsonString)){
            return "";
        }
        String returnLine = "";
        try {
            System.out.println("**************开始http通讯**************");
            System.out.println("**************调用的接口地址为**************");
            System.out.println(url);
            System.out.println("**************请求发送的数据为**************");
            System.out.println(jsonString);
            URL my_url = new URL(url);
            HttpURLConnection connection = (HttpURLConnection) my_url.openConnection();
            connection.setDoOutput(true);
            connection.setDoInput(true);
            connection.setRequestMethod("POST");
            connection.setUseCaches(false);
            connection.setInstanceFollowRedirects(true);
            connection.setRequestProperty("Content-Type", "application/json");
            connection.connect();
            DataOutputStream out = new DataOutputStream(connection.getOutputStream());
            byte[] content = jsonString.getBytes("utf-8");
            out.write(content, 0, content.length);
            out.flush();
            out.close(); // flush and close
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
            //StringBuilder builder = new StringBuilder();
            String line = "";
            System.out.println("Contents of post request start");
            while ((line = reader.readLine()) != null) {
                // line = new String(line.getBytes(), "utf-8");
                returnLine += line;
            }
            System.out.println("Contents of post request ends");
            reader.close();
            connection.disconnect();
            System.out.println("**************返回的结果为**************");
            System.out.println(returnLine);
            System.out.println("**************http通讯结束**************");

            return returnLine;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
    public static String JsonPostInvoke(String url, String jsonParam) 
            throws ClientProtocolException, IOException{  
        System.out.println("post方式提交json数据开始......");
        // 接收参数json列表  
        // http客户端
        HttpClient httpClient = buildHttpClient(false);
        // post请求
        HttpPost method = new HttpPost(url);  
      
            // 参数实体
            StringEntity entity = new StringEntity(jsonParam, CHARSET_UTF8);//解决中文乱码问题    
            entity.setContentEncoding(CHARSET_UTF8);    
            entity.setContentType(CONTENT_TYPE_JSON_CHARSET_UTF8);    
            method.setEntity(entity);  
        // 执行响应操作
        HttpResponse result = null;
        String data="";
        try {
            result = httpClient.execute(method);
            data= EntityUtils.toString(result.getEntity()); 
        } catch (Exception e) {
            data="请求错误";
            e.printStackTrace();
        }  
        // 请求结束,返回结果  
       
        System.out.println(data);
        System.out.println("post方式提交json数据结束......");
        return data;
    } 
    
}

远程调用之--HttpClientUtil源码 HttpClientUtil调用远程接口 package com.jeagine.util; import org.apache.http.HttpEntity; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpRespo... 阅读详情

相关推荐

Java中的HttpClientUtil工具类详解

在当今快速发展的IT行业中,HttpClientUtil已经成为众多开发者提升网络请求效率的利器。该工具库封装了HTTP协议的底层细节,简化了网络编程的过程,让开发者可以更专注于业务逻辑的实现。本章将对HttpClientUtil进行总体介绍,阐述其核心价值以及在各种应用场景下的重要性。在现代的网络通信中,连接复用是提升效率和降低开销的重要机制。

weixin_35749796的博客 1119

Java中HttpClientUtil工具类

HttpClientUtil工具类是java 调用第三方接口时需要使用到的,例如:在系统之间交互时获取参数。HttpClientUtil 包含get和post方法。 发送HttpPost或HttpGet请求一共三个步骤: 1、创建CloseableHttpClient对象,用于执行excute方法 2、创建HttpPost或者HttpGet请求对象 3、执行请求,判断返回状态,接收响应对象 package com.*.utils; import java.io.IOException; import j

weixin_41769596的博客 4875

微积分,用编程理解高数(python,C,C++)

很好理解,导数中,x是哪一点的导数,dx是精准度,y等于f(x)即函数。导数结果就是瞬时变化率。积分很好理解,a为下限,b为上限,y为函数,结果就是y=f(x)下a到b的面积。只要用定积分代入a=0,b=10(10s)y=x(1*x=1)就得到结果。F(x)为原函数,即微分后的函数是f(x)dx,微分前是F(x)一列车初始速度为10m/s,加速度为。才几十行代码,微积分也不是很难啊。,问速度达到20时车走了多少米。

linhhanpy的博客 1183

常用HttpClientUtil,拿来即用

最近项目中需要调用第三方接口,于是自己写了一个HttpClientUtil,拿来即用,封装了三个常用的get请求,Post表单请求和Post Json请求方法 如有不对,欢迎指正评论 1 pom.xmll导入依赖 2 上代码 package com.sunpeifu.http; import com.alibaba.fastjson.JSON; import com.sunpeifu.User;...

weixin_41862314的博客 3544

centos7部署mysql8.0.35,主从复制,主主集群

centos7 linux部署mysql,主从复制,主主模式

zaixiaqin的博客 1992

深入解析Matlab phantom函数:从基础模体到自定义头部仿真

本文深入解析了Matlab中的phantom函数,它是医学图像处理算法测试的核心工具。文章详细介绍了如何使用内置的Shepp-Logan及其改良版头部仿真模体,并重点讲解了通过自定义参数矩阵来构建专属模体的方法。通过从生成模体到模拟投影(正弦图)再到图像重建的完整实战流程,展示了phantom函数在CT等算法开发与验证中的关键作用。

m3n5b7v8c9x的博客 954

HttpClient 发送请求的Java工具类utils

这是我java 项目目前使用的发送http的工具类,涵盖了主要的get请求和post请求,好处就是参数均可以选择传和不传,有异常处理,有非空校验,同时也有详细的注释原理解析,接下来我会写一个关于使用微信小程序登录的接口和用户授权获取用户手机号的接口,完全根据微信开发者文档开发。感兴趣的可以关注.

Barry_Li1949的博客 1990

深入解析高通Adreno DPU的DRM/KMS驱动架构与硬件协同设计

本文深入解析了高通Adreno DPU的DRM/KMS驱动架构与硬件协同设计,详细介绍了Adreno DPU的核心模块组成、显示接口设计以及DRM驱动架构。通过实际案例和调试技巧,帮助开发者理解硬件与软件的协同工作原理,优化显示性能并解决常见问题。

weixin_29266679的博客 440

HttpClientUtil工具类

HttpClientUtil.java import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.http.NameValuePair; import org.apach...

huangpf_vcx 1675

【游戏开发】初识寻路&navmesh,探索RecastDemo

在手游时代,尤其对于大世界游戏而言,寻路的实现基本在专门的寻路服务器上进行。在众多寻路的解决方案中,recastnavigation是最为经典实用的一个,很多游戏甚至游戏引擎都采用类似的实现。recastnavigation项目自带了RecastDemo,用图形化的界面帮助用户认识寻路网格(navmesh)的生成以及寻路的过程。因此,作为初学者的笔者,也决定通过RecastDemo去初步认识寻路的机理奥秘。 构建RecastDemo 首先克隆recastnavigation项目,从文档中可以看到Recast

HiKariのTechLab 3057

群晖Web Station实战:从零搭建个人静态导航站

本文详细介绍了如何利用群晖NAS自带的Web Station套件,从零开始搭建个人静态导航站。通过安装Web Station、上传静态网站源码、配置网页服务与网络门户等步骤,无需代码基础即可实现内网访问。文章还分享了文件权限设置、个性化定制及常见问题排查等实用技巧,帮助用户高效管理个人常用网址,充分挖掘NAS的服务器潜能。

tea88的博客 1333

HttpClientUtil工具包

需要的相关依赖: <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> <dependency> <groupId>org.apache.httpcomponents</groupId> &l...

ailian_f的博客 2743

156、手机摄像头模组结构拆解:从保护盖到 FPC 连接器的完整装配剖面

本文深入解析手机摄像头模组结构设计要点。作者结合项目经验,指出保护盖密封胶在低温收缩会导致边缘漏光问题,强调结构细节比算法参数更关键。文章逐层拆解模组组件:保护盖厚度需平衡抗冲击与光学性能;镜筒内镜片组装配顺序和公差控制直接影响成像质量;IR滤光片厚度公差±0.02mm会改变红外截止波长;CSP封装需注意金线加固;FPC连接器的信号完整性和机械可靠性设计。最后给出5条实用建议,包括密封胶选型、镜片对位检测等,强调模组结构设计是"一票否决制"的基础工程。(149字)

sundong_81的博客 108

HttpClientUtil工具类的使用,亲测可用

前端时间领导要求弄个HttpClient 推送订单的例子 截图科普来自于百科 怎么做? 第一步 pom依赖 <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4.4</version> </dependency>

ZHUWANLIAUST的博客 1992

HTML粉色爱心(完整代码)

HTML语言实现粉色爱心的完整代码。

AIGC 1119

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

HttpClientUtil——个人理解

是什么 模拟HTTP客户端,与服务器进行通讯 HttpClient 是 Apache Jakarta Common 下的子项目,用来提供高效、最新、功能丰富的 支持 HTTP 协议的客户端编程工具包,且支持 HTTP 协议最新的版本和建议。 http请求 由以下几种请求组成:GET, HEAD, POST, PUT, DELETE, TRACE and OPTIONS, 程序包中分别用

天生我材必有用,千金散尽还复来。 2002

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

httpclientutil java_基于 Httpclient 的封装 HttpClientUtil

import java.io.IOException;import java.io.UnsupportedEncodingException;import java.net.SocketTimeoutException;import java.nio.charset.Charset;import java.util.Base64;import java.util.List;import java....

weixin_42504327的博客 233

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

跨域请求工具类HttpClientUtil

maven依赖 <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.2</version> </depende...

qq_38839758的博客 445

HttpClientUtil-工具类

HttpClientUtil-工具类 代码 package cn.hlbdx; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxExcep...

海恋北斗星 419

RestTemplate编写的HttpClientUtil

import com.alibaba.fastjson.JSON; import org.springframework.http.*; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; import java.util.Iterator; import java.util.Map; /** * @author

江湖人称黑哥的博客 495

使用HttpClientUtil工具类调用短信接口

HttpClientUtil工具类 package com.hw.util; import com.alibaba.fastjson.JSONObject; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.client.methods...

qq_36778310的博客 458

HttpClientUtil-用于后台发起请求

项目中经常需要通过apache的http client模拟发送请求,于是动手写了HttpClientUtil这个工具类。该工具类主要出于下面几个方面考虑作设计: 1、具备发送http post请求的功能; 2、请求参数编码和读取内容编码的设置,解决乱码问题; 3、请求超时和连接关闭。 通过单例模式,提供HttpClientUtil的实例,提供的API有: //获取单例对象

liuliu_1991的博客 853
上一篇: java cas 单点登录web.xml配置
下一篇: cas+tomcat+shiro实现单点登录-4-Apache Shiro 集成Cas作为cas client端实现
王树民
博客等级 码龄10年 912粉丝 560原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值