Changes between Version 24 and Version 25 of UTGBCore/RequestDispatcher


Ignore:
Timestamp:
10/05/07 10:08:41 (18 years ago)
Author:
leo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UTGBCore/RequestDispatcher

    v24 v25  
    5050}}}
    5151
    52 Our RequestDispatcher automatically set these parameter values from a given HTTP request. For example, an HTTP request 
     52Our RequestDispatcher automatically sets these parameter values from a given HTTP request. For example, an HTTP request 
    5353
    5454http://localhost:8989/hello.action?name=leo&year=2007
     
    5656will invoke setName("leo") and setYear(2007) methods.
    5757
    58 Note that, although the query string in the HTTP request consists of string values, our BeanUtil library
     58Note that, although the query string in the HTTP request consists of string values "leo" and "2007", our BeanUtil library
    5959detects the data type to which the string should be translated by analysing the class definition. In this example, the string value
    6060 "2007" is translated into an integer, 2007.
     
    6868Unfortunately, GWT-hosted mode that uses gwt-embedded TomcatServer and GWTShell, does not support
    6969servlet-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.   
     70redirects HTTP requests within GWT Shell to the public folder within the module directory or servlet codes within the server folder.   
    7171
    7272 * Reference: tomcat/webapps/ROOT/WEB-INF/web.xml (the web app configuration file used in GWT-hosted mode)
     
    9090}}}
    9191
    92 GWTShellServlet is mandatory to debug client-side codes within within Eclipse (or other IDEs).
     92Anywary, GWTShellServlet is mandatory to debug client-side codes within within Eclipse (or other IDEs).
    9393
    94 Thus, there is no way to use following web.xml setting effectively.
     94The problem is, there is no way to use the following web.xml setting effectively.
    9595{{{
    96 <url-pattern>*.action</url-pattern>
     96  <servlet-mapping>
     97    <servlet-name>dispatcher</servlet-name>
     98    <url-pattern>*.action</url-pattern>
     99  </servlet-mapping>
    97100}}}
    98101Even 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.
     
    119122}}}
    120123
    121 This setting redirects a request to GWT.getModuleBaseURL() + "/dispatcher" to the RequestDispatcher servlet. This is effective only in GWT-hosted mode!
     124This setting redirects a request for GWT.getModuleBaseURL() + "/dispatcher" to the RequestDispatcher servlet. This setting works only in GWT-hosted mode.
    122125
    123 And write a URL resolver method:
     126And then, write a URL resolver method anywhere within client-side codes you want:
    124127{{{
    125128    public static String getActionURL(String actionName, String queryString)
     
    137140}}}
    138141
    139 This method yields the appropriate URL to access the RequestDispatcher both in hosted-mode and web-mode.
     142This method yields the appropriate URLs to access the RequestDispatcher both in hosted-mode and web-mode.
    140143For example, getActionURL("hello", "name=leo") returns:
    141144 * (GWT moduleBase)/hello.action?name=leo  (in web-mode)