java - RESTful service -


i have write restful service client have problems functions because cant figure media type should @produces.

basically have few operations strings: counting words, finding index of substring, counting symbols , reversing string.

i have no problems reversing string, other 3 facing problem because seems can`t @produce int reason.

what type should use can @produce int can return it?

here java code:

 public int getnumberofwords(java.lang.string parameter) {   int words;          string [] sentence = parameter.split(" ");         words = sentence.length;          return words;       public int getnumberofsymbols(java.lang.string parameter) {         //todo implement method         //throw new unsupportedoperationexception("not implemented yet.");    return (int) parameter.chars()             .distinct()             .count();     public java.lang.string invertstring(java.lang.string text) {     //todo implement method     //throw new unsupportedoperationexception("not implemented yet.");      int i, len = text.length(); stringbuilder dest = new stringbuilder(len);  (i = (len - 1); >= 0; i--){     dest.append(text.charat(i)); }  return dest.tostring();     public int findsubstr(java.lang.string text, java.lang.string substr) {       return text.indexof(substr); 

so first 3 functions problematic. tried @produces application/json type.

@produces("application/json") allow return json method of restfull has mapped object in client side, if simple thing string, or integer.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -