src/main/java/com/sourcesense/confluence/servlets/CMISProxyServlet.java
private void handleContentPost(PostMethod postMethodProxyRequest, HttpServletRequest httpServletRequest) throws IOException, ServletException {
    StringBuilder content = new StringBuilder();
    BufferedReader reader = httpServletRequest.getReader();
    for (; ;) {
      String line = reader.readLine();
      if (line == null)
        break;
      content.append(line);
    }

    String contentType = httpServletRequest.getContentType();
    String postContent = content.toString();

    if (contentType.startsWith("text/x-gwt-rpc")) {
      String clientHost = httpServletRequest.getLocalName();
      if (clientHost.equals("127.0.0.1")) {
        clientHost = "localhost";
      }

      int clientPort = httpServletRequest.getLocalPort();
      String clientUrl = clientHost + ((clientPort != 80) ? ":" + clientPort : "");
      String serverUrl = stringProxyHost + ((intProxyPort != 80) ? ":" + intProxyPort : "") + httpServletRequest.getServletPath();
      //debug("Replacing client (" + clientUrl + ") with server (" + serverUrl + ")");
      postContent = postContent.replace(clientUrl, serverUrl);
    }

    String encoding = httpServletRequest.getCharacterEncoding();
    debug("POST Content Type: " + contentType + " Encoding: " + encoding, "Content: " + postContent);
    StringRequestEntity entity;
    try {
      entity = new StringRequestEntity(postContent, contentType, encoding);
    } catch (UnsupportedEncodingException e) {
      throw new ServletException(e);
    }
    // Set the proxy request POST data
    postMethodProxyRequest.setRequestEntity(entity);
  }
/**
   * Sets up the given {@link PostMethod} to send the same content POST
   * data (JSON, XML, etc.) as was sent in the given {@link HttpServletRequest}
   *
   * @param postMethodProxyRequest The {@link PostMethod} that we are
   *                               configuring to send a standard POST request
   * @param httpServletRequest     The {@link HttpServletRequest} that contains
   *                               the POST data to be sent via the {@link PostMethod}
   * @throws java.io.IOException This can happen in different places in the code, e.g. when the request is empty
   * @throws javax.servlet.ServletException When the requested character encoding is not supported
   */
Sets up the given  PostMethod to send the same content POST
data (JSON, XML, etc.) as was sent in the given  HttpServletRequest

@param postMethodProxyRequest The  PostMethod that we are
configuring to send a standard POST request
@param httpServletRequest     The  HttpServletRequest that contains
the POST data to be sent via the  PostMethod
@throws java.io.IOException This can happen in different places in the code, e.g. when the request is empty
@throws javax.servlet.ServletException When the requested character encoding is not supported
Sets up the given PostMethod to send the same content POST data ( JSON XML etc . ) as was sent in the given HttpServletRequest @param postMethodProxyRequest The PostMethod that we are configuring to send a standard POST request @param httpServletRequest The HttpServletRequest that contains the POST data to be sent via the PostMethod @throws java . io . IOException This can happen in different places in the code e . g . when the request is empty @throws javax . servlet . ServletException When the requested character encoding is not supported
private void handleContentPost(PostMethod postMethodProxyRequest, HttpServletRequest httpServletRequest) throws IOException, ServletException {
    StringBuilder content = new StringBuilder();
    BufferedReader reader = httpServletRequest.getReader();
    for (; ;) {
      String line = reader.readLine();
      if (line == null)
        break;
      content.append(line);
    }
    String contentType = httpServletRequest.getContentType();
    String postContent = content.toString();
    if (contentType.startsWith("text/x-gwt-rpc")) {
      String clientHost = httpServletRequest.getLocalName();
      if (clientHost.equals("127.0.0.1")) {
        clientHost = "localhost";
      }
      int clientPort = httpServletRequest.getLocalPort();
      String clientUrl = clientHost + ((clientPort != 80) ? ":" + clientPort : "");
      String serverUrl = stringProxyHost + ((intProxyPort != 80) ? ":" + intProxyPort : "") + httpServletRequest.getServletPath();
      postContent = postContent.replace(clientUrl, serverUrl);
    }
    String encoding = httpServletRequest.getCharacterEncoding();
    debug("POST Content Type: " + contentType + " Encoding: " + encoding, "Content: " + postContent);
    StringRequestEntity entity;
    try {
      entity = new StringRequestEntity(postContent, contentType, encoding);
    } catch (UnsupportedEncodingException e) {
      throw new ServletException(e);
    }
    postMethodProxyRequest.setRequestEntity(entity);
  }
private void handleContentPost ( PostMethod postMethodProxyRequest , HttpServletRequest httpServletRequest ) throws IOException , ServletException { StringBuilder content = new StringBuilder ( ) ; BufferedReader reader = httpServletRequest . getReader ( ) ; for ( ; ; ) { String line = reader . readLine ( ) ; if ( line == null ) break ; content . append ( line ) ; } String contentType = httpServletRequest . getContentType ( ) ; String postContent = content . toString ( ) ; if ( contentType . startsWith ( "text/x-gwt-rpc" ) ) { String clientHost = httpServletRequest . getLocalName ( ) ; if ( clientHost . equals ( "127.0.0.1" ) ) { clientHost = "localhost" ; } int clientPort = httpServletRequest . getLocalPort ( ) ; String clientUrl = clientHost + ( ( clientPort != 80 ) ? ":" + clientPort : "" ) ; String serverUrl = stringProxyHost + ( ( intProxyPort != 80 ) ? ":" + intProxyPort : "" ) + httpServletRequest . getServletPath ( ) ; postContent = postContent . replace ( clientUrl , serverUrl ) ; } String encoding = httpServletRequest . getCharacterEncoding ( ) ; debug ( "POST Content Type: " + contentType + " Encoding: " + encoding , "Content: " + postContent ) ; StringRequestEntity entity ; try { entity = new StringRequestEntity ( postContent , contentType , encoding ) ; } catch ( UnsupportedEncodingException e ) { throw new ServletException ( e ) ; } postMethodProxyRequest . setRequestEntity ( entity ) ; }
Sets up the given {@link PostMethod} to send the same content POST
 data (JSON, XML, etc.)
Sets up the given { @link PostMethod } to send the same content POST data ( JSON XML etc . )
//debug("Replacing client (" + clientUrl + ") with server (" + serverUrl + ")");
 // Set the proxy request POST data
