-
JAVA https ssl 连接验证服务端证书
在服务端部署的应用,很多情况下是采用HTTPS SSL 方式,这种方式唯一的好处是数据在通过浏览器传输到 web application server 之间是加密的,一般不容易破解。有时候需要另外一个客户端:比如是Android 应用用https 方式去调用 API , 从安全性角度考虑,服务端颁发的证书授权的域名或者IP或者主机名,应该与客户端请求的URL 是一致的。如果不一致,就可能存在安全隐患。一般这种情况是在单向HTTPS 的情况才考虑,因为只有服务端证书,而没有客户端证书, 所以才需要验证客户端请求的URL 与服务端 证书授权的域名等是否一致。
Date: 2015-03-26 View: 1520
-
判断Httprequest 是否ajax 请求的方法
在写后台程序时,有时候需要知道客户端发送的是普通的请求,还是ajax 请求,至少在我目前所做的项目中有这样一个用途:如果session 过期的时候,如果是普通请求,跳转到登录页面,但如果是ajax 请求,如果后台session 已经过期了,这时候会返回登陆界面的的html 代码作为ajax 的返回值,这样就很郁闷,不好处理,如果是ajax 请求,理想的方式是返回json给客户端,这样客户端就好处理. 目前我采用了比较笨的一个方法来实现,可以在 请求的参数中加入一个标志来判断.
Date: 2014-11-27 View: 1520
-
java 获取HttpRequest Header 的几种方法
在开发应用程序的过程中,如果有多个应用,通常会通过一个portal 门户来集成,这个portal 是所有应用程序的入口,用户一旦在portal 登录之后,进入另外一个系统,就需要类似的单点登录(SSO). 进入各个子系统的时候,就不需要再次登录, 当然类似的功能,你可以通过专业的单点登录软件来实现,也可以自己写数据库token 等方式来实现。其实还有一个比较简单的方法,就是通过 portal 封装已经登录过的用户的消息,写到http header 之中,然后把请求forward 到各个子系统中去,而各子系统从 http header 中获取用户名,作为是否登录过的校验或者合法的校验。总结了几种处理http Header 的方法
Date: 2014-01-09 View: 1520
-
用java 自动登录一个网站的例子
在这个例子中,我将用java的HttpURLConnection,去登录一个web 站点。用这种方法的时候,一般是在一个form 中登录的。在这个例子中,用到如下工具 :1. Google chrome 浏览器。2. jsoup 库,用来提取html form 表单中的值. (你可以在这里下载 http://jsoup.org/ )3. jdk 6.
Date: 2013-06-24 View: 1520
-
利用python 将任意目录变成 web server
有时候为了给别人共享文档,或者为了方便自己在另外的机器上下载自己机器上的内容。我们可能采用:1.共享文件夹2.搭建 ftp server3.搭建http server ,比如 apache 等。
Date: 2012-08-27 View: 1520
-
How to get HTTP Response Header in Java
This example shows you how to get the Http response header values in Java.
Date: 2019-08-18 View: 1520
-
Java HttpURLConnection follow redirect example
The HttpURLConnection‘s follow redirect is just an indicator, in fact it won’t help you to do the “real” http redirection, you still need to handle it manually.
Date: 2019-08-18 View: 1520
-
Apache HttpClient Examples
This article shows you how to use Apache HttpClient to send HTTP GET/POST request.
Date: 2019-08-18 View: 1520
-
How to send HTTP request GET/POST in Java
In this article, we will show you two examples to make HTTP GET/POST request via following APIs
Date: 2019-08-18 View: 1520
-
The type DefaultHttpClient is deprecated
Eclipse IDE prompts warning on new DefaultHttpClient, mark this class as deprecated.
Date: 2019-08-17 View: 1520
-
How to view HTTP headers in Google Chrome?
To view the request or response HTTP headers in Google Chrome, take the following steps :
Date: 2019-08-17 View: 1520
-
Apache HttpClient 4.5 HTTP GET Request Method Example
This tutorial demonstrates how to use Apache HttpClient 4.5 to make a Http GET request. The Http GET method represents a representation of the specified resource. This could be as simple as getting an HTML page, or Getting resources formatted in JSON, XML or etc. Requests using HTTP GET Request methods should be Idempotent, meaning: these should only retrieve data and should have no other effects.
Date: 2019-08-10 View: 1520
-
Apache HttpClient 4.5 HTTP POST Request Method Example
This tutorial demonstrates how to use Apache HttpClient 4.5 to make a Http POST request. The HTTP POST request method requests that the server accepts the entity enclosed in the request as a new subordinate of the web resource identified by the URI. The posted data can be, but is not limited to, an annotation for existing resources or data formatted JSON, XML or submitted FORM data. The server can use the posted data to update resources in the database, or process this data.
Date: 2019-08-10 View: 1520
-
Apache HttpClient 4.5 HTTP PUT Request Method Example
This tutorial demonstrates how to use Apache HttpClient 4.5 to make a Http PUT request. The HTTP PUT Request Method requests that the server accepts and stores the entity enclosed in the supplied URI. If the URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.
Date: 2019-08-10 View: 1520
-
Apache HttpClient 4.5 HTTP DELETE Request Method Example
This tutorial demonstrates how to use Apache HttpClient 4.5 to make a Http DELETE request. The HTTP DELETE Request Method requests deletes the resource specified by the URI.
Date: 2019-08-10 View: 1520