Java Code Examples for javax.microedition.io.HttpConnection#GET

The following examples show how to use javax.microedition.io.HttpConnection#GET . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpClientConnection.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setRequestMethod(String method) throws IOException {
  if (!HttpConnection.GET.equals(method) &&
      !HttpConnection.HEAD.equals(method) &&
      !HttpConnection.POST.equals(method) &&
      !PUT_METHOD.equals(method) &&
      !DELETE_METHOD.equals(method)) {
    throw new IllegalArgumentException("method should be one of " +
                                       HttpConnection.GET + ", " +
                                       HttpConnection.HEAD + ", " +
                                       HttpConnection.POST + ", " +
                                       PUT_METHOD + " and " +
                                       DELETE_METHOD);
  }

  if (state == STATE_CLOSED) {
    init();
  }

  if (state != STATE_SETUP) {
    throw new ProtocolException("Can't reset method: already connected");
  }

  if (out != null && !(HttpConnection.POST.equals(method) || PUT_METHOD.equals(method))) {
    // When an outputstream has been created these calls are ignored.
    return ;
  }

  if (this.method != method && resCache != null) {
    // TODO: here we should convert an existing resCache
    throw new RuntimeException
      ("Not yet implemented, as a work around you can always set"
       +" the request method the first thing you do..");
  }

  this.method = method;
}
 
Example 2
Source File: HttpClientConnection.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void init() {
  state = STATE_SETUP;
  requestSent = false;
  method = HttpConnection.GET;
  resCache = null;
  //params = new DefaultHttpParams();
  out = null;
}
 
Example 3
Source File: HttpOperation.java    From pluotsorbet with GNU General Public License v2.0 2 votes vote down vote up
/**
 * The HTTP request method used by this Operation, as defined in the
 * interface javax.microedition.io.HttpConnection. GET by default.
 * Can be overridden for alternative request methods.
 *
 * @return HTTP method to use in request
 */
public String getRequestMethod() {
    return HttpConnection.GET;
}