Wednesday, July 30, 2014

HOW-TO: Super Dev Mode, Ant, and Run-Jetty-Run

Though I've moved to Super Dev Mode for new projects, and have been trying out Maven and Gradle, I have two shipping products that are built with Ant and were developed using DevMode. I'm reluctant to screw with these much, but I must fix the occasional bug or tweak or add a feature. This summer I've had to reopen both projects, and decided that I might as well move them from GWT 2.5.1 to 2.6.1 and get them working with Super Dev Mode.

It ends up that Super Dev Mode was pretty easy. First I added the xsiframe linker to the module files. My projects' build.xml scripts were first built with GWT's webAppCreator (one back in GWT v1.something). I copied their devmode targets and modified them for SDM. Except for the last <arg>, the sdm target for both projects is the same:

<target name="sdm" depends="javac" description="Run Super Dev Mode">
  <java failonerror="true" fork="true"
 
        classname="com.google.gwt.dev.codeserver.CodeServer">
    <classpath>
      <pathelement location="src"/>
      <path refid="project.class.path"/>
      <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
      <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
      <pathelement path="${gwt.sdk}/gwt-codeserver.jar" />
    </classpath>
    <jvmarg value="-Xmx512M"/>
    <arg value="-bindAddress"/>
    <arg value="0.0.0.0"/>
    <arg value="-port"/>
    <arg value="9876"/>
    <arg value="-workDir"/>
    <arg value="workDir"/>
    <arg line="-src"/>
    <arg value="src"/>
    <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
    <arg value="com.optix.cold.Cold"/>
  </java>
</target>

While I could continue to use DevMode to run my projects in Jetty, I'd like to avoid DevMode altogether (maybe it will go away in some future GWT?). First I tried an Ant target, but I had no success when following the instructions. With a little searching, I found the Eclipse plugin Run Jetty Run. Success. With Run Jetty Run installed, the Jetty Webapp run/debug configuration builds itself when you highlight the project, right click, and select Run As -> Run Jetty (you can tweak this later; I prefer to run development on port 8888). Run picks up the app's war/WEB-INF/jetty-web.xml so it is easy to modify the web app context. 

With this set up, I start the webapp under Jetty though Eclipse, and run `ant sdm` in a console. I already have the Dev Mode On/Off buttons in my bookmarks toolbar, so I point Chrome at http://localhost:8888/cold and press Dev Mode On. Voila! I can debug the client side with Chrome's developer tools and debug the server side in Eclipse. Moreover, when I make a source code change on the server side, I don't have to restart the server. Run Jetty Run picks up the change in seconds. (Chrome only. Alas, while I can see the client side Java in Firefox 31, it's entirely alphabetical by filename, and the codeserver debugger does not honor breakpoints.)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Re: general question about data handling

Easy one first... GWT emulates LinkedList so I don't understand that point. Anyway, LinkedList vs ArrayList is normally a very unimportant performance issue. IMHO you should code against List<T> generally...

On the architectural side: It is up to you, as developer/architect, to decide how much the client vs server does. I think GWT is very good in leaving this as a decision for you. You can even choose between high quality mechanisms like REST, GWT-RPC and RequestFactory.

In almost all cases I think you should be sending pure "data" to the client (not HTML/Widgets like Wicket or Vaadin do). I think the general security rule is to never trust the client. So when they send a request you much sanitise the data and enforce security rules every time.

I'd imagine the server might just be there to give the client the latest set of questions and then store the answers at the end?

Hope that helps?

Sam

On Wednesday, July 23, 2014 3:33:04 AM UTC+1, Gary Berkowitz wrote:
i am new to gwt and a fairly inexperienced developer.  i have written a java project that steps a user through an interview.  the structure is based on a linked list.  each node contains an object that consists of five string fields and one hash table.  the data file is in xml format and i use dom to populate the nodes.  the front end gui presents either a set of check boxes or radio buttons as response choices to a question.  there are four buttons: accept as is and go to the next node, go back, ignore the choices and type freely, and accept the choice but add to it.  nothing fancy but it works.

i am trying to convert the project to a web ap.  the client side gui is no problem.  but i am having difficulty conceptualizing the data exchange.  in my mind, everything should be processed on the server side and then the data object can be passed back to the client where gwt can do its html magic conversion.  but i can't find a lot of info on this type of structure so i am starting to think my concept is wrong.    almost every piece of info i can find including the gwt tutorial sends the data directly to the client.  if that is the case, what is left for the server to do?  and does that create security problems by having everything available on the client side?  also. i just read that gwt doesn't really support linked lists so i am not even sure that i can use that structure on the client side.  

any help would be appreciated.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Error: Unable to find class *_FieldSerializer

Hello,

I have some problems executing GWT Tests. I need to store an object (called DatabaseConnection) in my test. I have some input fields consisting of a list box, which is filled with all of these objects, which are currently stored in the database. So I have to store the object first, to test the input fields afterwards.

I have serveral tests, which needs to store a DatabaseConnection. If I execute each of these alone, everything works fine. But when I execute all my GWT test, I get the following error messeage, when I try to save the object:

java.lang.RuntimeException: Unable to find class DatabaseConnection_FieldSerializer

It seems to me, that the error comes before the object is actually stored.
My Test looks this:

public void test() {
   
TestHelper.resetDatabaseSync();


   
DatabaseConnection dbConnection = new DatabaseConnection();
   
TestHelper.storeDatabaseConnection(dbConnection, new AsyncCallback<Long>() {
     
@Override
     
public void onFailure(Throwable caught) {
       
// Here the test fails!
       
System.out.println(caught.getMessage());
        fail
();
     
}
     
@Override
     
public void onSuccess(Long id) {
     
}
   
});


   
Timer timer = new Timer() {
     
@Override
     
public void run() {
       
// create a input field and do some validataion


       
TestHelper.resetDatabaseSync();
        finishTest
();
     
}
   
};


   
// Waiting for asynchronous calls to finish.
    timer
.schedule(4000);


    delayTestFinish
(5000);
 
}


My DatabaseConnection implements Serializable and the TestHelper executes methods implemented in a RemoteServiceServlet.

Does anyone know why my test are depending on each other? I am clearing my test database before and after each test.

Thanks for your help!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Re: Web App Launch View Activator displays repeatedly in Progress tab on Eclipse and debugging is very slow

Hi Paul, 

Did you get any solution for your problem? I am also facing the same problem :(

On Wednesday, 25 June 2014 18:43:59 UTC+5:30, Paul Illingworth wrote:
Ok, thanks. I'll try Stack Overflow for now.

P.

On Wednesday, 25 June 2014 13:54:04 UTC+1, Thomas Broyer wrote:
"Web App Launch View Activator" is a Google Plugin for Eclipse thing, it doesn't come from GWT proper.
You'd better ask on StackOverflow (with tag google-plugin-eclipse), or in https://groups.google.com/d/forum/google-plugin-eclipse

On Wednesday, June 25, 2014 1:40:55 PM UTC+2, Paul Illingworth wrote:
Hi all,

I have a fairly simple GWT application that when I run in dev mode shows "Web App Launch View Activator" in Eclipse. This is causing problems, taking up a chunk of processing on my machine. It does the for about a while (a minute to several miuntes), then stops. I'm running in Firefox 20.0.1

It does this every time I visit a new "page" in my application (i.e. launch a new Activity and add the associated view to the page) or trigger somethings, but not all, on the UI. So, seems to happen when something new is added to the DOM maybe?

When it is displaying "Web App Launch View Activator" in the progress refreshing the browser to reload the application takes a very long time. If I wait for things to settle and the "Web App Launch View Activator" messaqes is no longer displaying a browser refresh is quite quick.

What is the GWT plugin doing when its is displaying "Web App Launch View Activator", what triggers it and what can I do to reduce the impact on my development?

Paul I.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Re: SuperDevMode & external server

Have you tried adjusting the "whitelist" setting for SDM?

On 07/30/2014 08:34 AM, Jack Thompson wrote:
Hello,

Our GWT app does REST operations with the web server that's hosting it. The server uses HTTP-Basic authentication for the REST operations. In production mode this naturally poses no problems. However in GWT development mode the issues of cross domain restrictions (CORS) come into play.

To work around this we've used the Eclipse option Debug as web application running on an external server and pointed it the url where the GWT app is deployed on the server. This works all fine but as we know the time is running out for the conventional GWT development mode and SuperDevMode is the future.

However we have not managed to get the SDM to work in manner similar to the way we've used the development in the past. We've got the code server up and running our GWT app with SDM debugging locally works but the REST calls fail due the above CORS issue. Trying to run the SDM externally similar to the development mode ends up in on the dev mode popup with the compile button missing with a tooltip saying This module does't have SDM enabled.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

SuperDevMode & external server

Hello,

Our GWT app does REST operations with the web server that's hosting it. The server uses HTTP-Basic authentication for the REST operations. In production mode this naturally poses no problems. However in GWT development mode the issues of cross domain restrictions (CORS) come into play.

To work around this we've used the Eclipse option Debug as web application running on an external server and pointed it the url where the GWT app is deployed on the server. This works all fine but as we know the time is running out for the conventional GWT development mode and SuperDevMode is the future.

However we have not managed to get the SDM to work in manner similar to the way we've used the development in the past. We've got the code server up and running our GWT app with SDM debugging locally works but the REST calls fail due the above CORS issue. Trying to run the SDM externally similar to the development mode ends up in on the dev mode popup with the compile button missing with a tooltip saying This module does't have SDM enabled.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

How to Style a PushButton with CSSResource

Hi I want to style a gwt-pushButton.

So in normal css I overwrite the gwt-PushButton style. 

But how to do this with a CSSResource ? 

It's no problem to change the background color or something like this, but I also want to change the diffrent states of the button. 

Any suggestions? 



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.