How to set post parameters on using Alamofire in swift
<p>I am using Alamofire in swift to send http request/post to server. Below is the code I used in swift.</p>

<pre><code>Alamofire.request(.POST, "http://localhost:8080/hello", headers: [ACCESS_TOKEN:token, "Content-Type":"application/x-www-form-urlencoded"  ],
            parameters:["friend_id" : friendId, "skill_id" : skillId]).response(completionHandler: {
                (request, response, data, error) in
                print(request)
                print(response)
                print(data)
                print(error)
            })
</code></pre>

<p>Below is the code defined in server side:</p>

<pre><code>@POST
@Path("/hello")
@Produces(MediaType.APPLICATION_JSON)
public Response nominateSkill(@Context HttpServletRequest request, @FormParam("friend_id") long friendId, @FormParam("skill_id") int skillId) {
    // ...
}
</code></pre>

<p>When I run the swift code, I always got below error message in server side:</p>

<pre><code>A servlet request to the URI http://localhost:8080/hello contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected.
</code></pre>

<p>I think the problem would be coursed by the swift code which didn't set the parameter correctly. But I don't know how to set them correctly?</p>