Changes between Version 24 and Version 25 of UTGBCore/RequestDispatcher
- Timestamp:
- 10/05/07 10:08:41 (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UTGBCore/RequestDispatcher
v24 v25 50 50 }}} 51 51 52 Our RequestDispatcher automatically set these parameter values from a given HTTP request. For example, an HTTP request52 Our RequestDispatcher automatically sets these parameter values from a given HTTP request. For example, an HTTP request 53 53 54 54 http://localhost:8989/hello.action?name=leo&year=2007 … … 56 56 will invoke setName("leo") and setYear(2007) methods. 57 57 58 Note that, although the query string in the HTTP request consists of string values , our BeanUtil library58 Note that, although the query string in the HTTP request consists of string values "leo" and "2007", our BeanUtil library 59 59 detects the data type to which the string should be translated by analysing the class definition. In this example, the string value 60 60 "2007" is translated into an integer, 2007. … … 68 68 Unfortunately, GWT-hosted mode that uses gwt-embedded TomcatServer and GWTShell, does not support 69 69 servlet-mapping in web.xml, since every path (/*) is already mapped to GWTShellServlet, which 70 redirects HTTP requests within GWT Shell to the public folder or servlet codes.70 redirects HTTP requests within GWT Shell to the public folder within the module directory or servlet codes within the server folder. 71 71 72 72 * Reference: tomcat/webapps/ROOT/WEB-INF/web.xml (the web app configuration file used in GWT-hosted mode) … … 90 90 }}} 91 91 92 GWTShellServlet is mandatory to debug client-side codes within within Eclipse (or other IDEs).92 Anywary, GWTShellServlet is mandatory to debug client-side codes within within Eclipse (or other IDEs). 93 93 94 Th us, there is no way to use following web.xml setting effectively.94 The problem is, there is no way to use the following web.xml setting effectively. 95 95 {{{ 96 <url-pattern>*.action</url-pattern> 96 <servlet-mapping> 97 <servlet-name>dispatcher</servlet-name> 98 <url-pattern>*.action</url-pattern> 99 </servlet-mapping> 97 100 }}} 98 101 Even if you put the avobe setting into tomcat/webaps/ROOT/WEB-INF/web.xml, it does not work because of the mapping /* to GWTShellServlet overshadows other mappings. … … 119 122 }}} 120 123 121 This setting redirects a request to GWT.getModuleBaseURL() + "/dispatcher" to the RequestDispatcher servlet. This is effective only in GWT-hosted mode!124 This setting redirects a request for GWT.getModuleBaseURL() + "/dispatcher" to the RequestDispatcher servlet. This setting works only in GWT-hosted mode. 122 125 123 And write a URL resolver method:126 And then, write a URL resolver method anywhere within client-side codes you want: 124 127 {{{ 125 128 public static String getActionURL(String actionName, String queryString) … … 137 140 }}} 138 141 139 This method yields the appropriate URL to access the RequestDispatcher both in hosted-mode and web-mode.142 This method yields the appropriate URLs to access the RequestDispatcher both in hosted-mode and web-mode. 140 143 For example, getActionURL("hello", "name=leo") returns: 141 144 * (GWT moduleBase)/hello.action?name=leo (in web-mode)