Hi bekomme folgendes..
bin am verzweifeln..
[javac] C:\MyProj\src\my\comm\http\NoAuthHttpClient.java:46: cannot find symbol
[javac] symbol : class GetMethod
[javac] location: class my.comm.http.NoAuthHttpClient
[javac] GetMethod getMethod = new GetMethod("http://www.site.com/www.xml");
Jemadn hinweise?
Thnx huck
bin am verzweifeln..
[javac] C:\MyProj\src\my\comm\http\NoAuthHttpClient.java:46: cannot find symbol
[javac] symbol : class GetMethod
[javac] location: class my.comm.http.NoAuthHttpClient
[javac] GetMethod getMethod = new GetMethod("http://www.site.com/www.xml");
Java:
package my.comm.http;
import java.io.IOException;
import org.apache.commons.httpclient.ConnectionPoolTimeoutException;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpConnection;
import org.apache.commons.httpclient.HttpConnectionManager;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
class NoAuthHttpClient {
private final HttpClient _httpClient;
public NoAuthHttpClient() {
HttpClientParams params = new HttpClientParams();
params.setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
_httpClient = new HttpClient(params);
}
public void executeRequest() {
_logger.logDebug("Execute request using NO AUTH");
GetMethod getMethod = new GetMethod("http://www.site.com/www.xml");
getMethod.setDoAuthentication(false);
try {
_httpClient.executeMethod(getMethod);
System.out.println("Statuscode: {0}", String.valueOf(getMethod.getStatusCode()) );
System.out.println("Response: {0}", getMethod.getResponseBodyAsString());
}
catch (IOException e) {
System.out.println(e.getMessage(), e);
} finally {
getMethod.releaseConnection();
}
}
}
Jemadn hinweise?
Thnx huck
Zuletzt bearbeitet von einem Moderator: