Greetings,

I have a JAX-RS resource which signature is as follows:

  @POST
  @Path("myPath")
  @Produces({MediaType.APPLICATION_OCTET_STREAM})
  @Consumes(MediaType.APPLICATION_JSON)
  public Response myResource(MyObject) throws Exception { ... }

where MyObject is defined as:

@XmlRootElement
public class MyObject
{
  @XmlElement
  private String[] params1;
  @XmlElement
  private String[] params2;
  
  public MyObject() 
  {
  }

  public String[] getParams1()
  {
    return params1;
  }

  public void setParams1(String[] params1)
  {
    this.params1 = params1;
  }

  public String[] getParams2()
  {
    return params2;
  }

  public void setParams2(String[] params2)
  {
    this.params2 = params2;
  }
}


I'm trying to call it as follows:

public myPost (params1: Array<String>, params2: Array<String>): 
Observable<Response> {
return this.http.post<Response>(this.url, JSON.stringify({params1: params1, 
params2: params2}));
}

The hole stuff is packaged as an EAR file and deployed on WebLogic 11g. The 
JAX-RS stack is Apache Jersey 1.9 which comes with the app server. Using 
another release of Jersey than the one comming with the app server is not 
an option.

Calling the endpoint as shown above raises HTTP 415 Unsuported Media Type. 
here is the console log.


   1. Request URL:
      http://localhost:7001/.../myPath
      2. Request Method:
      POST
      3. Status Code:
      415 Unsupported Media Type
      4. Remote Address:
      [::1]:7001
      5. Referrer Policy:
      no-referrer-when-downgrade
      1. Response Headersview source
      1. Content-Length:
      0
      2. Date:
      Fri, 25 Aug 2017 12:18:25 GMT
      3. X-Powered-By:
      Servlet/2.5 JSP/2.1
      2. Request Headersview source
      1. Accept:
      application/json, text/plain, */*
      2. Accept-Encoding:
      gzip, deflate, br
      3. Accept-Language:
      fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
      4. Connection:
      keep-alive
      5. Content-Length:
      48
      6. Content-Type:
      text/plain
      7. Cookie:
      
      
ADMINCONSOLESESSION=Y5MpZf5QQnzkcxJg6Yndy2vmvc49VMXzzY2ZJyxnRzfhk19TXZb0!-1658407021
      8. Host:
      localhost:7001
      9. Origin:
      http://localhost:7001
      10. Referer:
      http://localhost:7001/...
      11. User-Agent:
      Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, 
      like Gecko) Chrome/60.0.3112.101 Safari/537.36
      3. Request Payloadview source
      1. 
      1. {params1: ["DynamicBundle"], params2: ["en"]}
            1. params1:["DynamicBundle"]
            2. params2:["en"]
         
Calling the endpoint from an equivalent JAX-RS client works properly. What 
coud be the problem here ?

Many thanks in advance,
Nicolas 

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to