handle GET request in RPC servlet using doGet()

169 views
Skip to first unread message

karun kumar

unread,
Sep 24, 2012, 6:01:19 PM9/24/12
to Google Web Toolkit
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

karun

unread,
Sep 27, 2012, 6:44:45 AM9/27/12
to google-we...@googlegroups.com
Hi

can some one clarify my doubt.

Thanks
karun
Reply all
Reply to author
Forward
0 new messages