/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.net;

import org.eclipse.swt.widgets.*;

import com.google.gwt.core.client.JavaScriptObject;

public class HttpRequest implements GWTUtil.RESTHandler {
	private static final int OK_STATUS = 200;
	String url;
	Listener listener;
	static int counter = 0;
	
public HttpRequest () {
}

public void setURL (String url) {
	this.url = url;
}

public void setUseProxy (boolean useProxy) {
}

public void setFormat (String format) {
}

public void addListener (Listener listener) {
	this.listener = listener;
}

public void invoke () {
	GWTUtil.makeRESTRequest(url, this, "callMe" + counter++);
}

public void handleREST(JavaScriptObject obj) {
	Event event = new Event();
	event.data = obj;
	listener.handleEvent(event);
}


	
	
}
