Jersey(1.19.1) - Client API, Security with Http(s)URLConnection
2016-04-17 19:29
543 查看
With Http(s)URLConnection
The support for security, specifically HTTP authentication and/or cookie management withHttp(s)URLConnectionis limited due to constraints in the API. There are currently no specific features or properties on the
Clientclass that can be set to support HTTP authentication. However, since the client API, by default, utilizes
HttpURLConnectionor
HttpsURLConnection, it is possible to configure system-wide security settings (which is obviously not sufficient for multiple client configurations).
For HTTP authentication the
java.net.Authenticatorcan be extended and statically registered. Refer to the Http authentication document for more details. For cookie management the
java.net.CookieHandlercan be extended and statically registered. Refer to the Cookie Management document for more details.
To utilize HTTP with SSL it is necessary to utilize the “https” scheme. For certificate-based authentication see the class HTTPSProperties for how to set
javax.net.ssl.HostnameVerifierand
javax.net.ssl.SSLContext.
With Apache HTTP client
The support for HTTP authentication and cookies is much better with the Apache HTTP client than withHttpURLConnection. See the Java documentation for the package com.sun.jersey.client.apache, ApacheHttpClientState and ApacheHttpClientConfig for more details.
相关文章推荐
- UFLDL 笔记 01 神经网络
- 作业——在线学习Android课程之第七周(HttpURLConnection)
- php面试题之三——PHP网络编程(高级部分)
- HttpClient请求数据的封装
- C/C++网络编程大文件循环传输
- HTTP协议概述
- 无网络或无线网络情况下本地主机连接虚拟机
- 网络a、b、c类ip地址的区别
- NioSocket实现HTTP协议
- Http协议
- TCP/IP, WebSocket 和 MQTT
- 第 3 章 HTTP 报文内的 HTTP 信息
- WebSocket(4)-- WebSocket与TCP、Http的关系
- HDU 4411 Arrest 费用流
- linux的配置网络以及防火墙禁用
- RTSP - RTP over TCP
- OkHttp深入学习(一)——初探
- SSM框架开发时出现HTTP 400错误
- 计算机网络相关
- Android Volley和Android-async-http两个网络框架比较