我正在尝试String[]使用 j2me 发送一个数组ObjectOUputStream,但我不断收到此错误,
java.lang.IllegalArgumentException:不是 HTTP URL
这是我的代码:
    OutputStream os=null;
    HttpConnection hc= null;
    ObjectOutputStream oj=null;
    //get the URL
    String serverURL=entry.getUrl();
    hc=(HttpConnection)Connector.open(serverURL, Connector.READ_WRITE, true);
    hc=(HttpConnection)Connector.open(serverURL);
    hc.setRequestMethod (HttpConnection.POST);
    hc.setRequestProperty ("Content-Type", "application/x-www-form-urlencoded");
    hc.setRequestProperty ("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0");
    hc.setRequestProperty ("Content-Language", "en-US");
    System.out.println ("Posting to the URL: " + entry.getVectorParams());
    //open the output stream to send the post parameters
    //os=hc.openOutputStream();
    oj=(ObjectOutputStream)hc.openOutputStream();
    //writing post parameters
    String[] bg=entry.getVectorParams();
    oj.writeObject(bg);
请给个建议。
我检查了我的 URL,它是正确的,关于 Connector.open(),我在这里粘贴了两次,而不是在我的实际代码中。还有什么我做错了吗?
,System.out.println("Posting to the URL: " + entry.getVectorParams())这仅打印帖子参数,我在这里传递了serverurl:
String serverURL=entry.getUrl();
hc=(HttpConnection)Connector.open(serverURL, Connector.READ_WRITE, true);
我的服务器网址是:http://localhost:8080/Web/gServer.jsp