|
The ProblemThere is no helper class in GWT 1.4.x to access the URL param string that’s passed to the browser. The only way to do this easily would be to use the history mechanism, but that still doesn’t allow you to get key/value pairs, only tokens that are prefixed with "#". The SolutionWith some native JS calls, it’s easy to get the browser’s URL param string. Here’s the code: public static native String getParamString() /*-{ return $wnd.location.search;
}-*/;
public static HashMap parseParamString(String string){ String[] ray = string.substring(1, string.length()).split("&"); HashMap map = new HashMap();
for (int i=0; i<ray.length; i++){ GWT.log("ray["+i+"]="+ray[i],null); String[] substrRay = ray[i].split("=");
map.put(substrRay[0], substrRay[1]); } return map;
} Here’s how you use it: // get the browser's current URL param string (if there is any)
String paramstr = GWTUtils.getParamString(); // display the param string to the hosted shell
GWT.log(paramstr, null);
// parse the URL param string to a HashMap
HashMap params = GWTUtils.parseParamString(paramstr);
// print out the parsed HashMap
GWT.log(params.toString(), null); This and many other helpful utility functions will be available as part of the developerlife GWT module that we will release very soon. |
| Navigation: Go to top of page | Go to The Blog Index | Related Categories: Coding Quickie, GWT, Java | Related Tags: GWT, url param string Comments: Read comments | Write a comment |
| « New Tutorial – Deploying GWT Apps | New Tutorial – Using Browser History and Hyperlinks » |
- Coding Quickie
- GWT
- Java
I outline various strategies that can be used to create service-enabled Blackberry applications. These strategies include using Google Protocol Buffers, and the Mobile AJAX toolkit among others.
Google's Protocol Buffer technology - Protocol Buffers are similar to XML schemas, that you can compile from a language neutral schema definition into code (in different languages like Java, C++, and Python). However, there's no XML involved here, it's a lightweight binary encoding/decoding mechanism. You create your schema definitions in a .proto file and you compile that into Java code that you include with your applications (services, and mobile apps).
More information on the Nimbus Look and Feel. How to customize it, etc.
Coding Quickie - Android "SwingWorker" functionality
I've been working with Android recently and people have asked for a background Task API that works with Android, and other non Java SE environments. I plan on releasing the Task API for Android soon, however, it's not ready yet. So I'm writing this coding quickie to help those of you who need to spawn a background thread in Android, and have this thread rejoin the UI thread when it's done. The code below is just the rough skeleton of what is required to do such a thing. I'm going to release 3 new Android tutorials on developerlife this week, so stay tuned.
Coding Quickie - display a message while your GWT app loads
When a GWT application loads, nothing is actually displayed by your application until all the generated JavaScript has been downloaded by the browser. Find out how to display a loading screen while your GWT application is loading.
Coding Quickie - Wordpress mod - adding links & excerpts to related posts
I added some PHP code to make it easier for people to find related documents, when they are viewing any post on developerlife.com/tutorials. The PHP code can be downloaded from this post.
Lots of great new features in GWT 1.5.
SproutCore - Apple MobileMe JS library
SproutCore is Apple's open source JS library. Pundits claim that it will kill Flash and it can be used to write desktop apps for web browsers. Using a JS library that uses CSS styling that makes it resemble OSX's look and feel doesn't make it a desktop app :) .
Interesting videos on GWT from Google IO 2008. New DOM access API in GWT 1.5. Using Google APIs (search, maps) in GWT 1.5. And doing crazy stuff in GWT 1.5.
Ext has pulled some shenanigans to trick it's users... they adopted a bait 'n switch business policy to screw the OSS community and lots of their users... went from LGPL to GPL silently in the night. Classy and smart move on their part (sarcasm).
New Tutorial - Using GWT History to create an RSS client
This tutorial takes the background information on GWT History Management provided in the Managing History and Hyperlinks tutorial and uses it to create an RSS reader application that uses this history mechanism to load initialization parameters. The application that's built in this tutorial takes the RSS feed URL as a parameter passed to the web app's URL. You will also learn how to use ROME API, and explore different approaches to displaying application loading (splash) screens.
GWT Ext 2.0 was just released.
A conversation with Joshua Bloch on GWT
Great interview with Joshua Bloch about GWT.
New Tutorial - Using Browser History and Hyperlinks
When you are building GWT apps, that run in the context of a web browser, what should happen when the user of your app presses the Back or Forward button in their browser? GWT provides a way for your apps to hook into the browser's history mechanism, so that you can control what happens when a user hits Back or Forward in their browser. You can also programmatically manipulate the browser's history, and even create hyperlinks in your apps that can hook into the browser's history mechanism. You can even intercept these hyperlinks when a user clicks on them, instead of having the browser handle it, or both. This tutorial will show you how to leverage GWT's history mechanism and do some creative things with histories and hyperlinks that will be useful in your applications.
New Tutorial - Deploying GWT Apps
There are two aspects to deploying a GWT application: client side deployment, and server side packaging and deployment. In this tutorial, I will cover the different sets of issues that are tied to each aspect of deployment and packaging. Issues around cross site scripting, integration into existing webpages/apps, deployment as widgets, and much more are discussed in detail.
New Tutorial - Using Servlet Sessions in GWT
Because GWT web applications run inside of a browser, they are limited to making requests over HTTP. HTTP is a “stateless” protocol and it doesn’t provide any facilities for tracking previous transactions. In this tutorial you will learn how to use GWT’s RPC mechanism, specifically the RemoteServiceServlet, to enable session support in your GWT application.
New Tutorial - Using and creating GWT modules
If you are trying to build a complex GWT application that needs to be split into multiple modules, or if you need to import 3rd party modules into your application, this tutorial will show you how to do both of these things. We will import the GWT Log module, and we will also create a new module that you can include as a dependency for other modules/projects.
New Tutorial - Create GWT projects using IDEA
In this tutorial, I will walk you through the tasks you need to perform in IDEA 7 to create GWT projects. We will do the following: create a new project, add resources to it (images, stylesheets), create a web facet for deployment to an app server/servlet engine, add a loading screen for your app.
Dion Almaer talks about GWT, Google Gears, Java and JavaScript
Dion Almaer talks about GWT, Google Gears, Java and JavaScript
GWT version 1.4.61 has been released.
New Tutorial - Transport Objects over RPC - GWT Object Serialization
This tutorial will teach you how to create and use Serializable objects that can be transported over GWT's RPC mechanism.
Coding Quickie - display a message while your GWT app loads
When a GWT application loads, nothing is actually displayed by your application until all the generated JavaScript has been downloaded by the browser. Find out how to display a loading screen while your GWT application is loading.
New Tutorial - Building a GWT RPC Service
One of the most important pieces of the GWT framework is the GWT Remote Procedure Call (RPC) mechanism. This RPC mechanism makes it easy for a GWT application client to make a call to server-side code. GWT RPC makes it simple to get data between the client and the server. The server-side code that gets called from the client is referred to as a service. This tutorial will teach you how to build a GWT RPC Service.
New Tutorial - Anatomy of a GWT Project
The first step in writing any GWT application is setting up a GWT Project. This tutorial will introduce you to the ins and outs of GWT projects.
New Tutorial - Introduction to GWT
The first in developerlife.com's series of GWT tutorials has been posted. This first tutorial is a technical overview of GWT.
Update - GWT Tutorials coming soon
Web 2.0 is upon us and building an AJAX web application is a vital and marketable skill. Most AJAX web application development is done using HTML and JavaScript. But what are Java developers that aren't proficient in JavaScript supposed to do. Fear not, the Google Web Toolkit (GWT) is here to the rescue. You don't have to step too far outside your comfort zone and learn JavaScript, or delve too deeply into the potential hell that is Browser development. GWT provides a Java API that lets you build component based GUIs while avoiding JavaScript, and abstracting the HTTP protocol and HTML DOM model.
New Tutorial - Twitter API Integration
I’ve been building web, mobile, desktop apps that are powered by the ScreamingToaster ONE Platform for the last 3 years. I’ve had to integrate with a lot of services, like weather, credit card payment processing gateways, GeoIP lookups, CellID lookups, etc. One of the easiest integrations I’ve had to perform is with Twitter :) . Twitter has a simple to use API that can be accessed using Java or just about any other language. There are some really good Java wrappers for this API, and I’m going to highlight a really good one in this tutorial. I’m also going to show you how to integrate with Twitpic using Java.
RIM just released a new JDE version, you can download it here. Here’s a review of an early release of OS 5.0 on an actual Bold. 5.0 is going to be an awesome OS! In writing software for OS 4.6 for some time now, I’ve run into lots of limitations in media capture that are being addressed by 5.0! Video capture is coming in 5.0!
Sun has just been purchased by Oracle, as you must have read already. After the IBM buyout offer fell through, Oracle snapped Sun up. I’m selfish. I have a software company that uses lots and lots of Java technologies, and I’m wondering what this means to me in the long term :) . I’m sure there are lots of changes that Sun employees are going to have to go through, but I’m not worried about that, just being honest.
BlackBerry Mobile Blogging App for Drivelikeagirl.com
Download v1 of the BlackBerry App for Drivelikeagirl.com community. Must have BB OS 4.6 device or higher.
BlackBerry Application Storefront
RIM is launching it's app store in March 09. They are currently accepting submissions online. I'm planning on submitting all my apps for sale on the storefront, will you be doing the same?
Objective C introduction for Java developers, and creating iPhone apps with Java
This is a great video that shows Dr. Arno Puder giving a one hour presentation at Google. The highlights are a great introduction to the Objective C language for Java developers. The syntax is very strange, and very Smalltalk-like. Very interesting language... no runtime garbage collection, it uses reference counting.
JWebPane (WebKit for Java) details
JWebPane details from the new tech lead of the component... Looks very promising.
JavaFX 1.0 released - where is JWebPane?
JavaFX 1.0 was released last week, and it's great that it's out for Windows, but there are lots of things missing from it (like support for OSX or Linux). The biggest missing item for me is the Webkit browser component called JWebPane. I have been looking forward to using this component for months now, and it's still not out.
After months and months of beta testing, Update 10 is finally GA'd! Wohooo!
Google's Protocol Buffer technology - Protocol Buffers are similar to XML schemas, that you can compile from a language neutral schema definition into code (in different languages like Java, C++, and Python). However, there's no XML involved here, it's a lightweight binary encoding/decoding mechanism. You create your schema definitions in a .proto file and you compile that into Java code that you include with your applications (services, and mobile apps).
More information on the Nimbus Look and Feel. How to customize it, etc.
JavaFX Preview SDK just got released!
Lightweight UI Toolkit for JavaME
Rich UI toolkit for JavaME inspired by Swing. It's open source and on java.net.
Java 6 for OSX Leopard was released. No support for 32 bit Intel CPUs or PowerPC CPUs, only 64 bit Intel CPUs supported.
More on Java WebKit and Filthy Rich Client presentations
More information on WebKit for Java (JWebPane) for JavaFX. Great presentation from Chet Haase & Romain Guy at this years JavaOne 2008, Filthy Rich Client session with a timingframework fix.
JavaFX goodies - WebKit for Java and much much more!!!
Some interesting APIs are coming with JavaFX. This post talks about Scene Graph API and JWebPane component.
JDK6 Update10 Beta D3D problems - 15x slowdown fixed
15x slowdown on certain Java2D operations using the d3d hardware accelerated pipeline on JDK6 Update 10 BETA Build 22.
Native font rasterization limitations in Java 6 Update 10
2 issues with native font rasterization on Java 6 Update 10.
Native font rasterization in Java! :)
Native font rasterization in Java! Finally!
iPhone SDK and it's problems. Java on iPhone? ActiveSync vs. RIM's NOC-based-approach of pushing email.
Java 6 Update N, Beta Build b13 available for download
Exciting details on Java 6 Update N - new Java Plug-In for applet/Webstart app deployment, JS Deployment Toolkit for applets, Java Kernel, etc.
New Tutorial - Using GWT History to create an RSS client
This tutorial takes the background information on GWT History Management provided in the Managing History and Hyperlinks tutorial and uses it to create an RSS reader application that uses this history mechanism to load initialization parameters. The application that's built in this tutorial takes the RSS feed URL as a parameter passed to the web app's URL. You will also learn how to use ROME API, and explore different approaches to displaying application loading (splash) screens.
Java SceneGraph Effects Framework
Java SceneGraph Effects Framework API demos.
SwingX 0.9.2 release coming soon
SwingX 0.9.2. coming soon...
Android SDK to get "significant updates" - Android Developer Challenge deadline extended
Google has apparently been paying attention to the widespread developer frustration with their Android SDK and has announced that they will be releasing a major update to the Android SDK "in the next several weeks". Google has also decided to extend the deadline for their Android Developer Challenge.
Detailed overview of the Sun SPOT - Small Programmable Object Technology.
New Tutorial - SwingX JXBusyLabel
This tutorial will show you how to use SwingX's JXBusyLabel component to display an indeterminate progress indicator. It will also show you advanced configuration options that allow you to create different and interesting indeterminate progress indicators using the BusyPainter.
Text component add-ons for Java Swing/SwingX
XSwingX, created by Peter Weishapl, is a set of components that add much needed functionality to textboxes, and textareas. You can add prompts inside of text components themselves, and add "buddy components" to these text components as well.
New Tutorial - SwingX JXTaskPane and JXTaskPaneContainer
This tutorial will walk you through the steps required to use JXTaskPane and JXTaskPaneContainer in SwingX. You will learn how to change the default color schemes of these components, and add components and actions to task panes.
Java 6 Update N - hello "java kernel"
Say hello to Java Kernel. Part of great things to come with Java 6 Update N, Java 7, and JavaFX...
New Tutorial - Using Browser History and Hyperlinks
When you are building GWT apps, that run in the context of a web browser, what should happen when the user of your app presses the Back or Forward button in their browser? GWT provides a way for your apps to hook into the browser's history mechanism, so that you can control what happens when a user hits Back or Forward in their browser. You can also programmatically manipulate the browser's history, and even create hyperlinks in your apps that can hook into the browser's history mechanism. You can even intercept these hyperlinks when a user clicks on them, instead of having the browser handle it, or both. This tutorial will show you how to leverage GWT's history mechanism and do some creative things with histories and hyperlinks that will be useful in your applications.
New Tutorial - Deploying GWT Apps
There are two aspects to deploying a GWT application: client side deployment, and server side packaging and deployment. In this tutorial, I will cover the different sets of issues that are tied to each aspect of deployment and packaging. Issues around cross site scripting, integration into existing webpages/apps, deployment as widgets, and much more are discussed in detail.
New Tutorial - Using Servlet Sessions in GWT
Because GWT web applications run inside of a browser, they are limited to making requests over HTTP. HTTP is a “stateless” protocol and it doesn’t provide any facilities for tracking previous transactions. In this tutorial you will learn how to use GWT’s RPC mechanism, specifically the RemoteServiceServlet, to enable session support in your GWT application.
New Tutorial - Using and creating GWT modules
If you are trying to build a complex GWT application that needs to be split into multiple modules, or if you need to import 3rd party modules into your application, this tutorial will show you how to do both of these things. We will import the GWT Log module, and we will also create a new module that you can include as a dependency for other modules/projects.
Web browser and Flash player for Java Swing!
Integrate native browser components and Flash player into your Java Swing apps with DJ!
New Tutorial - Create GWT projects using IDEA
In this tutorial, I will walk you through the tasks you need to perform in IDEA 7 to create GWT projects. We will do the following: create a new project, add resources to it (images, stylesheets), create a web facet for deployment to an app server/servlet engine, add a loading screen for your app.
Kind words for Eclipse Europa, from a die hard IntelliJ IDEA power user.
These are some of my initial thoughts on Google's Android, after having spent a few days working with the SDK.
Neal Gafter offers a rebuttal to Closure Controversy Presentation by Joshua Bloch
Neal Gafter offers a rebuttal to Joshua Bloch's Closure Controversy Presentation
Great presentation by Joshua Bloch - The Closures Controversy
Great presentation by Joshua Bloch on the current debate over Closures in Java
Does Java really need expanded Closure support. A humorous take on the issue.
Dion Almaer talks about GWT, Google Gears, Java and JavaScript
Dion Almaer talks about GWT, Google Gears, Java and JavaScript
Coding Quickie - display a message while your GWT app loads
When a GWT application loads, nothing is actually displayed by your application until all the generated JavaScript has been downloaded by the browser. Find out how to display a loading screen while your GWT application is loading.
Lots of wonderful things are happening for Java desktop apps. Enter the new SceneGraph API for Java. What is a SceneGraph? Java2D is an immediate mode API, which means that your code is executed when the screen must be refreshed/painted, and your code draws to the screen immediately. SceneGraph in contrast is a retained mode API, which means that you declare what you want to happen and when. But the API figures out the caching, dealing with repaints, clipping, and lots of other low level details that you normally have to deal with - which makes it easier to use!
SoyLatte - Java 6 on OSX Release 1.0
There is an open source effort to create a Java 6 VM for Leopard. You can get more details on SoyLatte here - http://landonf.bikemonkey.org/code/macosx/.
IntelliJ IDEA 7.0.2 just released
IDEA v7.0.2 maintenance update just released
Java is an awesome language. I'd forgotten how wonderful it is, until I started coding in other languages and environments. Java does not face the innovators dilemma, it's stronger than it's ever been before!

September 10th, 2008 at 10:55 am
try this instead:
Window.Location.getParameter(“param”)
December 16th, 2008 at 5:18 am
Ditto am… I wish you would update your entry with this up top.
I didn’t notice am’s comment until I came back here to post the same thing ;p