title: passing special character in jax-rs webservice
body: <p>I have two jax-rs webservices: <strong>WS1</strong> and <strong>WS2</strong>. </p>
  
  <p>Also I have an html form that user add some text and when click submit button call WS1 or WS2 and send an xml file via post.</p>
  
  <p>The xml file look like:</p>
  
  <pre><code>&lt;documents&gt;
  &lt;document&gt; some text 1 &lt;/document&gt;
  &lt;document&gt; some text 2 &lt;/document&gt;
  &lt;/documents&gt;
  </code></pre>
  
  <p>When I call <strong>ws1</strong> or <strong>ws2</strong> from html form, xml file passes without problem.</p>
  
  <p>But when I try to call <strong>ws1</strong> from <strong>ws2</strong>, I can't send xml file which contains special characters in element "document". (don't send all xml file)</p>
  
  <p>So my question is how can I pass xml file that contains special characters or how can replace all special characters?</p>
  
  <p><strong>Call wb1</strong></p>
  
  <pre><code> public String sendPost(String value) throws Exception {
              String url = "http://localhost:8084//wb1";
              URL obj = new URL(url);
              HttpURLConnection con =  (HttpURLConnection) obj.openConnection();
              con.setRequestMethod("POST");
              String urlParameters = "xmlinput=" + value;
  
              // Send post request
              con.setDoOutput(true);
              java.io.BufferedOutputStream wr = new BufferedOutputStream(con.getOutputStream());
              wr.write(urlParameters.getBytes());
              wr.flush();
              wr.close();
  
              //response
              BufferedReader in = new BufferedReader(
                      new InputStreamReader(con.getInputStream()));
              String inputLine;
              StringBuffer response = new StringBuffer();
  
              while ((inputLine = in.readLine()) != null) {
                  System.out.println(inputLine);
                  response.append(inputLine);
              }
              in.close();
  
  
              return response.toString();
          }
  </code></pre>
  
  <p><strong>wb1:</strong></p>
  
  <pre><code> @POST
   @Produces("application/xml")
   public String getXml(@FormParam("xmlinput") String xmlinput) throws Exception {
       //some code
   }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>for example I have this string: </p>
  
  <blockquote>
    <p>RT @<em>CEJA</em>: CEJA President @BartoliniMatteo with S&amp;amp;D COMAGRI
    coordinator @paolodecastro. @EP_Agriculture @TheProgressives
    <a href="http://t.co/65xi4">http://t.co/65xi4</a>…</p>
  </blockquote>
  
  <p>I want to replace &amp;amp; with black space. </p>
  
  <p>I try with <strong>String.replaceAll("\W", " ");</strong> but 1) replace only &amp;; etc 2) I want to keep links without modification</p>