Thursday, September 27, 2012

Re: handle GET request in RPC servlet using doGet()

Hi

can some one clarify my doubt.

Thanks
karun

On Tuesday, September 25, 2012 3:31:47 AM UTC+5:30, karun wrote:
Hi All,
 
I have a servlet "DBLookUpImpl" which implments RemoteServiceServlet. at present I am using this servlet for RPC calls.
 
can I override the doGet() in DBLookUpImpl servlet and invoke the servlet from browser using the url mentioned in url-pattern in web.xml ?
 
when i tried this way i am getting below error but i have put one system.out.println statement which gets printed in tomcat console.
 
HTTP ERROR: 405
HTTP method GET is not supported by this URL
 
code snippet of "DBLookUpImpl"
 
public class DBLookUpImpl extends RemoteServiceServlet implements DBLookUpService{
 
public String getLocaleString(String str) { // RPC method every thing works fine
 
return some string;
 
}
 
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
System.out.println("insdie DBLookUpImpl  class"); // this message gets printed in tomcat console, i dont see any html being displayed instead i see HTTP ERROR: 405
PrintWriter out = resp.getWriter();
out.print("<html>");
out.print("<body>");
out.print("<h1>welcome user</h1>");
out.print("</body>");
out.print("</html>");
 
 
code snippet of web.xml
 
<servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>com.google.gwt.sample.stockwatcher.server.DBLookUpImpl</servlet-class>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/stockwatcher/greet</url-pattern>
  </servlet-mapping>
 
can you some help me on this.
 
Thanks
karun

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/bignCjx3R10J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment