0 0

GetMethod method = new GetMethod(url); 报错Invalid uri5

Exception in thread "main" java.lang.IllegalArgumentException: Invalid uri 'http://detail.tmall.com/item.htm?spm=a1z10.1.w5003-7662445350.3.PcBVoj&id=38543605541&rn=18b68bfcd2dbadecf752f6983631992d&scene=taobao_shop{**}http://detail.tmall.com/item.htm?spm=a1z10.1.w5003-7662445350.3.PcBVoj&id=38543605541&rn=18b68bfcd2dbadecf752f6983631992d&scene=taobao_shop': Invalid query
at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)

报错信息如上,但是同样的程序在Java project 中可以正常运行,在web project中就报出以上错误,程序相同,url的值也是一样的
2014年10月10日 16:49
目前还没有答案

相关推荐

    JAVA-用HttpClient来模拟浏览器GET,POST.docx

    GetMethod method = new GetMethod(url); // 执行GET请求 client.executeMethod(method); // 读取服务器返回的响应 String response = method.getResponseBodyAsString(); // 输出响应结果 System.out....

    HttpClient交互

    通过http向服务器发出请求,进行数据交互 HttpClient client = new HttpClient(); client.getHttpConnectionManager().getParams().... GetMethod method = new GetMethod("http://127.0.0.1/config.xml");

    网络爬虫课程设计文档.pdf

    GetMethod method = new GetMethod(url); try { // 执行请求 int status = httpclient.executeMethod(method); // 获取响应内容 byte[] responseBody = method.getResponseBody(); // 处理响应数据... ...

    Interface的测试代码,请光临

    GetMethod getMethod = new GetMethod(strURL); // 使用系统提供的默认的恢复策略 getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler()); ...

    httpclient

    2. **创建 GetMethod 实例**:然后,创建一个 GetMethod 对象,传入你要访问的 URL。例如,`GetMethod getMethod = new GetMethod("http://www.ibm.com/")`。GetMethod 可以自动处理重定向,如果不想自动跟随重定向...

    比较全的httpclient入门介绍和例子代码

    接着,我们需要创建一个`GetMethod`对象,并设置其URL。这个URL是我们想要访问的网页地址。 ```java GetMethod getMethod = new GetMethod("http://www.ibm.com"); ``` 注意,如果目标URL包含重定向,可以通过`...

    Java 调用Http Rest接口 例子说明2

    GetMethod getMethod = new GetMethod(url); getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler()); try { httpClient.executeMethod(getMethod); ...

    Java 调用Http Rest接口 例子说明

    GetMethod getMethod = new GetMethod(url); getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler()); try { httpClient.executeMethod(getMethod); ...

    httpClient

    GetMethod getMethod = new GetMethod(url); // 设置 get 请求超时为 5 秒 getMethod.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 5000); // 设置请求重试处理,用的是默认的重试处理:请求三次 ...

    HttpClient 基本用法

    HttpMethod getMethod = new GetMethod("http://www.ibm.com/"); try { httpClient.executeMethod(getMethod); int statusCode = getMethod.getStatusCode(); if (statusCode != HttpStatus.SC_OK) { System....

    java获取http状态码

    getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler()); try { int statusCode = httpClient.executeMethod(getMethod); System.out.println(...

    详解Java实现多种方式的http数据抓取

    GetMethod method = new GetMethod(request); int status = client.executeMethod(method); if (status == HttpStatus.SC_OK) { InputStream input = method.getResponseBodyAsStream(); // 读取输入流 } ``` 4)...

    使用 HttpClient 和 HtmlParser 实现简易爬虫

    GetMethod getMethod = new GetMethod(url); getMethod.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 5000); getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, ...); int status...

    使用Java抓取网页数据

    一、使用 HttpClient 抓取网页数据 public String getHtml(String htmlurl) throws IOException { StringBuffer sb = new ... GetMethod method = new GetMethod(htmlurl); int statusCode; try { status

    HttpClient介绍和使用文档

    GetMethod method = new GetMethod("http://java.sun.com"); int statusCode = client.executeMethod(method); if (statusCode == HttpStatus.SC_OK) { System.out.println("Response status code: " + status...

    轻松把玩HttpClient-032217531

    GetMethod getMethod = new GetMethod("http://example.com"); int statusCode = httpClient.executeMethod(getMethod); if (statusCode == HttpStatus.SC_OK) { InputStream is = getMethod....

    httpClient学习.doc

    getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler()); try { int statusCode = httpClient.executeMethod(getMethod); if (statusCode != ...

    java发送邮件代码

    GetMethod method = new GetMethod(url); try { client.executeMethod(method); InputStream is = method.getResponseBodyAsStream(); Reader reader = new InputStreamReader(is, "UTF-8"); char[] cbuf = ...

    Java反射方法调用

    Method method = clazz.getMethod("yourMethodName"); method.invoke(instance); ``` 对于含有Object类型参数的方法,我们需要将参数对象作为`invoke()`方法的第二个参数传入。假设我们有一个接受String参数的方法...

Global site tag (gtag.js) - Google Analytics