dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37807
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19308: minor fix
------------------------------------------------------------
revno: 19308
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-06-08 15:45:54 +0700
message:
minor fix
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.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 11:20:06 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.java 2015-06-08 08:45:54 +0000
@@ -28,21 +28,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.common.DxfNamespaces;
-import org.springframework.http.HttpStatus;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.google.common.base.MoreObjects;
+import org.hisp.dhis.common.DxfNamespaces;
+import org.springframework.http.HttpStatus;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@JacksonXmlRootElement( localName = "webMessage", namespace = DxfNamespaces.DXF_2_0 )
@JsonPropertyOrder( {
- "status", "code", "httpStatusCode", "message", "devMessage", "response"
+ "status", "code", "httpStatus", "httpStatusCode", "message", "devMessage", "response"
} )
public class WebMessage
{
@@ -61,6 +60,11 @@
protected Integer code;
/**
+ * HTTP status.
+ */
+ protected String httpStatus = HttpStatus.OK.getReasonPhrase();
+
+ /**
* HTTP status code. Default value is 200.
*/
protected Integer httpStatusCode = HttpStatus.OK.value();
@@ -101,13 +105,13 @@
public WebMessage( WebMessageStatus status, Integer httpStatusCode )
{
this.status = status;
- this.httpStatusCode = httpStatusCode;
+ setHttpStatusCode( httpStatusCode );
}
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
-
+
public boolean okStatus()
{
return WebMessageStatus.OK.equals( status );
@@ -117,7 +121,7 @@
{
return WebMessageStatus.ERROR.equals( status );
}
-
+
// -------------------------------------------------------------------------
// Get and set methods
// -------------------------------------------------------------------------
@@ -148,6 +152,13 @@
@JsonProperty
@JacksonXmlProperty( isAttribute = true )
+ public String getHttpStatus()
+ {
+ return httpStatus;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( isAttribute = true )
public Integer getHttpStatusCode()
{
return httpStatusCode;
@@ -155,6 +166,14 @@
public void setHttpStatusCode( Integer httpStatusCode )
{
+ try
+ {
+ this.httpStatus = HttpStatus.valueOf( httpStatusCode ).getReasonPhrase();
+ }
+ catch ( IllegalArgumentException ignored )
+ {
+ }
+
this.httpStatusCode = httpStatusCode;
}