Package javax.microedition.io

Examples of javax.microedition.io.HttpConnection


  // Get Previous Photo
  Photo previous(long photoId) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/photos/" + photoId + "/previous" + ";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);
        DomPhotoParser photoParser = new DomPhotoParser();
        photoParser.m_Xml = xml;
        Photo photo = photoParser.parse();
        content.close();
View Full Code Here


  // Get Photo Metadata
  Photo photoMetaData(long photoId) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/photos/" + photoId + ";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);
        DomPhotoParser photoParser = new DomPhotoParser();
        photoParser.m_Xml = xml;
        Photo photo = photoParser.parse();
        content.close();
View Full Code Here

  // Get the user profile
  Profile userProfile(long userId) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + ";deviceside=true";
    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "GET", this, false);             
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200 && m_httpStatus != 201) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomProfileParser profileParser = new DomProfileParser();
        profileParser.m_Xml = xml;
        Profile profile = profileParser.parse();
        content.close();
View Full Code Here

  // Get the user profile
  Profile userProfile(String userName) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userName + ";deviceside=true";
    try {
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "GET", this, false);             
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200 && m_httpStatus != 201) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomProfileParser profileParser = new DomProfileParser();
        profileParser.m_Xml = xml;
        Profile profile = profileParser.parse();
        content.close();
View Full Code Here

  Settings settings(long userId) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/settings" + ";deviceside=true";
   
    try {         
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "GET", this, false);             
      m_httpStatus = httpConn.getResponseCode();
    
      if (m_httpStatus != 200 && m_httpStatus != 201) {
               System.out.println("Error: " + m_httpStatus);
      } else {
        InputStream content = httpConn.openInputStream();
        String xml = convertStreamToString(content);
        DomSettingsParser settingsParser = new DomSettingsParser();
        settingsParser.m_Xml = xml;
        Settings settings = settingsParser.parse();
        content.close();
View Full Code Here

  TweetPhotoResponse view(long userId, long photoId) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/views/" + photoId + ";deviceside=true";
   
    try {         
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, 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);
        DomTweetPhotoResponseParser responseParser = new DomTweetPhotoResponseParser();
        responseParser.m_Xml = xml;
        TweetPhotoResponse response = (TweetPhotoResponse)responseParser.parse();
        content.close();
View Full Code Here

  TweetPhotoResponse vote(long photoId, String voteCast) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/photos/" + photoId + "/" + voteCast + ";deviceside=true";
   
    try {         
      HttpConnection httpConn = HttpUtils.makeHttpConnection(urlToRequest, new HttpHeaders(), null, getCoverageBasedConnectionType(), "PUT", 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 favorite status for a photo
  FavoriteQueryResponse favoriteStatus(long userId, long photoId) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/favorites/" + photoId + ";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);
        DomFavoriteQueryResponseParser favoriteParser = new DomFavoriteQueryResponseParser();
        favoriteParser.m_Xml = xml;
        FavoriteQueryResponse favoriteStatus = favoriteParser.parse();
        content.close();
View Full Code Here

  // Get all photos
  Photos photos(long userId, String sort) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/photos?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);
        DomPhotosParser photoParser = new DomPhotosParser();
        photoParser.m_Xml = xml;
        Photos photos = photoParser.parse();
        content.close();
View Full Code Here

  // Get photos
  Photos photos(long userId, int ps, int ind, String sort) {
   
    String urlToRequest       = "http://tweetphotoapi.com/api/tpapi.svc/users/" + userId + "/photos?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);
        DomPhotosParser photoParser = new DomPhotosParser();
        photoParser.m_Xml = xml;
        Photos photos = photoParser.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.