-

 - .

 -

 -

   Greedsoul

 - e-mail

 

 -

( : 2) -INFERNO- Placebo
( : 1) Deviant_ART

 -

 LiveInternet.ru:
: 03.01.2010
: 57
: 225
: 573

:


HttpRequest, HttpResponse, Get Post

, 06 2012 . 16:39 +
: , . - .

, , ( , ). " ". , ? , , submit. - , .

- * . -. Request Response ( ). -, ( html ). , : html , ?

httpRequest , : Get Post. Get . url, "?", , . , , , . Name=Value.

. , .
html , , name="someName", value="emptyValue"/defaultValue="defaultValue".

:
input name="login" value="" /
input name="pass" value="" /

: name=value "&".

Get http://somesite.com/login.html?login=myLoginName&pass=myPassword

Get , Post. , Post - Get . Post , Get + user-agent, cookies, cookie-policy host, content-length, connection-type.

, Post , Post . , - ( - java. ):

...
code:

HttpConnection conn = null;
String url = "http://www.mysite.com/login.jsp";
String agent = "Mozilla/4.0";
String rawData = "userid=joe&password=guessme";
String type = "application/x-www-form-urlencoded";

String encodedData = encode( rawData ); // user-supplied

try {
conn = (HttpConnection) Connector.open( url );
conn.setRequestMethod( HttpConnection.POST );
conn.setRequestProperty( "User-Agent", agent );
conn.setRequestProperty( "Content-Type", type );
conn.setRequestProperty( "Content-Length",
encodedData.length() );

OutputStream os = conn.openOutputStream();
os.write( encodedData.getBytes() );

int rc = conn.getResponseCode();
... // process it
}
catch( IOException e ){
// handle the error here
}


...
() http://developers.sun.com/mobility/midp/ttips/HTTPPost/





*Web- , HTTP-, .
:  

: [1] []
 

:
: 

: ( )

:

  URL