About Question enthuware.ocejws.v6.2.184 :

Moderators: Site Manager, fjwalraven

Post Reply
mmookkiah
Posts: 4
Joined: Sun Apr 20, 2014 6:33 pm
Contact:

About Question enthuware.ocejws.v6.2.184 :

Post by mmookkiah » Wed Apr 23, 2014 2:58 pm

Don't we need annotation @Consumes("application/x-www-form-urlencoded") for request processor to choose right method in this question?

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.184 :

Post by fjwalraven » Wed Apr 23, 2014 3:15 pm

Hi !

It is not necessary to add an @Consumes annotation. When you don't provide one to your method it will use the default @Consumes("*/*") annotation (meaning: all media types are allowed).

Regards,
Frits

mmookkiah
Posts: 4
Joined: Sun Apr 20, 2014 6:33 pm
Contact:

Re: About Question enthuware.ocejws.v6.2.184 :

Post by mmookkiah » Wed Apr 23, 2014 4:16 pm

Html form submit sends HTTP request with header "Content-Type: application/x-www-form-urlencoded". In this case, the method which consumes "application/x-www-form-urlencoded" take higher precedence than method consumes "*/*".
Am I Correct?

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.184 :

Post by fjwalraven » Wed Apr 23, 2014 10:53 pm

Correct, that is how it normally works if there are multiple methods in the same root resource class.

However, in this question, the methods cannot be in the same resource file (they all have the same name and number of parameters).

Regards,
Frits

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests