javascript - REST request to JAVA Servlet -


i have javascript want perform rest request (get) servlet. format of record want send in following format ...

/id1/vara/varb/varc/timedelta1,timedelta2,timedelta3,....,timedeltan/  

so there 5 attributes in each record send. need batch these - i'm sending multiple records in single request. url might little following.

myservletname/id1/vara/varb/varc/timedelta1,timedelta2,timedelta3/id2/vara/varb/varc/timedelta1,timedelta2,timedelta3/id3/vara/varb/varc/timedelta1,timedelta2,timedelta3/   

i'm aware on limit of around 2000 chars in url string keep things safe i'll ensure length of url less this. in above example 3 records sent servlet.

i'm wondering how might process these on server end. havent worked rest before in java. need on server end process these urls extract data ?

thanks

basically

public class restservlet extends httpservlet {     public void doget(httpservletrequest request, httpservletresponse response) {         string uri = request.getpathinfo();         pattern p = pattern.compile(             "/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(\d+)(?:,(\d+))*/"         );         matcher m = p.matcher(uri);         if (m.matches()) {             string id = m.group(1);             string vara = m.group(2);             string varb = m.group(3);             string deltas = m.group(4);              // etc         }     } } 

it's not model how it, simple , understandable not familiar servlets


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -