1

I have a url:

http://myserver.appspot.com/service/exec?key=0AkG

how would I remap it to:

http://myserver.appspot.com/webapp.html?key=0AkG

where "key" is different every time.

Options: 1) "*.gwt.xml" or "web.xml" - might be able to do the map, but did not find the right option - (filter looks the best bet, but requires code). I also tried creating a file called "exec" but it did not like the lack of the ".html" and the browser downloads the file.

2) URL re-writer. It hard to know which of these will work on GWT+GAE, did not find one yet.

eddyparkinson
  • 3,680
  • 4
  • 26
  • 52

2 Answers2

0

add this to web.xml, it worked:

<servlet>
<servlet-name>oldProxy</servlet-name>
<jsp-file>/proxy.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>oldProxy</servlet-name>
<url-pattern>/service/exec</url-pattern>
</servlet-mapping>

docs for:

  <jsp-file>

http://docs.oracle.com/cd/E13222_01/wls/docs81/webapp/web_xml.html#1039287

eddyparkinson
  • 3,680
  • 4
  • 26
  • 52
  • Yes, this is the normal way to handle paths, but the `servlet-mapping` syntax is very limited, and you need some extra code to rewrite certain cases, or redirect crawlers etc. –  Feb 26 '13 at 06:41
  • This is not the most appropriate answer, why dont you select the other one? –  Mar 08 '13 at 09:00
  • @emecedo I selected the answer that has been confirmed as working. I know the jsp-file solution above works and was easy to setup. I did not have any luck with the URL re-writer. Manolo gave a good answer, I did upvote it. I would still be interested in confirming if GWT works with UrlRewriteFilter, or other URL re-writers. – eddyparkinson Mar 11 '13 at 23:25
  • 1
    I can confirm that Manolo's response works, I had the same problem and after reading this thread, I did follow the tutorial and my app is working with the `UrlRewriterFilter` and I have set a long list of redirections which could be impossible to maintain with .jsp's –  Mar 16 '13 at 07:45
0

You need some URL re-writer.

GAE runs jetty, and it has its own rewriter handler, but since it seems no possible to extend their jetty.xml configuration for security reasons, you need to configure a filter in your web.xml

There are many filter examples around the Internet, but what I found easy to setup and configure is the UrlRewriteFilter.

You have a tutorial to setup the UrlRewriterFilter in GAE

Manolo Carrasco Moñino
  • 9,723
  • 1
  • 22
  • 27
  • Do you know if UrlRewriteFilter. works on GWT + GAE? I tried pretyfaces, but did not get it to work. A few people suggested URL re-writers here: http://stackoverflow.com/questions/2297056/pretty-urls-in-google-app-engine/6529643#comment21174035_6529643 but is hard to know which work on GWT + GAE. – eddyparkinson Feb 25 '13 at 22:57
  • 1
    Yes, UrlRewriteFilter works in GAE, see this: http://aaronjlynch.com/2009/11/25/url-rewriting-on-google-app-engine/ – Manolo Carrasco Moñino Feb 26 '13 at 06:37
  • and GWT? - I suspect it was GWT that caused problems with pretyfaces. – eddyparkinson Feb 26 '13 at 07:31
  • 1
    Well, strictly speaking, GWT is browser-side JS. GWT adds a couple of server-side utilities so as it is easier for java-only projects to pass objects over the wire (RPC, RF), but there are hundreds of gwt apps working with python, ruby, php as well. I dont see any kind of interferences in server side with prettyfaces unless some sort of classpath issue (different version of libraries, etc). – Manolo Carrasco Moñino Feb 26 '13 at 08:01