title: Ajax post call to a rest service through servlet
body: <p>I have a little problem:
  I'm developing a jQuery Mobile app and i need to make an ajax post call to a rest service.
  I create the pages dynamically using servlets.</p>
  
  <p>I tried to make the ajax call to the rest url:</p>
  
  <pre><code>http://localhost:8181/myRestServicePath/func?key=value
  </code></pre>
  
  <p>from a page whit the following url:</p>
  
  <pre><code>http://localhost:8080/Mypage
  </code></pre>
  
  <p>but i get a cross-orign error from the browser.</p>
  
  <p>So i'm tryng to perform this call, passing through a Java servlet using the doPost() method.</p>
  
  <p>Now, my intent is to make an ajax post call from </p>
  
  <pre><code> http://localhost:8080/Mypage
  </code></pre>
  
  <p>to:</p>
  
  <pre><code> http://localhost:8080/myServletPath/func?key=value
  </code></pre>
  
  <p>and this servlet should redirect the POST request to my RestService:</p>
  
  <pre><code>http://localhost:8181/myRestServicePath/func?key=value
  </code></pre>
  
  <p>How can i perform this redirection?</p>