• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

how call the doGet method

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
i have one question : i want to know who call the doGet method or doPost method container or service method.

answer is
[code]
Answer


C)

This code is valid and will handle all three types of HTTP requests including GET, POST, and PUT.

D)

The next method invoked is destroy.

[/code}
i don't have problem with second answer [d] but i have problem with choice [c] please clear it.
thanks in advance
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Markandey.

The service method is the one responsible to call doGet, doPost, doPut, depending on the request type. In this case, it is just not calling these methods (but it's handling the requests anyway). Is it clear?
 
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand this right.

You could overwrite the service-method if you want a single method which handles the doGet, doPost, doPut.
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It rarely makes sense to override the service method: Servlet FAQ entry
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no Hard and fast rule to override service method if you extend HttpServlet.Since service method implementation is provided in HttpServlet class.Container will call this service method if you don't override it.
Here there is logic which will call your doXxx() methods depending on its method type.If your overriding service method you are telling the container please call my service method rather than service method of HttpServlet class
please correct me if i m wrong
 
Ulf Dittmer
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

There is no Hard and fast rule to override service method


True, but there are good reasons not to do so; the FAQ entry lists two of them.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic