简体   繁体   中英

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

I have two java webapp, say MyApp and AuthEngine. AuthEngine is a common authentication app that can be used by any other application. When the user logs into MyApp, the usercredentials are sent to the AuthEngine to validate. I am using jersey client to invoke the service of AuthEngine(Not using any REST features, AuthEngine is developed using normal Java Servlets).

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.

However, instead of using the port 8080, if I use 80 as the port for both myapp and authengine, everything breaks .

When I use the port 80, the authenticate request to authEngine is not getting invoked and resulting in null value in the response.

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? 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)
2) Make your Auth Engine as Web service (jersey) as you mentioned above.
3) Point the service(Auth Engine) to Myapp ie make the url to map the Myapp Web...
4) check your server.xml file in Tomcat having port number 80 in http 1.1 protocol
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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