I am trying to send a String[] array in j2me using ObjectOUputStream, but i keep getting this error,
java.lang.IllegalArgumentException: Not an HTTP URL
Here is my code:
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);
Please give a suggestion.
I checked my URL, it is correct and regarding Connector.open(), i pasted it twice here, not in my actual code. Is there anything else that I am doing wrong?
The System.out.println("Posting to the URL: " + entry.getVectorParams()), this only prints the post parameters, I have the serverurl passed in here:
String serverURL=entry.getUrl();
hc=(HttpConnection)Connector.open(serverURL, Connector.READ_WRITE, true);
My server URL is : http://localhost:8080/Web/gServer.jsp