Android Open Source - YesNoGame Request Url Params






From Project

Back to project page YesNoGame.

License

The source code is released under:

GNU General Public License

If you think the Android project YesNoGame listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package example.swa.yesnogame.service.util;
//from w ww  .  j  a  va 2 s .c om
import java.net.URI;
import java.net.URISyntaxException;

import android.util.Log;

/**
 * Represents all parameters needed to request the remote service via
 * RequestUrlTask. Immutable Type.
 */
public class RequestUrlParams {

  public interface IResponseListener {
    void onResponse(String text);
  }

  /**
   * Method type. see static constants METHOD_...
   */
  private RequestMethodEnum method;

  /**
   * The data to be posted.
   */
  private String postData;

  /**
   * The URI to be called.
   */
  private URI uri;

  /**
   * The listener to be called when the background task finished.
   */
  private IResponseListener listener;

  /**
   * The data to be put in the PUT method call.
   */
  private String putData;

  private EntityFormatEnum format;

  public RequestUrlParams(RequestMethodEnum method, EntityFormatEnum format, String url, IResponseListener listener) {
    super();
    this.method = method;
    this.format = format;
    try {
      this.uri = new URI(url);
    } catch (URISyntaxException ex) {
      Log.e("YesNo", ex.toString());
    }
    this.listener = listener;
  }

  public RequestUrlParams(RequestMethodEnum method, String url, IResponseListener listener) {
    super();
    this.method = method;
    this.format = EntityFormatEnum.UNDEFINED;
    try {
      this.uri = new URI(url);
    } catch (URISyntaxException ex) {
      Log.e("YesNo", ex.toString());
    }
    this.listener = listener;
  }

  public EntityFormatEnum getEntityFormat() {
    return this.format;
  }

  public IResponseListener getListener() {
    return this.listener;
  }

  public RequestMethodEnum getMethod() {
    return this.method;
  }

  public String getPostData() {
    return this.postData;
  }

  public String getPutData() {
    return this.putData;
  }

  public URI getUri() {
    return this.uri;
  }

  public void setEntityFormat(EntityFormatEnum format) {
    this.format = format;
  }

  public void setListener(IResponseListener listener) {
    this.listener = listener;
  }

  public void setMethod(RequestMethodEnum method) {
    this.method = method;
  }

  public void setPostData(String postData) {
    this.postData = postData;
  }

  public void setPutData(String putData) {
    this.putData = putData;
  }

  public void setUri(URI uri) {
    this.uri = uri;
  }

}




Java Source Code List

example.swa.yesnogame.BaseActivity.java
example.swa.yesnogame.InitPollActivity.java
example.swa.yesnogame.MainActivity.java
example.swa.yesnogame.PollResultActivity.java
example.swa.yesnogame.VoteActivity.java
example.swa.yesnogame.domain.Poll.java
example.swa.yesnogame.domain.User.java
example.swa.yesnogame.domain.Vote.java
example.swa.yesnogame.domain.dto.PollSimpleDto.java
example.swa.yesnogame.domain.dto.UserSimpleDto.java
example.swa.yesnogame.domain.dto.VoteSimpleDto.java
example.swa.yesnogame.domain.simple.BaseObject.java
example.swa.yesnogame.domain.simple.PollSimple.java
example.swa.yesnogame.domain.simple.UserSimple.java
example.swa.yesnogame.domain.simple.VoteSimple.java
example.swa.yesnogame.domain.util.PollComparator.java
example.swa.yesnogame.domain.util.VoteComparator.java
example.swa.yesnogame.service.IPollService.java
example.swa.yesnogame.service.PollServiceBase.java
example.swa.yesnogame.service.PollServiceCloud.java
example.swa.yesnogame.service.PollServiceMock.java
example.swa.yesnogame.service.PollServiceProvider.java
example.swa.yesnogame.service.PollService.java
example.swa.yesnogame.service.util.EntityFormatEnum.java
example.swa.yesnogame.service.util.RequestMethodEnum.java
example.swa.yesnogame.service.util.RequestUrlParams.java
example.swa.yesnogame.service.util.RequestUrlTask.java
example.swa.yesnogame.ui.YesNoArrayAdapter.java