With Http(s)URLConnection

The support for security, specifically HTTP authentication and/or cookie management with Http(s)URLConnection is limited due to constraints in the API. There are currently no specific features or properties on the Client class that can be set to support HTTP authentication. However, since the client API, by default, utilizes HttpURLConnection or 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.Authenticator can be extended and statically registered. Refer to the Http authentication document for more details. For cookie management the java.net.CookieHandler can 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.HostnameVerifier and javax.net.ssl.SSLContext.

With Apache HTTP client

The support for HTTP authentication and cookies is much better with the Apache HTTP client than with HttpURLConnection. See the Java documentation for the package com.sun.jersey.client.apacheApacheHttpClientState and ApacheHttpClientConfig for more details.

Jersey(1.19.1) - Client API, Security with Http(s)URLConnection的更多相关文章

  1. Jersey(1.19.1) - Client API, Uniform Interface Constraint

    The Jersey client API is a high-level Java based API for interoperating with RESTful Web services. I ...

  2. Jersey(1.19.1) - Client API, Ease of use and reusing JAX-RS artifacts

    Since a resource is represented as a Java type it makes it easy to configure, pass around and inject ...

  3. Jersey(1.19.1) - Client API, Overview of the API

    To utilize the client API it is first necessary to create an instance of a Client, for example: Clie ...

  4. Jersey(1.19.1) - Client API, Using filters

    Filtering requests and responses can provide useful functionality that is hidden from the applicatio ...

  5. Jersey(1.19.1) - Client API, Testing services

    The Jersey client API was originally developed to aid the testing of the Jersey server-side, primari ...

  6. Jersey(1.19.1) - Client API, Proxy Configuration

    为 Jersey Client 设置代理,可以使用带有 ClientHandler 参数的构造方法创建 Client 实例. public static void main(String[] args ...

  7. docker报Error response from daemon: client is newer than server (client API version: 1.24, server API version: 1.19)

    docker version Client: Version: 17.05.0-ce API version: 1.24 (downgraded from 1.29) Go version: go1. ...

  8. Jersey(1.19.1) - JSON Support

    Jersey JSON support comes as a set of JAX-RS MessageBodyReader<T> and MessageBodyWriter<T&g ...

  9. Jersey(1.19.1) - XML Support

    As you probably already know, Jersey uses MessageBodyWriters and MessageBodyReaders to parse incomin ...

随机推荐

  1. 关于spring管理hibernate事物

    下面这篇文章对我帮助很大.http://blog.csdn.net/jianxin1009/article/details/9202907

  2. OpenStack official programs

    What are programs ? The OpenStack project mission is to produce the ubiquitous Open Source Cloud Com ...

  3. Hibernate映射解析——七种映射关系

    首先我们了解一个名词ORM,全称是(Object Relational Mapping),即对象关系映射.ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现,这样开发人员就可以把对 ...

  4. 基于linux 的2048

    在 debian 下写了一个 2048, 效果如下: 感兴趣的朋友可以在这里(http://download.csdn.net/download/kamsau/7330933)下载. 版权声明:本文为 ...

  5. ADO.NET 快速入门(十四):使用 SQL Server 检索数据

    SqlDataReader 类提供了一种从数据源读取数据记录只进流的方法.如果想使用 OLE DB 接口的数据库或者 SQL Server7.0 之前的版本,请参考文章:使用 OLE DB 检索数据. ...

  6. Mr.Miss

    umbrella please here my ticket number five sorry sir cloakroom Madam Mr. Mrs Miss lady gentleman mal ...

  7. 返回ListBox选中的多项目

    //返回ListBox选中的多项目 procedure TForm1.Button2Click(Sender: TObject);vari:Integer;s:string;begin   for i ...

  8. Android系统Recovery工作原理之使用update.zip升级过程分析(一)

    通过分析update.zip包在具体Android系统升级的过程,来理解Android系统中Recovery模式服务的工作原理.我们先从update.zip包的制作开始,然后是Android系统的启动 ...

  9. NonEmpty和Non Empty的区别[转]

    One of my favourite questions in MDX is the difference between Non Empty and NonEmpty because even t ...

  10. 详解SQL Server连接(内连接、外连接、交叉连接)

    在查询多个表时,我们经常会用“连接查询”.连接是关系数据库模型的主要特点,也是它区别于其它类型数据库管理系统的一个标志. 什么是连接查询呢? 概念:根据两个表或多个表的列之间的关系,从这些表中查询数据 ...