Estoy frente a problema con HttpClient problema de la petición URL post donde tengo método genérico que se utiliza en toda la aplicación. Tenemos un total de 7 proyectos que se ejecutan en una sola instancia de Tomcat en el mismo puerto. Tenemos un controlador genérico de donde estamos haciendo la POST / GET llamadas. A continuación se muestra el método de solicitud POST:
public HttpResponse postRequest( final String URLString, final Map<String, String> requestHeader, final String requestData)
throws ClientProtocolException, IOException {
Utility.LOGGER.info(this.getClass().getName() + "==> Method : postRequest ==> Enter");
String testServiceUrl = null;
testServiceUrl = testApplicationInitializer.getConfigurationsByConfigTableName().get("APP_SERVER_URL") + "/application1";
final HttpClient httpClient = HttpClientBuilder.create().build( );
System.out.println("URL: ==> " + testServiceUrl + URLString);
final HttpPost httpPost = new HttpPost(testServiceUrl + URLString );
if (requestHeader != null && !requestHeader.isEmpty() ) {
for (final Map.Entry<String, String> entry : requestHeader.entrySet() ) {
httpPost.addHeader(entry.getKey(), entry.getValue() );
}
}
Utility.LOGGER.info(this.getClass().getName() + "==> Method : postRequest ==> Exit");
return httpClient.execute(httpPost );
}
Esta es la URL que estoy pasando en el método postRequest: ../application2/service/
Salida: http: // localhost: 8080 / Application1 ../ application2 / servicio /
Espero que la URL debe ser como: http: // localhost: 8080 / application2 / servicio /
Cualquier ayuda es apreciada.
Usted está de paso parámetros erróneos.
En lugar de añadir: ../application2/service/
Añadir lo siguiente: /../application2/service/