• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet object created by reflaction mechanism

 
Anant Jagania
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Does servlet object created using java.lang.reflect.Constructor by container?

Regards,
Anant
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't imagine so, Class.forName().newInstance() would do
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
I wouldn't imagine so, Class.forName().newInstance() would do


Hi Dave,
can you please more enlighten on your statement..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64964
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Point is, while reflection is certainly used -- how else could a class be instantiated given its class name as a string? -- the exact mechanism is up to the container.

But, in order to create a new instance of a class using the default contructor, I couldn't imagine it doing anything other than what David posted.
 
Anant Jagania
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay... got it...

but container has to fire the init() method of the servlet. Does it mean that after creating an object of servlet container will fier the init() method on it, or again it would be a reflection mechanism to do so?
 
Anant Jagania
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot guys.. got the point..
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit: issues with the moderators should be brought up via email or the JavaRanch forum]
[ March 12, 2007: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic