import com.google.appengine.api.urlfetch.*;
import static com.google.appengine.api.urlfetch.HTTPMethod.POST;
import static
com.google.appengine.api.urlfetch.FetchOptions.Builder.withDeadline;
import static
com.google.appengine.api.urlfetch.URLFetchServiceFactory.getURLFetchService;
public class PostClass {
public void postMethod() throws Exception {
HTTPRequest req = new HTTPRequest("http://www.example.com/comment",
POST, withDeadline(10.0));
req.setHeader(new HTTPHeader("x-header-one", "some header"));
String params = "x=y&y=z&z=abc";
req.setPayload(params.getBytes());
HTTPResponse resp = getURLFetchService().fetch(req);
if (resp != null) {
int responseCode = resp.getResponseCode();
List<HTTPHeader> headers = resp.getHeaders();
byte[] content = resp.getContent();
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.