Changes between Version 7 and Version 8 of UTGBCore/RequestDispatcher
- Timestamp:
- 10/04/07 18:57:46 (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UTGBCore/RequestDispatcher
v7 v8 69 69 redirects requests to public folder or servlet codes. 70 70 71 * tomcat/webapps/ROOT/WEB-INF/web.xml (the web app configuration file used in GWT-hosted mode) 72 {{{ 73 <?xml version="1.0" encoding="UTF-8"?> 74 <web-app> 75 76 <servlet> 77 <servlet-name>shell</servlet-name> 78 <servlet-class>com.google.gwt.dev.shell.GWTShellServlet</servlet-class> 79 </servlet> 80 81 82 <servlet-mapping> 83 <servlet-name>shell</servlet-name> 84 <url-pattern>/*</url-pattern> 85 </servlet-mapping> 86 87 </web-app> 88 89 }}} 90 71 91 GWTShellServlet is mandatory to debug client-side codes within within Eclipse (or other IDEs). 72 73 92 74 93 Thus, there is no way to use following web.xml setting effectively. … … 76 95 <url-pattern>*.action</url-pattern> 77 96 }}} 78 Even if you put the avobe setting 79 into tomcat/ROOT/WEB-INF/web.xml, it does not work because of the mapping /* to GWTShellServlet overshadows other mappings. 97 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. 80 98 99 In order to use RequestDispatcher, which support rappid web application development, we introduce some tricks that 100 changes query arguments to the RequestDispather. 81 101 102 First, you have to set a servlet path within your GWT module xml file. (*.gwt.xml): 103 {{{ 104 <module> 82 105 106 <!-- Inherit the core Web Toolkit stuff. --> 107 <inherits name="org.utgenome.gwt.web.Web"/> 108 <inherits name='com.google.gwt.user.User'/> 109 <inherits name="com.google.gwt.json.JSON"/> 110 <inherits name="com.google.gwt.http.HTTP"/> 111 <inherits name="com.google.gwt.xml.XML"/> 112 <!-- Specify the app entry point class. --> 113 <entry-point class='org.utgenome.gwt.utgb.client.UTGBResourceCenter'/> 114 115 <servlet path="/dispatcher" class="org.utgenome.gwt.utgb.server.RequestDispatcher"/> 116 117 </module> 118 }}} 83 119 120 This setting redirects a request to GWT.getModuleBaseURL() + "/dispatcher" to the RequestDispatcher servlet. This is effective only in GWT-hosted mode! 121 122 And write a URL resolver methods, described as follows: 123 {{{ 124 public static String getActionURL(String actionName, String queryString) 125 { 126 if(GWT.isScript()) 127 { 128 return GWT.getModuleBaseURL() + actionName + ".action?" + queryString; 129 } 130 else 131 { 132 return GWT.getModuleBaseURL() + "dispatcher?actionClass=" + "org.utgenome.gwt.utgb.server.app." + actionName + "&" + queryString; 133 } 134 } 135 }}} 136 137 This method yields appropriate URLs to access the RequestDispatcher both in hosted-mode and web-mode. 138 For example, getActionURL("hello", "name=leo") returns: 139 * (GWT moduleBase)/hello.action?name=leo (in web-mode) 140 * (GWT moduleBase)/dispatcher?actionClass=org.utgenome.gwt.utgb.server.app.hello&name=leo (in hosted-mode) 141