How to get image with servlet and display it using GWT Image class?
问题 I'm using the following code as part of the GWT server-side class (servlet) for GWT-RPC. private void getImage() { HttpServletResponse res = this.getThreadLocalResponse(); try { // Set content type res.setContentType("image/png"); // Set content size File file = new File("C:\\Documents and Settings\\User\\image.png"); res.setContentLength((int) file.length()); // Open the file and output streams FileInputStream in = new FileInputStream(file); OutputStream out = res.getOutputStream(); // Copy