Discussion:
[Mayan EDMS: 2392] Problem creating a document from Java
RW Shore
2018-03-24 13:20:02 UTC
Permalink
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: ***@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 mayan-edms+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Michael Price
2018-03-30 21:41:17 UTC
Permalink
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
Post by 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?
===== Client request context =====
Acceptable languages: [*]
Acceptable media types: [*/*]
Cookies: {}
Date: null
{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
[org.glassfish.jersey.client.authentication.HttpAuthenticationFilter.operation]
Request method: POST
URI: http://localhost:29980/api/documents/documents/
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]
{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 mayan-edms+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...