简体   繁体   English

通过apache服务器访问webservice而不使用在Java中使用ssl在tomcat服务器上取消解散的端口号

[英]Accessing webservice via apache server without using port no depolyed on tomcat server using ssl in java

I have deployed a Java based web application(.war) using SSL configuration on port 8443 of Tomcat server. 我已经在Tomcat服务器的端口8443上使用SSL配置部署了基于Java的Web应用程序(.war)。 I have used Jersey REST web services jar to define web services. 我已经使用Jersey REST Web服务jar来定义Web服务。 I have configured mod_jk to redirect apache server requests to tomcat.But the request are getting redirected only with the help of web browser as client. 我已经配置了mod_jk来将apache服务器请求重定向到tomcat。但是只有在Web浏览器作为客户端的帮助下,请求才被重定向。 The following is the piece of code to access webservice using ssl on tomcat server using jersey jar in java 以下是使用Java中的jersey jar在tomcat服务器上使用ssl访问webservice的代码段

Client client1 = null; 客户端client1 = null;

  com.sun.jersey.api.client.config.ClientConfig config =new com.sun.jersey.api.client.config.DefaultClientConfig(); // SSL config.getProperties() .put(com.sun.jersey.client.urlconnection.HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new com.sun.jersey.client.urlconnection.HTTPSProperties( getHostnameVerifier(), ctx)); client1 = Client.create(config); WebResource service = client1.resource(UriBuilder.fromUri( properties.getProperty("LogTransmitService")).build()); 

String res= service.post(String.class,"abc"); 字符串res = service.post(String.class,“ abc”);

I want to define a Java client(Java desktop application) that will call web service without giving port number (for ex: https://project/ws ) to Apache server. 我想定义一个Java客户端(Java桌面应用程序),该客户端将在不向Apache服务器提供端口号(例如: https://project/ws )的情况下调用Web服务。 Apache server should then redirect it to the tomcat server.Is there any Java code with which we can make calls to web services via Apache server which should be redirected to Tomcat using Jersey REST API? 然后Apache服务器应将其重定向到tomcat服务器。是否有任何Java代码可用来通过Apache服务器调用Web服务,并应使用Jersey REST API将其重定向到Tomcat? If not is there any other alternative with which we can achieve this? 如果没有,我们还有其他选择可以实现吗?

您可以使用Apache,Tomcat和mod_jk配置tomcat集群来解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM