Re: JsInterop and indexed types

2016-01-27 Thread Alexey Andreev

>
>
> Sorry for by bad english. 
> I meant a different thing.
>
> Oh, now I see. Well, making Java array equal to JavaScript array is not an 
only solution for passing direct reference to an array. TeaVM could have a 
method to "unwrap" array, giving a native code reference to `data` field. 
There is one, but it is like "unsafe" in Oracle JDK: it is not documented 
and it's not guaranteed to remain its API in future versions. It should 
look like this:

public static Int8Array unwrapArray(byte[] array) {
return Platform.getPlatformObject(array);
}
@JSBody(params = "wrapper", script = "return wrapper.data;")
private static native Int8Array doUnwrap(JSObject wrapper);

The magic is in undocumented Platform class, getPlatformObject particulary. 
It gets a Java object and returns it as JSObject. But do it on your own 
risk. Also, it's possible to corrupt application by assigning to the array 
something that does not fit in byte type (a floating point number or a 
string) or by changing the length of the array.

As for avoiding wrapper class. It's nearly impossible in general, since 
Java arrays are Java objects as well. Consider the following:

void foo(Object obj) {
System.out.println(obj.toString());
}
void bar() {
foo(new int[] { 1, 2, 3 });
}

How could TeaVM implement it without wrapper?

It is possible though to avoid negative effects of wrappers in certains 
cases, first, as I said, by eliminating unwrap operations when possible, 
and, second, performing some kind of escape analysis.

Note that the reverse operation (converting JavaScript array to Java array) 
is impossible in TeaVM by design. TeaVM performs global analysis of your 
code and for each variable (in terms of SSA) determines its possible types. 
It's impossible in general case to predict in compile time what actual type 
method like this may return:

Object wrapPlatformObject(JSObject obj);

I'm not sure how GWT actually works, but I suppose it does something 
similar, therefore it most likely you will fail with GWT as well. However, 
it's possible to hardcode additional methods to Platform class that convert 
JSArray to primitive arrays. You can open an issue if you really are going 
to use TeaVM for such purpose.

There are JSO wrappers in TeaVM and JSNI wrappers in GWT for TypedArrays. 
Why don't you use them directly to boost performance?

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: JsInterop and indexed types

2016-01-27 Thread Kirill Prazdnikov
Hi Alex,
really thanks for excellent answers.

I'm writing portable code. This is the reason why I can not use JS
TypedArrays directly.
My code must work in GWT, RoboVM and Android.

I'm looking for writing code in Java once and run it with best possible
efficiency on all platforms.

In RoboVM platform we have transparent marshalling of java arrays to native
layer
  int[] -> int *, char [] -> short *, e,t,c  String -> utf8 char *
In Android we use Get\Release PrimitiveArrayCritical for such needs to get
underlying pointer in native. No copies.

We don't have something similar on web. Very unfortunately.
This is a true reason why I think this is urgent and why I'm asking of it.

As a result, we must implement all computations in two ways
  - in Java for native compilers (RoboVM + Android)
  - in JS for Web

As for avoiding wrapper class. It's nearly impossible in general, since
> Java arrays are Java objects as well. Consider the following:


This is a goal. And it is nice solve it.

Thanks
 -Kirill



On Wed, Jan 27, 2016 at 8:43 PM, Alexey Andreev 
wrote:

>
>> Sorry for by bad english.
>> I meant a different thing.
>>
>> Oh, now I see. Well, making Java array equal to JavaScript array is not
> an only solution for passing direct reference to an array. TeaVM could have
> a method to "unwrap" array, giving a native code reference to `data` field.
> There is one, but it is like "unsafe" in Oracle JDK: it is not documented
> and it's not guaranteed to remain its API in future versions. It should
> look like this:
>
> public static Int8Array unwrapArray(byte[] array) {
> return Platform.getPlatformObject(array);
> }
> @JSBody(params = "wrapper", script = "return wrapper.data;")
> private static native Int8Array doUnwrap(JSObject wrapper);
>
> The magic is in undocumented Platform class, getPlatformObject
> particulary. It gets a Java object and returns it as JSObject. But do it on
> your own risk. Also, it's possible to corrupt application by assigning to
> the array something that does not fit in byte type (a floating point number
> or a string) or by changing the length of the array.
>
> As for avoiding wrapper class. It's nearly impossible in general, since
> Java arrays are Java objects as well. Consider the following:
>
> void foo(Object obj) {
> System.out.println(obj.toString());
> }
> void bar() {
> foo(new int[] { 1, 2, 3 });
> }
>
> How could TeaVM implement it without wrapper?
>
> It is possible though to avoid negative effects of wrappers in certains
> cases, first, as I said, by eliminating unwrap operations when possible,
> and, second, performing some kind of escape analysis.
>
> Note that the reverse operation (converting JavaScript array to Java
> array) is impossible in TeaVM by design. TeaVM performs global analysis of
> your code and for each variable (in terms of SSA) determines its possible
> types. It's impossible in general case to predict in compile time what
> actual type method like this may return:
>
> Object wrapPlatformObject(JSObject obj);
>
> I'm not sure how GWT actually works, but I suppose it does something
> similar, therefore it most likely you will fail with GWT as well. However,
> it's possible to hardcode additional methods to Platform class that convert
> JSArray to primitive arrays. You can open an issue if you really are going
> to use TeaVM for such purpose.
>
> There are JSO wrappers in TeaVM and JSNI wrappers in GWT for TypedArrays.
> Why don't you use them directly to boost performance?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "GWT Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-web-toolkit/YOWINYAoCrI/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Google Dev Console - HTTP ERROR: 503

2016-01-27 Thread Charly Husson
Hello,

I'm new with J2EE & GWT.
I've a project who use GWT, and i want to debug it for some reasons.

I launch my project in eclipse like that :

Right click on project > Run > project (gpe)

It's a launcher already created.

In the arguments of launch, i've :

-port auto -bindAddress 127.0.0.1 -remoteUI 
> "${gwt_remote_ui_server_port}:${unique_id}" -logLevel ALL -war 
> "${workspace_loc}/pro_web/src/main/webapp" -codeServerPort 9997 
> fr.x.y.gwt.Pro


I've tried with different bindAdress (0.0.0.0, localhost, 127.0.0.1) but 
nothing to do. 

Eclipse give me an URL for debugging, but when i go on it, i get 

HTTP ERROR: 503
> SERVICE_UNAVAILABLE
> RequestURI=/index.jsp
> *Powered by jetty:// *


In the eclipse console i these errors :



>> *Caused by: 
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 
> Configuration problem: Unable to locate Spring NamespaceHandler for XML 
> schema namespace [http://www.springframework.org/schema/aop]Offending 
> resource: class path resource [serviceContext.xml] at 
> org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
>  
> at 
> org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
>  
> at 
> org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
>  
> at 
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:318)
>  
> at 
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1435)
>  
> at 
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
>  
> at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
>  
> at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
>  
> at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
>  
> at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
>  
> at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
>  
> at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
>  
> at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
>  
> at 
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
>  
> at 
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
>  
> at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:239)
>  
> ... 37 more   [WARN] Nested in 
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 
> Configuration problem: Failed to import bean definitions from URL location 
> [classpath:serviceContext.xml]Offending resource: ServletContext resource 
> [/WEB-INF/applicationContext.xml]; nested exception is 
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 
> Configuration problem: Unable to locate Spring NamespaceHandler for XML 
> schema namespace [http://www.springframework.org/schema/aop]Offending 
> resource: class path resource [serviceContext.xml]*


 
I've tried this 
: 
http://www.baeldung.com/unable-to-locate-spring-namespacehandler-for-xml-schema-namespace
 
but without success

i don't know where i can see log of Jetty to have more informations. If you 
have idea or things to help me ...

Thanks a lot ! 

Best regards,
Charly

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


angularjs and gwt module loading

2016-01-27 Thread Rajesh Gupta
Is there a way load a gwt module from angularjs controller with out page 
refresh.

-Rajesh.

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any GWT library to be used in client side that does the same thing as Scalr (scale and reduze image file sizes)?

2016-01-27 Thread claudio sergio Goncalves
Hi julio

i use this routine to redimensione my images

public static BufferedImage redimensionarImagem(BufferedImage img, int 
maltura, int mlargura) throws Exception {

java.awt.Image imagem = (java.awt.Image) img;
java.awt.Image thumbs = ((java.awt.Image) imagem)
.getScaledInstance(mlargura, maltura, BufferedImage.SCALE_SMOOTH);
BufferedImage buffer = new BufferedImage(mlargura, maltura, 
BufferedImage.TYPE_INT_RGB);
buffer.createGraphics().drawImage(thumbs, 0, 0, null);
return buffer;
}
pass the width and height in pixels (maltura e mlargura)
After thar you can upload the image.

cheers

Claudio


Em quinta-feira, 14 de janeiro de 2016 11:25:29 UTC-2, Julio Heitor Nobrega 
escreveu:
>
> Hi guys,
>
> i am trying to upload images with 2mb size but i don't want to send the 
> whole original image to the server. 
>
> What i would like to do is reduce the image dimensions from, for example, 
> *1000x1000* to *50x50* and reduce the file size
> from *2mb* to *~25kb* as well and at the end send the *~25kb* image to 
> the server.
>
> I know there is the Scalr framework that does that in java, but its no 
> compatible with GWT clients.
>
> Is there any client side GWT library that does the same thing as Scalr?
>
> Best Regards!
>
>
>

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Large no of gwt modules

2016-01-27 Thread Rajesh Gupta
We have large no of gwt modules.

Code splitting is not option for large no of GWT modules.  See the issues 
as clearly explained in turducken pattern.
http://www.slideshare.net/RobertKeane1/turducken-divide-and-conquer-large-gwt-apps-with-multiple-teams

Will 2.8 release or 3.0 release fix the full page refresh problem.  Will it 
have feature to use GWT modules with out full page refresh.
Will 2.8/3.0 have features to dynamically load/unload gwt modules.   

-Rajesh


-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: JsInterop and indexed types

2016-01-27 Thread Kirill Prazdnikov


On Saturday, January 23, 2016 at 11:09:50 AM UTC+3, Alexey Andreev wrote:
>
>
>> Famous TeaVM also can`t do that, unfortunately. 
>>
>  You are wrong. You can do that via @JSIndexer 
> 
>  
> annotation. 
>

Sorry for by bad english. 
I meant a different thing.

Consider

class A { 
  int [] computeInJava() {...};
}

class B {
  native void aJsMethod(int data[]) /*-   expect reference to original 
Int32Array in the argument   -*/;
 }

b.aJsMethod(a.computeInJava());

It is not possible to do such things neither in GWT, nor in TeaVM. 
Not TeaVM, not GWT does not allow passing java arrays as native arrays to 
native JS code without making a copy.

Also, did you try to write benchmarks before claiming that wrapper slows 
> down performance? V8 performs sophisticated performance optimizations. 
>

You are very right, there is no point talking about performance without 
real numbers.
I will reply when I write a test and have a results.

Thanks 
 

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any GWT library to be used in client side that does the same thing as Scalr (scale and reduze image file sizes)?

2016-01-27 Thread Julio Heitor Nobrega
Hi Claudio,

thank you for your post. You method could only be used if implemented on
the server side.

GWT does not support the awt API.

Regards!

2016-01-27 8:01 GMT-02:00 Kirill Prazdnikov :

> How do you use AWT code in client GWT code ?
>
>
> On Wednesday, January 27, 2016 at 12:19:15 PM UTC+3, claudio sergio
> Goncalves wrote:
>>
>> Hi julio
>>
>> i use this routine to redimensione my images
>>
>> public static BufferedImage redimensionarImagem(BufferedImage img, int
>> maltura, int mlargura) throws Exception {
>>
>> java.awt.Image imagem = (java.awt.Image) img;
>> java.awt.Image thumbs = ((java.awt.Image) imagem)
>> .getScaledInstance(mlargura, maltura, BufferedImage.SCALE_SMOOTH);
>> BufferedImage buffer = new BufferedImage(mlargura, maltura,
>> BufferedImage.TYPE_INT_RGB);
>> buffer.createGraphics().drawImage(thumbs, 0, 0, null);
>> return buffer;
>> }
>> pass the width and height in pixels (maltura e mlargura)
>> After thar you can upload the image.
>>
>> cheers
>>
>> Claudio
>>
>>
>> Em quinta-feira, 14 de janeiro de 2016 11:25:29 UTC-2, Julio Heitor
>> Nobrega escreveu:
>>>
>>> Hi guys,
>>>
>>> i am trying to upload images with 2mb size but i don't want to send the
>>> whole original image to the server.
>>>
>>> What i would like to do is reduce the image dimensions from, for
>>> example, *1000x1000* to *50x50* and reduce the file size
>>> from *2mb* to *~25kb* as well and at the end send the *~25kb* image to
>>> the server.
>>>
>>> I know there is the Scalr framework that does that in java, but its no
>>> compatible with GWT clients.
>>>
>>> Is there any client side GWT library that does the same thing as Scalr?
>>>
>>> Best Regards!
>>>
>>>
>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "GWT Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-web-toolkit/8OfazCLtcLA/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any GWT library to be used in client side that does the same thing as Scalr (scale and reduze image file sizes)?

2016-01-27 Thread Kirill Prazdnikov
How do you use AWT code in client GWT code ?

On Wednesday, January 27, 2016 at 12:19:15 PM UTC+3, claudio sergio 
Goncalves wrote:
>
> Hi julio
>
> i use this routine to redimensione my images
>
> public static BufferedImage redimensionarImagem(BufferedImage img, int 
> maltura, int mlargura) throws Exception {
>
> java.awt.Image imagem = (java.awt.Image) img;
> java.awt.Image thumbs = ((java.awt.Image) imagem)
> .getScaledInstance(mlargura, maltura, BufferedImage.SCALE_SMOOTH);
> BufferedImage buffer = new BufferedImage(mlargura, maltura, 
> BufferedImage.TYPE_INT_RGB);
> buffer.createGraphics().drawImage(thumbs, 0, 0, null);
> return buffer;
> }
> pass the width and height in pixels (maltura e mlargura)
> After thar you can upload the image.
>
> cheers
>
> Claudio
>
>
> Em quinta-feira, 14 de janeiro de 2016 11:25:29 UTC-2, Julio Heitor 
> Nobrega escreveu:
>>
>> Hi guys,
>>
>> i am trying to upload images with 2mb size but i don't want to send the 
>> whole original image to the server. 
>>
>> What i would like to do is reduce the image dimensions from, for example, 
>> *1000x1000* to *50x50* and reduce the file size
>> from *2mb* to *~25kb* as well and at the end send the *~25kb* image to 
>> the server.
>>
>> I know there is the Scalr framework that does that in java, but its no 
>> compatible with GWT clients.
>>
>> Is there any client side GWT library that does the same thing as Scalr?
>>
>> Best Regards!
>>
>>
>>

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: SerializationException

2016-01-27 Thread Jens
You are trying to send a collection of java.lang.Object which is not 
allowed by GWT-RPC. 

See documentation 
http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes

As you are using JPA you should also read the section about serializing 
enhanced classes on the linked page.

-- J.

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any GWT library to be used in client side that does the same thing as Scalr (scale and reduze image file sizes)?

2016-01-27 Thread Alain Ekambi
The fileupload widget can control what kind of files can be uploaded.
There you can restrict the files only to images.

On 25 January 2016 at 18:16, Julio Heitor Nobrega 
wrote:

> Is there a way to see what format the file has? If it isn't an image i'll
> have to warn the user.
>
> 2016-01-25 14:58 GMT-02:00 Julio Heitor Nobrega :
>
>> Hi Alain,
>>
>> nice code! I am going to do this but in a java version code. I just
>> didn't know i could get the image path from a 'value' of the
>>
>> document.getElementById("fileUpload")
>>
>> I could even show a image preview to the user before send it to the
>> server!
>>
>> Or maybe convert the base64 String to byte array, scale it and then send
>> to the server :)
>>
>> Thanks!
>>
>> 2016-01-25 14:22 GMT-02:00 Alain Ekambi :
>>
>>> I think what you should to is get the base64  representation of the
>>> image from the canvas. Something like
>>>
>>> var p;var canvas = document.createElement("canvas");
>>> var img1=document.createElement("img");
>>> function getBase64Image(){
>>> p=document.getElementById("fileUpload").value;
>>> img1.setAttribute('src', p);
>>> canvas.width = img1.width;
>>> canvas.height = img1.height;
>>> var ctx = canvas.getContext("2d");
>>> ctx.drawImage(img1, 0, 0);
>>> var dataURL = canvas.toDataURL("image/png");alert("from getbase64 
>>> function"+dataURL );
>>> return dataURL;}
>>>
>>> Then send the base64 to the server and corvert it to byterarry or
>>> whatever format you need there to save it to disc,
>>>
>>>
>>>
>>> On 25 January 2016 at 17:11, Julio Heitor Nobrega <
>>> juliohnobr...@gmail.com> wrote:
>>>
 Hi Alain,

 i am doing exactly that. I am sending the byte array to the server,
 saving it as a file in a directory and storing the path in a DB column.

 My problem is to get the byte array from the file (is it possible to
 get the byte array using FileUpoad?) and work on it before send to the
 server.

 2016-01-25 13:39 GMT-02:00 Alain Ekambi :

> Would it be a better designer to save the image on disc and just save
> the link to the image to the DB ?
>
> On 25 January 2016 at 15:59, Julio Heitor Nobrega <
> juliohnobr...@gmail.com> wrote:
>
>> As a matter of fact, i am beginning to think that its more wise to
>> send the whole image to the server, scale it using Scalr and store it 
>> into
>> the DB.
>>
>> I want to have the control of the image size, test levels of quality.
>> The Scalr has a mode called 'Automatic' that fits your image to the
>> dimensions you pass to it.
>>
>> None of it i will have with GWT Canvas.
>>
>> The only drawback i would get using Scalr is that i will consume more
>> bandwidth DigitalOcean  gives me monthly because i will have to send the
>> whole image to the server.
>>
>> 2016-01-25 12:52 GMT-02:00 Julio Heitor Nobrega <
>> juliohnobr...@gmail.com>:
>>
>>> Thanks for your answer Greg!
>>>
>>> Actually, i really need a byte array because i will store it in a
>>> BLOB database column.
>>>
>>> Regards!
>>>
>>> 2016-01-25 12:43 GMT-02:00 Greg :
>>>
 Just use context.getCanvas().toDataUrl(); which will return data
 uri with the contents of the canvas. You can use it directly in >>> src=""> element or send it to server.

 On Monday, January 25, 2016 at 3:19:03 PM UTC+1, Julio Heitor
 Nobrega wrote:
>
> I have just found an example (
> http://c.gwt-examples.com/home/ui/canvas).
>
> The only problem is to convert ImageData to an byte array :)
>
> Regards!
>
>
>
> 2016-01-25 12:08 GMT-02:00 Julio Heitor Nobrega <
> julioh...@gmail.com>:
>
>> Does anyone have some examples regarding the Canvas class?
>>
>> I've seen the java doc API but the only methods i think that
>> could be useful was:
>>
>> Context2d
>> 
>>  *getContext2d
>> *
>> ()
>>   Returns a 2D rendering context.
>>  void *setCoordinateSpaceHeight
>> *
>> (int height)
>>   Sets the height of the internal canvas coordinate
>> space.
>> void *setCoordinateSpaceWidth
>> *
>> (int width)
>>   

SerializationException

2016-01-27 Thread claudio sergio Goncalves
hi guys 

i'd received this message

[WARN ] 2016-01-27 11:34:27.291 [qtp26882648-29] / - Exception while 
dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 
'[Ljava.lang.Object;' was not included in the set of types which can be 
serialized by this SerializationPolicy or its Class object could not be 
loaded. For security purposes, this type will not be serialized.: instance 
= [Ljava.lang.Object;@ddf831
at 
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:667)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:44)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:39)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:51)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:28)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:789)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:669)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:153)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:587)
 
~[gwt-servlet.jar:?]
at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:631) 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:497) 
~[gwt-servlet.jar:?]
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:589) 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:303)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
 
~[gwt-servlet.jar:?]
at 
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
 
[gwt-servlet.jar:?]

my object is

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name = "SP_OBTEMGRAFICOFINANCEIRO")
public class SpGrafFinanAnual implements Serializable {


private static final long serialVersionUID = 1L;
private int mes;
private int ano;
@Column(name = "RECEITA", nullable = true, columnDefinition="NUMERIC")
private float receita;
@Column(name = "DESPESA", nullable = true, columnDefinition="NUMERIC")
private float despesa;
@Column(name = "FATURAMENTO", nullable = true, columnDefinition="NUMERIC")
private float faturamento;
public SpGrafFinanAnual(){
}
 getters and setters

i cound't find any solutions around web

the solutions that i found is

   1. 
   
---


   1. 1 - Verify that the class has a default constructor (without 
   arguments)
   2. 2 - Verify that the class implements Serializable or IsSerializable 
   or implements an Interface that extends Serializable or extends a class 
   that implement Serializable
   3. 3 - Verify that the class is in a client.* package or …
   4. 4 - Verify, if the class is not in client.* package, that is compiled 
   in your GWT xml module definition. By default is present. If your class is 
   in another package you have to add it to source. For example if your class 
   is under domain.* you should add it to xml as . Be aware that the class 
   cannot belong to server package! More details on GWT page:
   
http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModuleXml
   5. 5 - If you are including the class from another GWT project you have 
   to add the inherits to your xml module definition. For example if your 
   class Foo is in the package com.dummy.domain you have to add to the module 
   definition. More details here: