You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Morgan Rachell <mr...@bbandt.com> on 2004/11/17 19:50:22 UTC

Using commons HttpClient to call an Action, but it doesn't work

I'm using the following code in an initialization routine to call an Action. 
This occurs the first time a user hits the application. This was all working on 
WebSphere 4.0.4, but we upgraded to WS 5.1.0.5 and now it doesn't work. No 
error, no logs, no exception. Just like it doesn't get called. Of course, the 
same app (EAR file) works fine on a development server.

Any reason why this wouldn't work in the execute() method of another action?

// Create Action URL
String requestUrl = request.getRequestURL().toString();
String webAppUrl = requestUrl.substring(0, requestUrl.lastIndexOf("/") );
String loadStateFormsUrl = webAppUrl + "/initAction.do";

HttpClient client = new HttpClient();     
HttpMethod method = new GetMethod(url);
try {
    int statusCode = client.executeMethod(method);
} catch (HttpRecoverableException e) {
    result = "Exception occurred: " + e.getMessage();
} catch (IOException e) {
    result = "Failed to get a URL's response.";
}

// Read the response body.
byte[] responseBody = method.getResponseBody();
result = new String(responseBody);

// Release the connection.
method.releaseConnection();



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Using commons HttpClient to call an Action, but it doesn't work

Posted by Morgan Rachell <mr...@bbandt.com>.
Morgan Rachell <mrachell <at> bbandt.com> writes:

> 
> I'm using the following code in an initialization routine to call an Action. 
> This occurs the first time a user hits the application. This was all working 
on 
....

Sorry, I've posted this to the user group where it belongs.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org