List of usage examples for org.springframework.http HttpInputMessage getBody
InputStream getBody() throws IOException;
From source file:org.energyos.espi.thirdparty.domain.AccessTokenTests.java
@Test public void json() throws IOException { HttpInputMessage message = mock(HttpInputMessage.class); when(message.getBody()).thenReturn(new ByteArrayInputStream( ("{" + "\"access_token\":\"6b945882-8349-471a-915f-25e791971248\"," + "\"token_type\":\"Bearer\"," + "\"expires_in\":43199," + "\"scope\":\"read write\"," + "\"resourceURI\":\"ResourceURI\"," + "\"authorizationURI\":\"AuthorizationURI\"" + "}").getBytes())); MappingJacksonHttpMessageConverter converter = new MappingJacksonHttpMessageConverter(); converter.read(AccessToken.class, message); }
From source file:com.boundlessgeo.geoserver.api.converters.YsldMessageConverter.java
@Override protected StyledLayerDescriptor readInternal(Class<? extends StyledLayerDescriptor> clazz, HttpInputMessage message) throws IOException, HttpMessageNotReadableException { return new YsldHandler().parse(message.getBody(), null, null, null); }
From source file:com.boundlessgeo.geoserver.api.converters.JSONMessageConverter.java
@Override protected JSONWrapper readInternal(Class<? extends JSONWrapper> clazz, HttpInputMessage message) throws IOException, HttpMessageNotReadableException { return JSONWrapper.read(message.getBody()); }
From source file:jetbrains.buildServer.vsoRooms.rest.impl.JsonTeamRoomMessageConverter.java
@Override protected TeamRoomMessage readInternal(Class<? extends TeamRoomMessage> aClass, HttpInputMessage httpInputMessage) throws IOException, HttpMessageNotReadableException { return myMapper.readValue(httpInputMessage.getBody(), TeamRoomMessage.class); }
From source file:io.lavagna.web.helper.GsonHttpMessageConverter.java
@Override protected Object readInternal(Class<? extends Object> clazz, HttpInputMessage inputMessage) throws IOException { try (Reader reader = new InputStreamReader(inputMessage.getBody(), StandardCharsets.UTF_8)) { return gson.fromJson(reader, clazz); } catch (JsonSyntaxException e) { throw new HttpMessageNotReadableException("Could not read JSON: " + e.getMessage(), e); }// w w w. j a v a 2 s . c o m }
From source file:net.acesinc.convergentui.content.BufferedImageHttpMessageConverter.java
@Override protected BufferedImage readInternal(Class<? extends BufferedImage> type, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { return ImageIO.read(inputMessage.getBody()); }
From source file:net.gbmb.collector.rest.HttpRecordMessageConverter.java
@Override public CollectionRecord read(Class<? extends CollectionRecord> aClass, HttpInputMessage httpInputMessage) throws IOException { CollectionRecord cr = convert(httpInputMessage.getBody()); cr.setRecordDate(new Date()); return cr;/* w w w. j av a2s. c o m*/ }
From source file:jetbrains.buildServer.vsoRooms.rest.impl.JsonTeamRoomListConverter.java
@Override protected TeamRoomList readInternal(Class<? extends TeamRoomList> aClass, HttpInputMessage httpInputMessage) throws IOException, HttpMessageNotReadableException { return myMapper.readValue(httpInputMessage.getBody(), TeamRoomList.class); }
From source file:net.acesinc.convergentui.content.TextHttpMessageConverter.java
@Override protected String readInternal(Class<? extends String> type, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { return convertStreamToString(inputMessage.getBody()); }
From source file:com.future.spring.rest.BufferedImageHttpMessageConverter.java
@Override public BufferedImage read(Class<? extends BufferedImage> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { return ImageIO.read(inputMessage.getBody()); }