I have a POST Request sent with Postman as follows:
Headers:
Content-Type: x-www-form-url-encoded
Content-Length: calculated when request is sent
Host: calculated when request is sent
User-Agent: PostmanRuntime/7.26.5
Accept: */*
Accept-Encoding: gzip, deflate, br
Connection: Keep-Alive
Body:
Key Value
---------------------------------------------
Value ASDSFSDFDSFSDFSDFS..[ecc]
Until now I was able to send the request to a .jsp
build as follows:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
....
Now I want to send this POST Request
to a Jersey REST Controller
to my webapp; the REST Controller is similar to follows:
@Path("/api")
public class LoginResources {
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/login")
public void logIn(HttpServletRequest request) {
...
}
}
I didn't manage to do this because of this error:
HTTP Status 415 – Unsupported Media Type
Any idea??
Solved this way:
Hope helps..