Package javax.microedition.io

Examples of javax.microedition.io.HttpConnection


  TweetPhotoResponse deleteFavorite(long userId, long photoId) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/favorites/" + photoId;

    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "DELETE", this, false);
          m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomTweetPhotoResponseParser responseParser = new DomTweetPhotoResponseParser();
        responseParser.m_Xml = xml;
        TweetPhotoResponse response = (TweetPhotoResponse)responseParser.parse();
        content.close();
View Full Code Here


  AddPhotoCommentResponse comment(long userId, long photoId, String commentText) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/comments/" + photoId + ";deviceside=true";

    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), commentText.getBytes(), getCoverageBasedConnectionType(), "POST", this, false);
          m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 201) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomAddCommentResponseParser responseParser = new DomAddCommentResponseParser();
        responseParser.m_Xml = xml;       
        AddPhotoCommentResponse response = (AddPhotoCommentResponse)responseParser.parse();
        content.close();
View Full Code Here

  TweetPhotoResponse deleteComment(long userId, long photoId, long commentId) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/comments/" + photoId + "/" + commentId + ";deviceside=true";

    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "DELETE", this, false);
          m_httpStatus = httpConn.getResponseCode();

      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomTweetPhotoResponseParser responseParser = new DomTweetPhotoResponseParser();
        responseParser.m_Xml = xml;
        TweetPhotoResponse response = (TweetPhotoResponse)responseParser.parse();
        content.close();
View Full Code Here

    // Get friends
    Profiles friends(long userId, int ps, int ind, String sort) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/friends?ps=" + ps + "&ind=" + ind + "&sort=" + sort + ";deviceside=true";
    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "GET", this, false);
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomProfilesParser profilesParser = new DomProfilesParser();
        profilesParser.m_Xml = xml;
        Profiles profiles = profilesParser.parse();
        content.close();
View Full Code Here

   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/link" + ";deviceside=true";

    try {         
      String xmlBlob = "<LinkedProfile xmlns=\"http://tweetphotoapi.com\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><APIKey>" + apiKey + "</APIKey><IdentitySecret>" + identitySecret + "</IdentitySecret><IdentityToken>" + identityToken + "</IdentityToken><Service>" + serviceName + "</Service></LinkedProfile>";
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), xmlBlob.getBytes(), getCoverageBasedConnectionType(), "POST", this, false);
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomTweetPhotoResponseParser responseParser = new DomTweetPhotoResponseParser();
        responseParser.m_Xml = xml;
        TweetPhotoResponse response = responseParser.parse();
        content.close();
View Full Code Here

    TweetPhotoResponse unlinkService(String serviceName) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/unlink/" + serviceName + ";deviceside=true";

    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "DELETE", this, false);
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomTweetPhotoResponseParser responseParser = new DomTweetPhotoResponseParser();
        responseParser.m_Xml = xml;
        TweetPhotoResponse response = responseParser.parse();
        content.close();
View Full Code Here

    Profiles linkedServices() {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/profiles" + ";deviceside=true";

    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "GET", this, false);
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomProfilesParser profilesParser = new DomProfilesParser();
        profilesParser.m_Xml = xml;
        Profiles profiles = profilesParser.parse();
        content.close();
View Full Code Here

    // Get all friends
    Profiles friends(long userId, String sort) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/friends?sort=" + sort + ";deviceside=true";
    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "GET", this, false);             
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomProfilesParser profilesParser = new DomProfilesParser();
        profilesParser.m_Xml = xml;
        Profiles profiles = profilesParser.parse();
        content.close();
View Full Code Here

    // Get photo comments
    Comments photoComments(long photoId, int ps, int ind) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/photos/" + photoId + "/comments?ps=" + ps + "&ind=" + ind + "&sort=desc" + ";deviceside=true";
    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "GET", this, false);             
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomCommentsParser commentParser = new DomCommentsParser();
        commentParser.m_Xml = xml;       
        Comments comments = commentParser.parse();
        content.close();        
View Full Code Here

    // Get user comments
    Comments userComments(long userId, int ps, int ind, String sort) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/comments?ps=" + ps + "&ind=" + ind + "&sort=" + sort + ";deviceside=true";
    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "GET", this, false);             
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomCommentsParser commentParser = new DomCommentsParser();
        commentParser.m_Xml = xml;       
        Comments comments = commentParser.parse();
        content.close();
View Full Code Here

TOP

Related Classes of javax.microedition.io.HttpConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.