title: Servlet in AEM, body in POST request is lost
body: <p>I created a custom tool in AEM and I wanted the custom tool to call a servlet(POST json).</p>
  <p>The servlet was called but, request.getParameterMap() return empty map.</p>
  <p>My servlet code is</p>
  <pre><code>@Component(
      service=Servlet.class,
      property={
          Constants.SERVICE_DESCRIPTION + &quot;=Custom Servlet&quot;,
          &quot;sling.servlet.methods=&quot; + HttpConstants.METHOD_POST,
          &quot;sling.servlet.paths=&quot; + &quot;/apps/myapp/customServlet&quot;
      }
  )
  public class CustomServlet extends SlingAllMethodsServlet{
      @Override
      protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
              throws IOException {
                  String method = request.getMethod(); // method POST OK
                  Map map = request.getParameterMap(); // return map but empty
                  String name = request.getParameter(&quot;foo&quot;); // also this return null
                  
                  response.setStatus(SlingHttpServletResponse.SC_OK);
                  response.setContentType(&quot;application/json;charset=UTF-8&quot;);
                  response.getWriter().print(&quot;{\&quot;response message\&quot; : \&quot;&quot; + foo + &quot;\&quot;}&quot;);
              }
  }
  
  </code></pre>
  <p>and my JS code(loaded to AEM custom tool page as a client library)</p>
  <pre><code>window.onload = function() {
      var url = '/apps/myapp/customServlet';
      var button = document.getElementById('btnSubmit');
  
      button.addEventListener('click', event =&gt; {
  
  
          var foo = document.getElementById('foo').value;
          if (foo.length &lt; 1){
              alert(&quot;input required!!&quot;);
          } else {
              var requestData = {};
              requestData.foo= foo;
              console.log(requestData); // it is ok
              postData(url,requestData).then(data =&gt; {console.log(data);}); // got {response message:null}
          }
  
      });
  }
  
  async function postData(url, data){
      const response = await fetch(url, {
          method: 'POST',
          headers: {
              'Content-Type': 'application/json',
  
          },
          body: JSON.stringify(data)
      });
      return response.json();
  }
  
  </code></pre>
  <p>In addition, I deleted POST at filter methods in Adobe Granite CSRF Filter Config.</p>
  <p>Do I need any other OSGi config or something wrong with my code to use Post Servlet in AEM?</p>