------------------------------------------------------------ revno: 13746 committer: Morten Olav Hansen <[email protected]> branch nick: dhis2 timestamp: Thu 2014-01-16 10:45:34 +0700 message: csd: use a jaxbcontext directly instead of jaxb2marshaller (from spring) modified: dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java dhis-2/dhis-web/dhis-web-ohie/src/main/resources/META-INF/dhis/webapi-ohie.xml
-- 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-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java' --- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java 2014-01-15 13:10:05 +0000 +++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java 2014-01-16 03:45:34 +0000 @@ -48,14 +48,17 @@ import org.hisp.dhis.web.ohie.fred.webapi.v1.utils.GeoUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; +import org.springframework.oxm.jaxb.Jaxb2Marshaller; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.client.HttpClientErrorException; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; import java.io.IOException; import java.util.ArrayList; import java.util.Date; @@ -65,15 +68,36 @@ * @author Morten Olav Hansen <[email protected]> */ @Controller -@RequestMapping( value = "/csd" ) +@RequestMapping(value = "/csd") public class CsdController { @Autowired private OrganisationUnitService organisationUnitService; + private static JAXBContext jaxbContext; + + static + { + try + { + Class[] classes = new Class[]{ + Envelope.class + }; + + // TODO: switch Eclipse MOXy? + jaxbContext = JAXBContext.newInstance( classes ); + } + catch ( JAXBException ignored ) + { + } + } + @RequestMapping( value = "", method = RequestMethod.POST ) - public @ResponseBody Csd csdRequest( @RequestBody Envelope envelope, HttpServletResponse response ) throws IOException + public @ResponseBody Csd csdRequest( HttpServletRequest request, HttpServletResponse response ) throws IOException, JAXBException { + Object o = jaxbContext.createUnmarshaller().unmarshal( request.getInputStream() ); + Envelope envelope = (Envelope) o; + Date lastModified = null; try === modified file 'dhis-2/dhis-web/dhis-web-ohie/src/main/resources/META-INF/dhis/webapi-ohie.xml' --- dhis-2/dhis-web/dhis-web-ohie/src/main/resources/META-INF/dhis/webapi-ohie.xml 2014-01-15 13:30:51 +0000 +++ dhis-2/dhis-web/dhis-web-ohie/src/main/resources/META-INF/dhis/webapi-ohie.xml 2014-01-16 03:45:34 +0000 @@ -68,9 +68,11 @@ <property name="extractValueFromSingleKeyModel" value="true" /> </bean> + <!-- <bean class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="packagesToScan" value="org.hisp.dhis.web.ohie.csd.domain" /> </bean> + --> <mvc:annotation-driven> <mvc:message-converters register-defaults="false">
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp

