sdmxdzb / rest-client

Automatically exported from code.google.com/p/rest-client
Apache License 2.0
0 stars 0 forks source link

Response body in HEX format #171

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Do a Get that returns XML string
2.
3.

What is the expected output? What do you see instead?
Instead of the XML string

Getting it in HEX Mode
0000: 3C 3F 78 6D  6C 20 76 65  72 73 69 6F  6E 3D 22 31  | <?xml version="1 |
0010: 2E 30 22 20  65 6E 63 6F  64 69 6E 67  3D 22 55 54  | .0" encoding="UT |
0020: 46 2D 38 22  20 73 74 61  6E 64 61 6C  6F 6E 65 3D  | F-8" standalone= |
0030: 22 79 65 73  22 3F 3E 3C  62 61 74 63  68 3E 3C 69  | "yes"?><batch><i |
0040: 64 3E 32 3C  2F 69 64 3E  3C 73 6F 75  72 63 65 3E  | d>2</id><source> |
0050: 73 31 3C 2F  73 6F 75 72  63 65 3E 3C  73 74 61 74  | s1</source><stat |
0060: 65 3E 43 4F  4D 50 4C 45  54 45 44 3C  2F 73 74 61  | e>COMPLETED</sta |
0070: 74 65 3E 3C  63 72 65 61  74 65 64 41  74 3E 32 30  | te><createdAt>20 |
0080: 31 33 2D 30  34 2D 33 30  54 31 34 3A  35 37 3A 33  | 13-04-30T14:57:3 |
0090: 38 2D 30 34  3A 30 30 3C  2F 63 72 65  61 74 65 64  | 8-04:00</created |
00A0: 41 74 3E 3C  70 61 72 73  65 53 74 61  72 74 3E 32  | At><parseStart>2 |
00B0: 30 31 33 2D  30 34 2D 33  30 54 31 34  3A 35 37 3A  | 013-04-30T14:57: |
00C0: 33 38 2D 30  34 3A 30 30  3C 2F 70 61  72 73 65 53  | 38-04:00</parseS |
00D0: 74 61 72 74  3E 3C 70 61  72 73 65 45  6E 64 3E 32  | tart><parseEnd>2 |
00E0: 30 31 33 2D  30 34 2D 33  30 54 31 34  3A 35 37 3A  | 013-04-30T14:57: |
00F0: 33 38 2D 30  34 3A 30 30  3C 2F 70 61  72 73 65 45  | 38-04:00</parseE |
0100: 6E 64 3E 3C  65 6E 72 69  63 68 53 74  61 72 74 3E  | nd><enrichStart> |
0110: 32 30 31 33  2D 30 34 2D  33 30 54 31  34 3A 35 37  | 2013-04-30T14:57 |
0120: 3A 33 38 2D  30 34 3A 30  30 3C 2F 65  6E 72 69 63  | :38-04:00</enric |
0130: 68 53 74 61  72 74 3E 3C  65 6E 72 69  63 68 45 6E  | hStart><enrichEn |
0140: 64 3E 32 30  31 33 2D 30  34 2D 33 30  54 31 34 3A  | d>2013-04-30T14: |
0150: 35 37 3A 33  38 2D 30 34  3A 30 30 3C  2F 65 6E 72  | 57:38-04:00</enr |
0160: 69 63 68 45  6E 64 3E 3C  69 6E 63 6F  72 70 6F 72  | ichEnd><incorpor |
0170: 61 74 65 53  74 61 72 74  3E 32 30 31  33 2D 30 34  | ateStart>2013-04 |
0180: 2D 33 30 54  31 34 3A 35  37 3A 33 38  2D 30 34 3A  | -30T14:57:38-04: |
0190: 30 30 3C 2F  69 6E 63 6F  72 70 6F 72  61 74 65 53  | 00</incorporateS |
01A0: 74 61 72 74  3E 3C 69 6E  63 6F 72 70  6F 72 61 74  | tart><incorporat |
01B0: 65 45 6E 64  3E 32 30 31  33 2D 30 34  2D 33 30 54  | eEnd>2013-04-30T |
01C0: 31 34 3A 35  37 3A 33 38  2D 30 34 3A  30 30 3C 2F  | 14:57:38-04:00</ |
01D0: 69 6E 63 6F  72 70 6F 72  61 74 65 45  6E 64 3E 3C  | incorporateEnd>< |
01E0: 2F 62 61 74  63 68 3E                               | /batch>          |

What version of the product are you using? On what operating system?
V3.1 on Win7/64

Please provide any additional information below.
V2.3 works fine

Original issue reported on code.google.com by yan0p...@gmail.com on 30 Apr 2013 at 8:03

GoogleCodeExporter commented 8 years ago
Possible reason is Content-type is not set by the XML serving app-server / 
web-server. Save the response (.rcs) and attach to the issue for debugging.

Original comment by subwiz on 2 May 2013 at 11:30

GoogleCodeExporter commented 8 years ago
.rcs file attached. Content type was set to */*

Original comment by yan0p...@gmail.com on 2 May 2013 at 1:18

Attachments:

GoogleCodeExporter commented 8 years ago
As expected, the response Content-type is set to: */*

Configure your web-server / app-server to set Content-type as application/xml. 
This should resolve the issue.

I can also think of an option to force-display text when content-type is 
unknown. But that is new development and I might have to schedule that a little 
later.

Original comment by subwiz on 2 May 2013 at 2:02

GoogleCodeExporter commented 8 years ago
I experience the same problem of getting a "hex-view" displayed even if the 
header field "Content-Type" is set in the response sent by the server.
The problem always occurs when the content-type contains a parameter other than 
"charset", e.g. 
"application/vnd.mnet.staticwebspaces+xml;version=1;charset=UTF-8". According 
to the RFC2616 (http://tools.ietf.org/html/rfc2616#section-14.17) you may add 
any paramter, what we use to support multiple versions of a format.
Our own vendor content-type works if I remove the version-parameter.

Original comment by csch...@googlemail.com on 31 Oct 2013 at 10:54

GoogleCodeExporter commented 8 years ago
Thanks for reporting. Will fix over the weekend.

Original comment by subwiz on 31 Oct 2013 at 1:56

GoogleCodeExporter commented 8 years ago
I fixed it quickly on my local computer. The problem is located in 
\rest-client\restclient-lib\src\main\java\org\wiztools\restclient\util\HttpUtil.
java. The pattern to separate the content-type and charset does not support 
other parameters. I attach my patch, unfortunately my code-formatter is 
different than yours :-/
Maybe it helps you fixing it correctly.

Original comment by csch...@googlemail.com on 31 Oct 2013 at 2:15

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks! This would definetly help!

Original comment by subwiz on 31 Oct 2013 at 4:12

GoogleCodeExporter commented 8 years ago
Applied the fix inspired by your patch. Thanks!

Original comment by subwiz on 1 Nov 2013 at 7:19