How can I get POST variable form HTTP header with java? -


 socket client = ss.accept();                        bufferedreader in = new bufferedreader(new inputstreamreader(client.getinputstream()));             printwriter out = new printwriter(client.getoutputstream());             out.print("http/1.1 200 \r\n");              out.print("content-type: text/html\r\n");             out.print("\r\n");               out.print("<form method='post' action=''>first name: <input type='text' name='firstname' value='mickey'><br><input type='submit' value='submit'></form>"                     + "\r\n");              string line;              while ((line = in.readline()) != null){                 if(line.length() == 0) {                     break;                 }                      system.out.println(line);             }             system.out.println("lõpp");             out.close();             in.close();             client.close(); 

this code gives me after pressing submit.

post / http/1.1 host: localhost connection: keep-alive content-length: 16 cache-control: max-age=0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 origin: http://localhost user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/41.0.2272.118 safari/537.36 content-type: application/x-www-form-urlencoded dnt: 1 referer: http://localhost/ accept-encoding: gzip, deflate accept-language: et,en-us;q=0.8,en;q=0.6 cookie: s_ncomui_ev14=%5b%5b%27link%27%2c%271423849771968%27%5d%5d 

there should 1 balnk line , post variables. in.readline() blocks code. browswer keeps loading. have stop manualy.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -