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 »

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 »

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 »

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 »

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 17 guests