Re: ?meterware? WebConversation jar
On Wed, 27 May 2009 11:45:28 +0000, Thufir wrote:
Well, I didn't have the correct imports, and I suppose meterware is
legitimate. I didn't know that sax was required too. Anyhow, fixed:
package auth;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import java.io.IOException;
import java.net.MalformedURLException;
import static java.lang.System.out;
import org.xml.sax.SAXException;
public class Main {
private static String userPrefix, userSuffix = "@gmail.com", user,
password;
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws MalformedURLException,
AuthenticationException, IOException, ServiceException, SAXException {
String sURL = "http://carcruises.com/" +
"cruise_list.asp?month_select=6&" +
"state=Pennsylvania";
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(sURL);
WebResponse response = conversation.getResponse(request);
out.println(response);
}
}
This would be a standard approach to doing something like:
1. First, get a valid SID token:
curl https://www.google.com/accounts/ClientLogin
-d Email=just_your_username_here_without_at_gmail_dot_com
-d Passwd=your_password_here
-d source=Google-cURL-Example
-d service=reader
http://blogs.igalia.com/dpino/?cat=5
programatically from Java? I wanted to use libcurl for Java but couldn't
find any sample java code.
thanks,
Thufir