首先,我使用cxf-spring-json-tomcat开发了一个web服务器。虽然,我创建了 JKS keystore 文件并配置了我的 tomcat 服务器以使用 SSL 连接。而且,我可以使用 chrome、firefox 向我的服务器请求。
我的服务器 Bean:
@Service
@Path("/tservice")
public class TestService {
@GET
@Path("/{message}")
@Produces("application/json")
public Response find(@PathParam("message") String message)
{
Result result = new Result();
result.setMessage(message);
result.setResultId(Math.random());
return Response.status(Status.OK).entity(result).type(MediaType.APPLICATION_JSON).build();
}
}
Tomcat 服务器.xml (SSL)
<Connector port="8443" protocol="HTTP/1.1"
maxThreads="200" SSLEnabled="true" scheme="https" secure="true"
keystoreFile="/home/**/.keystore" keystorePass="123456"
clientAuth="false" sslProtocol="TLS" />
我的问题是(对于服务器端)我必须在我的 java 类中为 ssl 进行另一个配置或添加代码部分?
客户端的另一个问题是;
我需要使用 SSL 连接开发 C/C++ 客户端应用程序。我应该考虑什么?他们有什么技巧吗?有什么建议、示例或教程吗?
非常感谢。
最佳答案
您在tomcat中配置SSL,因此tomcat会处理SSL请求。无需更改服务器端的任何代码。
关于java - 对 CXF 服务器的 C/C++ SSL 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30024881/