bonjour
je demande votre aide j aimerais afficher dans une page JSP une image récupérer d un flux ainsi que du texte le problème que la page m'affiche l image ou bien le texte voici mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
        ServletOutputStream outStream =  response.getOutputStream(); 
 
        InputStream image=post.getResponseBodyAsStream();
 
        InputStream in = new BufferedInputStream(image);
 
        String type     = post.getResponseHeader("Content-Type").getValue();
        String length   = post.getResponseHeader("Content-Length").getValue();
        response.setContentType(type);
 
        byte[] buf = new byte[Integer.parseInt(length)]; 
        int bytesRead; 
        while ((bytesRead = in.read(buf)) != -1) { 
          outStream.write(buf, 0, bytesRead);
        }
        outStream.flush();
 
        response.setContentType("text/html");
        outStream.println("BLalalLALAllal ");
        outStream.close();