• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

Enhancing your GWT Application with the UrlRewriteFilter ...

Last week, I spent some time trying to change the location of my cache/nocache HTML files in my GWT project. I started the project with the gwt-maven-plugin is archetype. The message I posted to the gwt-maven Google Group is below.

Rather than having my application is HTML file in src/main/java/com/mycompany/Application.html, I would like to move it to src/main/webapp/index.html. I tried copying the HTML and adding the following to my index.html, but no dice:

<meta name="gwt:module" content="com.mycompany.Application"/>

Is this possible with the gwt-maven-plugin? I would like to have my main HTML and CSS at the root of my application.

The good news is I figured out a solution using the UrlRewriteFilter that 1) allows hosted mode to work as usual and 2) allows your app to be served up from the root URL (/ instead of /com.company.Module/Application.html). Here is the urlrewrite.xml that makes it all possible.
view source
print?
01.<?xml version="1.0" encoding="UTF-8"?>
02.<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
03.        "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
04.
05.<urlrewrite>
06.    <rule>
07.        <from>/$</from>
08.        <to type="forward" last="true">/com.mycompany.app.Application/Application.html</to>
09.    </rule>
10.    <rule>
11.        <from>/index.html</from>
12.        <to type="forward" last="true">/com.mycompany.app.Application/Application.html</to>
13.    </rule>
14.    <-- This last rule is necessary for JS and CSS files -->
15.    <rule>
16.        <from>^/(.*).(.*)$</from>
17.        <to type="forward">/com.mycompany.app.Application/$1.$2</to>
18.    </rule>
19.</urlrewrite>

If you are using the gwt-maven plugin, this file goes in src/main/webapp/WEB-INF. In addition, you will need to add the following to your web.xml.
view source
print?
01.<filter>
02.    <filter-name>rewriteFilter</filter-name>
03.    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
04.</filter>
05.
06.<filter-mapping>
07.    <filter-name>rewriteFilter</filter-name>
08.    <url-pattern>/*</url-pattern>
09.</filter-mapping>

 Original Source:
http://raibledesigns.com/rd/entry/enhancing_your_gwt_application_with

AddThis Social Bookmark Button

Posted at 09:29:42 am | Permalink | Posted in Java  

Related Stuff

  • MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.

  • Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone

  • TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support

  • ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.

  • Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.

  • Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software

  • PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Top Stuff

e-messenger

MSN Web Messenger

eBuddy

ASP.NET Ajax CalendarExtender and Validation

AIM Express

Ajax Tools for ASP.NET Developers



About Ajaxlines

Ajaxlines is a project focused on providing its audience with a database of most of Ajax related articles, resources, tutorials and services from around the world.

Its purpose is to showcase the power of Ajax and to act as a portal to the Ajax development community.


Search


Topics

  • .Net (176)
  • Ajax (112)
  • Ajax Games (10)
  • Articles (95)
  • Bookmarking (35)
  • Calendar (21)
  • Chat (45)
  • ColdFusion (3)
  • CSS (84)
  • Email (23)
  • Facebook (84)
  • Flash (20)
  • Google (54)
  • Html (29)
  • Image (12)
  • International Calls & VOIP (7)
  • Java (58)
  • Javascript (280)
  • jQuery (200)
  • JSON (75)
  • Perl (2)
  • PHP (172)
  • Presentation (19)
  • Python (3)
  • Resources (2)
  • RSS (8)
  • Ruby (32)
  • Storage (4)
  • Toolkits (103)
  • Tutorials (227)
  • UI (11)
  • Utilities (174)
  • Web2.0 (18)
  • XmlHttpRequest (29)
  • YUI (13)

© 2006 www.ajaxlines.com. All Rights Reserved. Powered by IRange