Hello Magallo

You can use a code like this:

*protected* *void* doGet(HttpServletRequest request, HttpServletResponse 
response) *throws* ServletException, IOException { 

    response.setContentType("image/png"); 

*    if*(request.getParameter("id") != *null*) {

*       if*(request.getParameter("id").equals("")) {

          response.sendError(500, "Bad request | Please provide an existing 
...?id=X");

       }

*      else* {

*        int* mapID = Integer.*parseInt*(request.getParameter("id"));

*        byte*[] image = *null*; 

*        try* { 

           yourClientWrapper wrapper = yourDao.readById((*long*) mapID);

           image = wrapper.getYourImage();

        } 

        *catch* (Exception e) { 

           e.printStackTrace(); 

        } 

         OutputStream out = response.getOutputStream(); 

         out.write(image); 

         out.close(); 

      }

}

*    else* {

       response.sendError(500, "Bad request | Please provide an existing id 
with ...?id=X");

    }

} 

On the client side: You just insert your Servlet-Url as the Image Resource 
(src-Attribute) like 
http://www.yourfancyurl.com/yourgwtapplication/servlet/imageGetter?id=31) 
and that's it. The servlet returns the image to the corresponding id 
without saving it to the disk.
I hope that this little explanation helps :)


Best regards



Am Montag, 4. Juni 2012 12:34:14 UTC+2 schrieb Magallo:

> Excuse me Agito M, I'm intereseted in this solution. You said that "Code 
> on the client side didn't change from what I earlier posted.". What do you 
> mean? How do you call the servlet and how do you process the result and 
> create the image client side? Please, could you possibly post some code to 
> let me understand this? Thanks.
>
> Il giorno martedì 27 settembre 2011 12:56:12 UTC+2, AgitoM ha scritto:
>>
>> Decided to deal with the 32kb limit in Internet Explorer 8. (Internet 
>> Explorer 9 is not a problem). 
>> Dealt with the problem by creating a servlet that outputs the byte 
>> array as a image. 
>> I'm sending the ID of the image, in this case a map, to the servlet 
>> using the GET method. 
>>
>> This is the code for the doGet operation for my dedicated 
>> ImageServlet: 
>>
>> protected void doGet(HttpServletRequest request, HttpServletResponse 
>> response) throws ServletException, IOException { 
>>                 response.setContentType("image/png"); 
>>
>>                 if(request.getParameter("MapID") != null) { 
>>                         int mapID = 
>> Integer.parseInt(request.getParameter("MapID")); 
>>
>>                         byte[] image = null; 
>>                         try { 
>>                                 image = wsStub.getMapImage(mapID); 
>>                         } 
>>                         catch (Exception e) { 
>>                                 e.printStackTrace(); 
>>                         } 
>>
>>                         OutputStream out = response.getOutputStream(); 
>>                         out.write(image); 
>>                         out.close(); 
>>                 } 
>>         } 
>>
>> On my RPC Servlet side, I simply return this as the "URL" of the 
>> image: 
>> ("ImageServlet?MapID=" + mapID) 
>>
>> Code on the client side didn't change from what I earlier posted.
>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to