title: How to resolve 415 unsupported media type error?
body: <p>I have angular 5 which try to send PUT request to a rest service in java application:</p>
  
  <p><strong>The Angular call:</strong></p>
  
  <pre><code>    ...
      import 'rxjs/add/operator/toPromise';
  
      const httpOptions = {
          headers: new HttpHeaders({ 'Accept': 'application/json', 'Content-Type': 'application/json' })
      };
  
      @Injectable()
      export class TripService {
  
  ...
  
      saveTrip(trip: Trip): Observable&lt;any&gt; {
      return this.http.put(`${this.baseUrl}/Trip`, JSON.stringify(trip), httpOptions);
    }
  </code></pre>
  
  <p><strong>The server (java) service:</strong></p>
  
  <pre><code>@PUT
  @Consumes("application/json")
  public Response updateTrip(Trip trip) {
      tripDao.updateTrip(trip);
      return Response.ok().entity("trip updated successfully").build();
  }
  </code></pre>
  
  <p><strong>The entity!:</strong></p>
  
  <pre><code>@Entity
  @Table(name = "trip")
  @XmlRootElement
  public class Trip implements java.io.Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @XmlElement(name = "id")
      private Integer id;
      @XmlElement(name = "user")
      private User user;
      @XmlElement(name = "start_date")
      private Date startDate;
      ...
  </code></pre>
  
  <p><strong>Request header:</strong></p>
  
  <pre><code>Accept: application/json
  Accept-Encoding: gzip, deflate, br
  Accept-Language: en-US,en;q=0.9,he;q=0.8
  Authorization: Bearer fake-jwt-token
  Connection: keep-alive
  Content-Length: 538
  Content-Type: application/json
  Host: localhost:8080
  Origin: http://localhost:4200
  Referer: http://localhost:4200/manager/company
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 
  </code></pre>
  
  <p><strong>The error:</strong></p>
  
  <pre><code>Request URL: http://localhost:8080/... /rest/Trip
  Request Method: PUT
  Status Code: 415 Unsupported Media Type
  Remote Address: [::1]:8080
  Referrer Policy: no-referrer-when-downgrade
  </code></pre>
  
  <p>I need help with the JSON to Java conversion ?  I have this jar for example:
  javax.ws.rs-api-2.0.1</p>
  
  <p>I added the jackson jars which included currently in the project:
  <a href="https://i.stack.imgur.com/PeBl2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PeBl2.png" alt="jackson jars"></a></p>