Re: How to send images with image map to client and create widget with it

2012-09-17 Thread tanteanni
thx,

especially for the security hint.

On Friday, 14 September 2012 16:45:29 UTC+2, Jens wrote:

 So for each image to server requests are necessary: 

 1 to get the dto and create html with image-url 
 2 to get the image from servlet


 Yes, although the second request is done by the browser and not by your 
 GWT app. To remove the browser request, you would need to use data uris 
 (base64) and use the data uri instead of the server url. But as you said, 
 you don't want that.

 Just be aware of XSS attacks. A possible man in the middle attack could 
 probably modify the raw html while its send from server to client. The html 
 would then contain some evil javascript that will be executed by the 
 browser in your app's context as soon as you render the html.

 -- J.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/7eI0GotdbWAJ.
To post to this group, send email to google-web-toolkit@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.



How to send images with image map to client and create widget with it

2012-09-14 Thread tanteanni
On server side i have a lib (can be modified) that produces png images and 
corresponding imagemap for mouse hover titles. But how to use them with 
gwt? I already have a little servlet that could png-images to client (on 
client side gwt Image objects are created and added to widgets).
Due to compatibility concerns and user friendliness i don't want to use 
embedded images (base64) . So how to send image and map to client and how 
to plug it together into a widget?

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ZeoK_RJMXccJ.
To post to this group, send email to google-web-toolkit@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.



Re: How to send images with image map to client and create widget with it

2012-09-14 Thread Jens
Create a DTO that describes the image map, something like:

ImageMap
- String: imageUrl (would point to your png-image servlet)
- ListImageMap.Area: areas (calculated on server using your lib)

ImageMap.Area:
- ShapeTypeEnum: shape (RECT, CIRCLE, POLY)
- ListInteger: coords
- String: href
- String: title

Then create a custom widget that can render an image map using img, map 
and area and use the DTO information to configure the widget.

If your lib creates raw HTML for the image map then you probably only need 
the imageUrl and the raw HTML in your DTO and render the raw HTML directly 
using GWT's HTML widget. But you have to do some sanity checks on the raw 
HTML to prevent cross site scripting attacks. 
So if you can, build the HTML on the client side and only transfer the 
needed data from server to client.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/YHhETqfWYDgJ.
To post to this group, send email to google-web-toolkit@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.



Re: How to send images with image map to client and create widget with it

2012-09-14 Thread tanteanni
thx jens

So for each image to server requests are necessary: 

1 to get the dto and create html with image-url 
2 to get the image from servlet

my hope was/is there is a way with one request/response? And indeed i get 
the image map as html. so my dto would be very simple: 2 Strings (url + 
map).

On Friday, 14 September 2012 16:25:35 UTC+2, Jens wrote:

 Create a DTO that describes the image map, something like:

 ImageMap
 - String: imageUrl (would point to your png-image servlet)
 - ListImageMap.Area: areas (calculated on server using your lib)

 ImageMap.Area:
 - ShapeTypeEnum: shape (RECT, CIRCLE, POLY)
 - ListInteger: coords
 - String: href
 - String: title

 Then create a custom widget that can render an image map using img, 
 map and area and use the DTO information to configure the widget.

 If your lib creates raw HTML for the image map then you probably only need 
 the imageUrl and the raw HTML in your DTO and render the raw HTML directly 
 using GWT's HTML widget. But you have to do some sanity checks on the raw 
 HTML to prevent cross site scripting attacks. 
 So if you can, build the HTML on the client side and only transfer the 
 needed data from server to client.

 -- J.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/q_BMSp0qzCcJ.
To post to this group, send email to google-web-toolkit@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.



Re: How to send images with image map to client and create widget with it

2012-09-14 Thread Jens


 So for each image to server requests are necessary: 

 1 to get the dto and create html with image-url 
 2 to get the image from servlet


Yes, although the second request is done by the browser and not by your GWT 
app. To remove the browser request, you would need to use data uris 
(base64) and use the data uri instead of the server url. But as you said, 
you don't want that.

Just be aware of XSS attacks. A possible man in the middle attack could 
probably modify the raw html while its send from server to client. The html 
would then contain some evil javascript that will be executed by the 
browser in your app's context as soon as you render the html.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/sS0o72BbqN4J.
To post to this group, send email to google-web-toolkit@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.