[Mayan EDMS: 2392] Problem creating a document from Java

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 2392] Problem creating a document from Java

RW Shore
Mayan version: NG 2.8

I'm writing a Mayan dump/restore application in Java. The dump works fine. However, I'm having issues creating a new document. Mayan is returning status 415 (Unsupported Media Type) when I do a post to api/documents/documents. Anybody see any obvious problems? Specifically, what mime type is Mayan NG expecting?

This is what my logs report:

===== Client request context =====
  Acceptable languages: [*]
  Acceptable media types: [*/*]
  Cookies: {}
  Date: null
  Headers: {Content-Type=[multipart/mixed;boundary=Boundary_1_597364637_1521896466171], Authorization=[Basic YWRtaW46VFZPUl9wYXNzd29yZDoyNDE5], User-Agent=[Jersey/2.26 (HttpUrlConnection 1.8.0_161)], MIME-Version=[1.0]}
  Language: null
  Media type: multipart/mixed;boundary=Boundary_1_597364637_1521896466171
  Property names: [org.glassfish.jersey.client.authentication.HttpAuthenticationFilter.operation]
  Request method: POST
  URI: http://localhost:29980/api/documents/documents/
  Entity: org.glassfish.jersey.media.multipart.MultiPart@40e10ff8
  Entity annotations: []
  Entity class: class org.glassfish.jersey.media.multipart.MultiPart
  Entity type: class org.glassfish.jersey.media.multipart.MultiPart

===== Client response context =====
  Allowed methods: [HEAD, POST, GET, OPTIONS]
  Cookies: {csrftoken=csrftoken=6n9IWgPoe8X2zpXPEtW1LBg8zqZ4SKCPrV8rpXUCbvYII0OlYHAdXElgkhkzdYEn;Version=1;Path=/;Max-Age=31449600;Expires=Sat, 23 Mar 2019 13:01:06 GMT}
  Date: Sat Mar 24 09:01:06 EDT 2018
  Entity tag: null
  Headers: {Transfer-Encoding=[chunked], X-Frame-Options=[SAMEORIGIN], Server=[nginx/1.10.3 (Ubuntu)], Connection=[keep-alive], Vary=[Accept, Accept-Language, Cookie], Set-Cookie=[csrftoken=6n9IWgPoe8X2zpXPEtW1LBg8zqZ4SKCPrV8rpXUCbvYII0OlYHAdXElgkhkzdYEn; expires=Sat, 23-Mar-2019 13:01:06 GMT; Max-Age=31449600; Path=/], Date=[Sat, 24 Mar 2018 13:01:06 GMT], Content-Language=[en], Content-Type=[text/html; charset=utf-8], Allow=[GET, POST, HEAD, OPTIONS]}
  Language: en
  Last modified: null
  Length: -1
  Links: []
  Location: null
  Media type: text/html;charset=utf-8
  Status: Unsupported Media Type
  Status: 415

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 2397] Re: Problem creating a document from Java

Michael Price
There was an upgrade of the REST framework library. My guess is they added content type of encoding checking to the requests. Found this post as a quick fix until this can be debugged and fixed properly. -> https://stackoverflow.com/questions/22566433/http-415-unsupported-media-type-error-with-json#22643964


On Saturday, March 24, 2018 at 9:20:04 AM UTC-4, RW Shore wrote:
Mayan version: NG 2.8

I'm writing a Mayan dump/restore application in Java. The dump works fine. However, I'm having issues creating a new document. Mayan is returning status 415 (Unsupported Media Type) when I do a post to api/documents/documents. Anybody see any obvious problems? Specifically, what mime type is Mayan NG expecting?

This is what my logs report:

===== Client request context =====
  Acceptable languages: [*]
  Acceptable media types: [*/*]
  Cookies: {}
  Date: null
  Headers: {Content-Type=[multipart/mixed;boundary=Boundary_1_597364637_1521896466171], Authorization=[Basic YWRtaW46VFZPUl9wYXNzd29yZDoyNDE5], User-Agent=[Jersey/2.26 (HttpUrlConnection 1.8.0_161)], MIME-Version=[1.0]}
  Language: null
  Media type: multipart/mixed;boundary=Boundary_1_597364637_1521896466171
  Property names: [org.glassfish.jersey.client.authentication.HttpAuthenticationFilter.operation]
  Request method: POST
  URI: <a href="http://localhost:29980/api/documents/documents/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A29980%2Fapi%2Fdocuments%2Fdocuments%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEreedQTyKt-ZQV66EW5W22u2cK0w&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A29980%2Fapi%2Fdocuments%2Fdocuments%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEreedQTyKt-ZQV66EW5W22u2cK0w&#39;;return true;">http://localhost:29980/api/documents/documents/
  Entity: org.glassfish.jersey.media.multipart.MultiPart@40e10ff8
  Entity annotations: []
  Entity class: class org.glassfish.jersey.media.multipart.MultiPart
  Entity type: class org.glassfish.jersey.media.multipart.MultiPart

===== Client response context =====
  Allowed methods: [HEAD, POST, GET, OPTIONS]
  Cookies: {csrftoken=csrftoken=6n9IWgPoe8X2zpXPEtW1LBg8zqZ4SKCPrV8rpXUCbvYII0OlYHAdXElgkhkzdYEn;Version=1;Path=/;Max-Age=31449600;Expires=Sat, 23 Mar 2019 13:01:06 GMT}
  Date: Sat Mar 24 09:01:06 EDT 2018
  Entity tag: null
  Headers: {Transfer-Encoding=[chunked], X-Frame-Options=[SAMEORIGIN], Server=[nginx/1.10.3 (Ubuntu)], Connection=[keep-alive], Vary=[Accept, Accept-Language, Cookie], Set-Cookie=[csrftoken=6n9IWgPoe8X2zpXPEtW1LBg8zqZ4SKCPrV8rpXUCbvYII0OlYHAdXElgkhkzdYEn; expires=Sat, 23-Mar-2019 13:01:06 GMT; Max-Age=31449600; Path=/], Date=[Sat, 24 Mar 2018 13:01:06 GMT], Content-Language=[en], Content-Type=[text/html; charset=utf-8], Allow=[GET, POST, HEAD, OPTIONS]}
  Language: en
  Last modified: null
  Length: -1
  Links: []
  Location: null
  Media type: text/html;charset=utf-8
  Status: Unsupported Media Type
  Status: 415

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.