Commit 4c0ed0396c56f3ae5ca0eba3affa195114d026b9
1 parent
74a74f14
MapByteServlet : correction retour requete HTTP
Showing
1 changed file
with
11 additions
and
3 deletions
Show diff stats
src/main/java/servlet/MapByteServlet.java
... | ... | @@ -19,12 +19,20 @@ public class MapByteServlet extends HttpServlet { |
19 | 19 | |
20 | 20 | MapService mapService = new MapService(); |
21 | 21 | int mapId = Integer.parseInt(servletRequest.getParameter("MAP_ID")); |
22 | - Map map = mapService.getMap(mapId); | |
22 | + Byte[] mapBytes = mapService.getMapContent(mapId); | |
23 | 23 | |
24 | 24 | servletResponse.setContentType("image/png"); |
25 | - servletResponse.getWriter().print(map.getContent()); | |
25 | + servletResponse.getWriter().print(byteToString(mapBytes)); | |
26 | 26 | } |
27 | - | |
27 | + | |
28 | + private String byteToString(Byte[] bytes) { | |
29 | + StringBuffer sb = new StringBuffer(); | |
30 | + for(Byte currByte : bytes){ | |
31 | + sb.append(currByte.toString()); | |
32 | + } | |
33 | + return sb.toString(); | |
34 | + } | |
35 | + | |
28 | 36 | @Override |
29 | 37 | public void doGet(final HttpServletRequest servletRequest, final HttpServletResponse servletResponse) |
30 | 38 | throws ServletException, IOException { | ... | ... |