简体   繁体   English

Http GET请求在默认端口上的Jersey中不起作用(80)

[英]Http GET request not working in Jersey on default port(80)

I have two java webapp, say MyApp and AuthEngine. 我有两个Java Webapp,例如MyApp和AuthEngine。 AuthEngine is a common authentication app that can be used by any other application. AuthEngine是可以由任何其他应用程序使用的通用身份验证应用程序。 When the user logs into MyApp, the usercredentials are sent to the AuthEngine to validate. 当用户登录MyApp时,用户凭据将发送到AuthEngine进行验证。 I am using jersey client to invoke the service of AuthEngine(Not using any REST features, AuthEngine is developed using normal Java Servlets). 我正在使用jersey客户端来调用AuthEngine的服务(不使用任何REST功能,AuthEngine是使用常规Java Servlet开发的)。

WebResource resource =  null;
resource = authClient.resource("http://localhost:8080/authengine/authenticate");
queryParam = new MultivaluedMapImpl();
queryParam.add("username", username);
queryParam.add("password", password);
clientResponse = resource.queryParams(queryParam).get(ClientResponse.class);
response = clientResponse.getEntity(String.class);

Everything works fine here. 这里一切都很好。 MyApp invokes the authentication servlet from the authengine and returns the status. MyApp从authengine调用身份验证servlet并返回状态。

However, instead of using the port 8080, if I use 80 as the port for both myapp and authengine, everything breaks . 但是,如果我使用80作为myapp和authengine的端口,而不是使用端口8080,则一切都会中断

When I use the port 80, the authenticate request to authEngine is not getting invoked and resulting in null value in the response. 当我使用端口80时,未调用对authEngine的身份验证请求,并且在响应中导致空值。

I tried with different port numbers, and it seems to work fine in all the other ports except 80. Could someone help me to find out the reason for this weird problem? 我尝试使用不同的端口号,除80外,其他端口似乎都可以正常工作。有人可以帮我找出这个奇怪问题的原因吗? I am at my wit's end!! 我没办法!!

1) Both of your Web app say MyApp and Auth Engine can't have same Instance ie (port number) 1)您的两个Web应用都说MyApp和Auth Engine不能具有相同的实例,即(端口号)
2) Make your Auth Engine as Web service (jersey) as you mentioned above. 2)如上所述,将您的身份验证引擎设置为Web服务(球衣)。
3) Point the service(Auth Engine) to Myapp ie make the url to map the Myapp Web... 3)将服务(身份验证引擎)指向Myapp,即,将URL映射到Myapp Web ...
4) check your server.xml file in Tomcat having port number 80 in http 1.1 protocol 4)在http 1.1协议中的Tomcat中检查您的server.xml文件,其端口号为80
5) You dont need to explicitly specify the port number 80 in url because default port number for http is 80 and https is 443 5)您不需要在url中明确指定端口号80,因为http的默认端口号是80而https是443

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

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