GET
@Path("request=getTile")
@Produces({"image/*"})
public BufferedImage getTileGET(@QueryParam("id_photo")String id_photo,
@QueryParam("x")String x,
@QueryParam("y")String y,
@QueryParam("zoom")String zoom) throws SQLException, IOException {
BufferedImage BI = null;
connection dbs = new connection();
Statement statement = null;
Connection con = dbs.getConnection();
PreparedStatement ps = null;
try {
ps = con.prepareStatement("SELECT image from tiles where id_photo = '"+id_photo+"' "
+ "and x ='"+x+"' and y ='"+y+"' and zoom = '"+zoom+"';");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
InputStream input = rs.getBinaryStream("image");
BI=ImageIO.read(input);
input.close();
}
}
catch (SQLException e )
{
e.printStackTrace();
System.out.println("Zle dane");
}
finally {
if (statement != null) {
statement.close();
}
if (con != null) {
con.close();
}
}
return BI;
}
Czy ktoś mógłby pomoc ? Chce żeby serwer zwracał mi zdjęcie z bazy