调用setRequestMethod("get")方法,弹出错误

   阅读
调用setRequestMethod("get")方法,弹出异常
各位大侠,我想用Http方式获取网络上一张图片
Java code

HttpURLConnection httpConn;
            try {
                URL url=new URL(path);
                httpConn = (HttpURLConnection)url.openConnection();
                httpConn.setConnectTimeout(5*1000);
                httpConn.setRequestMethod("get");
                int code=httpConn.getResponseCode();    
                Log.d(tag,"Responsecode is "+code);
                InputStream ipStream=httpConn.getInputStream();
                int len=-1;
                ByteArrayOutputStream otStream=new ByteArrayOutputStream();
                while((len=ipStream.read(bt))!=-1){
                  otStream.write(bt, 0, len);
                }
                ipStream.close();
                otStream.close();
                return otStream.toByteArray();
            
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
                Log.d(tag, "IOException.."+e1.toString());
            }


运行到setRequestMethod方法时弹出异常,我不知道如何找原因,请大侠们指点。

------解决方案--------------------
要么地址错了,要么设置条件的前后顺序错了,建议你百度两下看看别人get请求的顺序是不是一样,没问题发话就是地址错了。。。其实最有可能的是大小写,GET
阅读