Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in Mock exam

 
Gurukant Desai
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a problem in solving a question 2 of Java beat mock simulator.

------------------------------------------------------------------------
2. You need to send large amount of binary data from the browser to a servlet to be processed. (Say, you want to attach a file while sending email through a web based system). What HTTP method would you use?
Select 1 correct option.
A.GET
B.POST
C.HEAD
D.HIDDEN
E.PUT
-------------------------------------------------------------------------
Correct answer given is B. whereas I think answer is E
Reason:- I could get this statement from Mikalai's note that "The PUT
operation allows a client to place a file on the server and is similar to sending a file by FTP." and as data in this case is "large amount of binary data". I think E is better option than B.

Please reply whether I am right/wrong?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The PUT method is not supported by browsers (or HTML forms), so that would not work.

It is possible to create PUT requests using the JavaScript XMLHttpRequest object, but JavaScript has no access to the client file system.
 
Abi Ted
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are wrong. PUT overwrites target url with the content you send.
The question clearly specifies that the servlet needs to process the content. So the content is POSTed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic