dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37777
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19292: minor, set default http status to 200 in WebMessage, added WebMessageService to CrudController so...
------------------------------------------------------------
revno: 19292
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-06-05 17:48:21 +0700
message:
minor, set default http status to 200 in WebMessage, added WebMessageService to CrudController so it can be used for sending webMessage responses which are not exceptions (those are taken care of by CrudControllerAdvice)
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/service/WebMessageService.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.java 2015-06-05 10:40:30 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.java 2015-06-05 10:48:21 +0000
@@ -61,7 +61,7 @@
/**
* HTTP status code.
*/
- protected Integer httpStatusCode;
+ protected Integer httpStatusCode = 200;
/**
* Non-technical message, should be simple and could possibly be used to display message
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-04-29 07:11:23 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-06-05 10:48:21 +0000
@@ -75,6 +75,7 @@
import org.hisp.dhis.webapi.controller.exception.NotFoundException;
import org.hisp.dhis.webapi.service.ContextService;
import org.hisp.dhis.webapi.service.LinkService;
+import org.hisp.dhis.webapi.service.WebMessageService;
import org.hisp.dhis.webapi.utils.ContextUtils;
import org.hisp.dhis.webapi.webdomain.WebMetaData;
import org.hisp.dhis.webapi.webdomain.WebOptions;
@@ -146,6 +147,9 @@
@Autowired
protected QueryService queryService;
+ @Autowired
+ protected WebMessageService webMessageService;
+
//--------------------------------------------------------------------------
// GET
//--------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/service/WebMessageService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/service/WebMessageService.java 2015-06-05 10:33:56 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/service/WebMessageService.java 2015-06-05 10:48:21 +0000
@@ -30,8 +30,6 @@
import org.hisp.dhis.dxf2.render.RenderService;
import org.hisp.dhis.dxf2.webmessage.WebMessage;
-import org.hisp.dhis.dxf2.webmessage.WebMessageResponse;
-import org.hisp.dhis.dxf2.webmessage.WebMessageStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
@@ -61,9 +59,8 @@
{
renderService.toJson( response.getOutputStream(), message );
}
- catch ( IOException ex )
+ catch ( IOException ignored )
{
- ex.printStackTrace();
}
}
@@ -76,9 +73,8 @@
{
renderService.toXml( response.getOutputStream(), message );
}
- catch ( IOException ex )
+ catch ( IOException ignored )
{
- ex.printStackTrace();
}
}
@@ -100,11 +96,11 @@
if ( isCompatibleWith( type, MediaType.APPLICATION_JSON ) )
{
- sendJson( webMessage, response );
+ sendJson( webMessage, response );
}
else if ( isCompatibleWith( type, MediaType.APPLICATION_XML ) )
{
- sendXml( webMessage, response );
+ sendXml( webMessage, response );
}
}