this blog is more of a notepad that I use to collect stuff that related to what I do
Wednesday, December 16, 2009
Here what to do if GWT compiler cannot find the source code for the com.google.appengine.Key class
and you really want to use your classes over the wire as is...
and you really want to use your classes over the wire as is...
Started to work with Android platform. You know what?! For the 4th day in a row I am sitting with a smile on my face!
after BREW & Symbian this is GREAT!
Problem:
Missing in layout of the views Java SE java.awt.BorderLayout analogue.
Answer:
Use combination of nested layouts to simulate BorderLayout. Below is a definition of a view ready for use. Simply nest your components
inside LinearLayout tags.
The idea comes from here.
after BREW & Symbian this is GREAT!
Problem:
Missing in layout of the views Java SE java.awt.BorderLayout analogue.
Answer:
Use combination of nested layouts to simulate BorderLayout. Below is a definition of a view ready for use. Simply nest your components
inside LinearLayout tags.
The idea comes from here.
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:id="@+id/top_container" android:orientation="horizontal" android:layout_weight="0" android:layout_width="fill_parent" android:layout_height="wrap_content"> <!-- Add here the TOP components --> </LinearLayout> <!-- Central row --> <LinearLayout android:orientation="horizontal" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:id="@+id/left_container" android:orientation="vertical" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="fill_parent"> <!-- Add here the LEFT components --> </LinearLayout> <LinearLayout android:id="@+id/center_container" android:orientation="vertical" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- Add here the CENTER components --> </LinearLayout> <LinearLayout android:id="@+id/right_container" android:orientation="vertical" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="fill_parent"> <!-- Add here the RIGHT components --> </LinearLayout> </LinearLayout> <LinearLayout android:id="@+id/bottom_container" android:orientation="horizontal" android:layout_weight="0" android:layout_width="fill_parent" android:layout_height="wrap_content"> <!-- Add here the BOTTOM components --> </LinearLayout> </LinearLayout> |
Saturday, August 08, 2009
The problem: I want to expose application back end functionality on Google Application Engine (GAE) to the GWT and Java SE front ends in the same way. I did not want to code 2 different technology things that do same business logic.
\war\WEB-INF\web.xml should look like this :
The Discussion: all 3 playing technologies use Java... GWT standard way to talk to server is GWT RPC - works great. But Zipped JSON underneath (seen somewhere analysis of the traffic done with a proxy.)
For Java Web Start App written with Java SE 6 any kind of serialization is an option but the rest of the protocol can be tricky to code test and maintain.
Easy to see that what I was looking was a way to create some kind of web services on GAE, but the classic Web Services with AXIS does not work (this is by design, documented and understandable).
So everyone I asked offered me to code a bunch of servlets to return XML serialization of the same POJOs used in GWT RPS realization. But I was looking for a way to have more than a single servlet for a single RPC method hand coded. So run in to the restlet.org And U know what?! It worked just out of the box.
The Solution:
The recipe is like that:
The recipe is like that:
Get from restlet.org the restlet-gae-2.0m4.zip this is a GAE edition of the 2nd version that currently in development but as they work fast and release often - it will be production ready before I even start testing anything real.
Create a GAE web app in Eclipse 3.5 with Google Plugin.
Add 2 jars: org.restlet.ext.servlet.jar org.restlet.jar to the \war\WEB-INF\lib\ and to the build path of the project
create classes:
package biz.daich.google.engine.ex1.code.server.restlets;import org.restlet.resource.Get;import org.restlet.resource.ServerResource;public class HelloWorldResource extends ServerResource {@Getpublic String represent() {return "hello, world (from the cloud!)";}}
-------------------------------------------
package biz.daich.google.engine.ex1.code.server.restlets;
import org.restlet.Application;
import org.restlet.Restlet;
import org.restlet.routing.Router;
public class RestletsApplication extends Application {
/**
* Creates a root Restlet that will receive all incoming calls.
*/
@Override
public synchronized Restlet createRoot() {
// Create a router Restlet that routes each call to a
// new instance of HelloWorldResource.
Router router = new Router(getContext());
// Defines only one route
router.attach("/", HelloWorldResource.class);
return router;
}
}
------------------------------------------------------
Pei_pivo.html org.restlet.application biz.daich.google.engine.ex1.code.server.restlets.RestletsApplicationRestletServlet org.restlet.ext.servlet.ServerServlet RestletServlet /restlets/*
===============================================
now in the debug mode it works OK when you go to the http://localhost:8080/restlets/
it shows "hello, world (from the cloud!)" as expected.
see restlet.org wiki and documentation. It has GWT connector too. Will try it next.
Subscribe to:
Posts (Atom)