Problems with GWT 2.4 - gwt

I compiled the version in svn tagged as gwt2.4rc. Now there are a
couple of more libraries than I had the last time. Are the any
instructions on which library is needed for what? I tried it with only
the standard libraries (servlet, servlet-deps, user) but I get the
following error when a requestfactory call is made:
java.lang.NoSuchMethodError:
com.google.gwt.core.client.impl.WeakMapping.setWeak(Ljava/lang/
Object;Ljava/lang/String;Ljava/lang/Object;)
I tried declaring the requestfactory-client and requestfactory-server
jars as dependencies, but i doesn't help. I am using maven to manage
my dependencies.
I would go back to 2.4 beta, but I need the drag&drop features that
were introduced later.
Does anybody has an idea what could be wrong? or any hints how i can
dig deeper into this? I spend a lot of time trying to figure this out
but without any success :(
Do I need to provide more information?
Regards,
arne

Are you sure you deployed the 2.4-rc1 gwt-servlet.jar in your war/WEB-INF/lib ? Also, make sure you override the SDK for the gwt-maven-plugin: http://mojo.codehaus.org/gwt-maven-plugin/user-guide/using-different-gwt-sdk-version.html
That being said:
when using Maven, you shouldn't use gwt-servlet-deps but instead reference org.json:json and javax.validation:validation-api
requestfactory-server can be used instead of gwt-servlet if you only use RequestFactory on the server-side (no GWT-RPC, no SafeHtml, no RegExp, etc.); requestfactory-client is to be used for Java clients (such as Android), not the case here.

Related

httpclient's (3.1) URIUtil.encodeQuery() is gone in org.apache.httpcomponents (4.4.1), any substitute?

In my project code, there is a requirement to encode the URL. its currently using httpclient 3.1 jar and uses its method URIUtil.encodeQuery() to do the job. but we are upgrading the jar to the newer version, org.apache.httpcomponents 4.4.1.
where I couldn't find any exact substitute for encodeQuery method. it has been discussed in the post What happened to URIUtil.encodePath from commons-httpclient-3.1?.
But still I am looking for any good substitute for encodeQuery(), can anyone has suggestion.
Thanks
In our project we use the URIBuilder class.
https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/utils/URIBuilder.html
The builder returns the standard java URI.
If you have a new project I suggest to follow the other answer by using the Builder.
On my side, as my project is old and do not want to refactor too much, I just switched to another util class in the CXF project (as it's already a dependency I have).
I just replaced the code URIUtil.encodeQuery(strQuery) by URIParserUtil.escapeChars(strQuery)
The API documentation is here.

XLET - how to create a simple xlet MHP javax.TV

I'm trying to create my first xlet project.
Can you help me?
I don't know which library I need to download.
What kind of project I have to create? (I'm using netbeans)
This site has a lot of useful info:
http://www.interactivetvweb.org/tutorials/javatv/first_xlet
You can use XletView to view your Xlet.
http://sourceforge.net/projects/xletview/
You will need to get a hold on the various API's, which is somewhat troublesome (I've heard).
But there are also other ways of getting them. For example, if you own PowerDVD, you'll be able to find BDJ.jar somewhere in that package. Add that to your classpath, and you'll be able to compile your Xlet.
If you're running Windows, you can probably develop Xlets with JavaME SDK 3.0 too (sadly not available for Linux though).

Can I write Eclipse plugins using Groovy?

Groovy seems to fix a lot of the things I dislike about Java, and I was wondering if it would be possible to actually write an Eclipse plugin in Groovy instead of Java.
Does anyone know if this is possible, and if so how to go about it?
I've just found a blog entry which says it's not officially supported but is actually possible.
Not yet tested to see if it works, but it seems promising:
Writing Eclipse plugins with Groovy, by Jörn Dinkla
#Peter, I do not think that the blog post you linked to is complete or if it will really work. It is pointing to the old version of Groovy-Eclipse, which is no longer supported and is out of date.
Yes. It is possible to create your own plugins in Groovy.
First, install the Groovy-Eclipse plugin from here:
http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/
Then you can create a new plugin project and add the Groovy Nature.
Remove the Groovy Libraries classpath container
Instead, add the org.codehause.groovy as a required bundle
Create your Groovy code as normal
Now, the tricky part is exporting the plugin using PDE. See this blog post for how to do that: http://contraptionsforprogramming.blogspot.com/2010/08/groovy-pde-redux.html
One important thing to note is that you will need at least one Java file in your project for PDE to compile anything, It can be a dummy, empty file (this is a bug that has not yet been fixed).
Rejoice!
As an example, here is the codenarc Eclipse plugin that was written completely in Groovy:
http://sourceforge.net/projects/codenarceclipse/
You can also use JRuby, or Javascript ...
JAM Circle is a great example showing how to make great use of a scripting language in an Eclipse plugin, by allowing the end user to write his own actions and load them at runtime.
There's a proxy-like plugin that allows you to implement the plugin virtually in any language that supports JSR223 (javax.scripting)

How to implement HashMap in GWT?

I have some amount of messages which are coming to my client from the server.
Every messages have an unique key which is possible to be duplicated in messages I have already received.
Which collection can I use in GWT to avoid duplication?
HashMap seems not to be a case for GWT. Is there any other way to organize it?
You can use the standard java.util.HashMap in GWT without problems. Be sure you haven't accidentally imported the com.google.gwt.dev.util.collect.HashMap. It happened to me several times while using Eclipse's Organize imports feature..
For questions like this, you should take a look at the GWT JRE Emulation Reference. It contains the java classes of the Java runtime library that can be automatically translated by GWT. The link points to the JRE ER for GWT 1.6. to show you that HashMap wasn't just included in the latest version. (The JRE ER for the latest version can be found here)
As xor_eq points you should check the GWT JRE Emulation Reference Check the link to the latest version (or the version that you're running). The support for for HashMap was added to GWT sometime ago (in 2.0 I think), so you should have no problem.

Google collections GWT jar

Has anyone had any luck rolling a custom GWT jar for Google Collections / Guava? I've tried uncommenting the relevant ant tasks and running them, but I just get empty folders in the JAR. Can't seem to get the include rules right :-/
Remember that we intentionally don't provide this because the library does not work as it should on GWT. If you do it anyway, you might luck out, or you might not. We're working on this.