title: Apache Abdera Client POST not posting to IBM Connections API
body: <p>I have a web service that is using the Apache Abdera lib to communicate with our IBM Connections 4 server's REST API.</p>
  
  <p>The problem I'm having, is that my request doesn't work. When I say that it is not working, I mean that all my GET operations work fine returning the data I'm after, but my first POST operation I tried to implement fails. My ClientResponse object returns with Type "REDIRECTION" and the StatusText "found". My data does not update on connections.</p>
  
  <p>Please note that I'm calling this service from a JSONP AJAX call due to Cross-Domain restrictions.(This webservice is on the same server and domain as our connections environment)</p>
  
  <p>Here is my code: (P.S. I'm a java noob trying to post a small micro blog entry to the connections status updates)</p>
  
  <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      JSONObject json;
      JSONObject rtn = new JSONObject();
      String rtnVal = "";
  
      String username = request.getParameter("username");
      String password = request.getParameter("password");
      String statusPost = request.getParameter("msg");
      String container = request.getParameter("container");
  
      String url = Authentication.uri+"/connections/opensocial/basic/rest/ublog/@me/@all";
      if(container != null){
          url += "/"+container+"/comments";
      }
  
      json = new JSONObject();
      json.put("content", statusPost);
      try {
          AbderaClient client = Authentication.getClient(Authentication.EMPTY, username, password, Authentication.uri);
          RequestOptions options = client.getDefaultRequestOptions();
          options.setFollowRedirects(true);
          InputStream inStream = new ByteArrayInputStream(json.toString().getBytes("UTF-8"));
  
          ClientResponse resp = client.post(url, inStream, options);
          rtn.put("Status", resp.getType() + " : " + resp.getStatusText());
      } catch (URISyntaxException e) {
          e.printStackTrace();
      }
  
      response.setContentType("application/json");
      PrintWriter out = response.getWriter();
      out.println(request.getParameter("callback")+ "(" + (rtn)+")");
  }
  </code></pre>
  
  <p>Here is the console.log() from my Ajax call : </p>
  
  <pre><code>Ext.data.JsonP.callback3({"Status":"REDIRECTION : Found"})
  </code></pre>