Environment: GWT 2.0.3 + Image serving --> using Apache CXF restful service
I am working on an application that shows thumbnails in a list/grid view. Each row resembles a media item (picture, video, audio, etc). Some media has thumbnails like picture and video, other do not like audio. Also some media items will fail to generate a thumbnail even though it is a picture or video. I am currently loading the thumbnail in the grid using GWT Image class. I call the setUrl('...'). That works great. Image image = new Image() image.setUrl("RESTful/url/to/media/thumbnail/" + mediaItem.getId()"); My problem is audio-like media items and exception handling when no thumbnail was generated. I would like to show a default thumbnail for audio and another default thumbnail for a failed video thumbnail for example. The idea is that the restful service returns a HTTP status code of 204 - No Content. Official description of 204: >>"The server has fulfilled the request but does not need to return an >>entity-body, and might want to return updated metainformation. The response >>MAY include new or updated metainformation in the form of entity-headers, >>which if present SHOULD be associated with the requested variant. If the client is a user agent, it SHOULD NOT change its document view from that which caused the request to be sent. This response is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent's active view. The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields." << Ok - so I do not want to return a standard thumbnail from the server because I want the application to be skinnable and our Web Service users might not want to use our standard error or audio thumbnails. So I think it is better not to return any thumbnail and just return a 204 + set a response header with a status (1=audio, 2=no video thumbnail, 3=no picture thumbnail, etc. ). That way the client can use this information to show a standard thumbnail and skin it as suitable. Now, Image has an addErrorHandler(new ErrorHandler()); method. But the ErrorEvent does not give me any information about HTTP status nor can I access the Response object. I would like to do something like this: Image image = new Image(); image.addErrorHandler(new ErrorHandler() { public void onError(ErrorEvent errorEvent) { // somehow access the HTTPResponse object if (response.getStatus == Response.SC_NO_CONTENT) { String thumbnailType = response.getHeader("thumbnail- type"); if ("1".equals(thumbnailType)) { // show default audio thumbnail } else if ("2".equals(thumbnailType)) { // show default missing video thumbnail } } else { // show error thumbnail } } }); image.setUrl("RESTful/url/to/media/thumbnail/" + mediaItem.getId()"); Showing the thumbnails in audio and error situations would be done using a CSS stylesheet by adding a class to the thumbnail div. Any help or ideas would be greatly appreciated. Thanks -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.