dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24315
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11897: set proper content-type when sending compressed json/xml. application/xml+gzip and application/js...
------------------------------------------------------------
revno: 11897
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-09-04 09:24:12 +0200
message:
set proper content-type when sending compressed json/xml. application/xml+gzip and application/json+gzip
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonJsonView.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonXmlView.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonJsonView.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonJsonView.java 2013-09-04 07:20:06 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonJsonView.java 2013-09-04 07:24:12 +0000
@@ -120,9 +120,18 @@
}
else
{
- response.setContentType( ContextUtils.CONTENT_TYPE_GZIP );
- response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
- outputStream = new GZIPOutputStream( response.getOutputStream() );
+ if ( !withPadding )
+ {
+ response.setContentType( CONTENT_TYPE_APPLICATION_JSON_GZIP );
+ response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
+ outputStream = new GZIPOutputStream( response.getOutputStream() );
+ }
+ else
+ {
+ response.setContentType( CONTENT_TYPE_APPLICATION_JAVASCRIPT_GZIP );
+ response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
+ outputStream = new GZIPOutputStream( response.getOutputStream() );
+ }
}
if ( withPadding )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonXmlView.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonXmlView.java 2013-09-04 07:20:06 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonXmlView.java 2013-09-04 07:24:12 +0000
@@ -91,7 +91,7 @@
}
else
{
- response.setContentType( ContextUtils.CONTENT_TYPE_GZIP );
+ response.setContentType( CONTENT_TYPE_APPLICATION_XML_GZIP );
response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
outputStream = new GZIPOutputStream( response.getOutputStream() );
}