1. ??, url? ??? ??? ?? ????? ????, URL ???? java.net ??? ??????.* . URL restURL = new URL(url)
;這其中的url就是需要調(diào)的目標(biāo)接口地址,URL類是java.net.*下的類。
2、setRequestMethod("POST")
;請求方式是有兩個值進(jìn)行選擇,一個是GET,一個是POST,選擇對應(yīng)的請求方式
3、setDoOutput(true);setDoInput(true)
;
setDoInput(): // 設(shè)置是否向httpUrlConnection輸出,因為這個是post請求,參數(shù)要放在http正文內(nèi), 因此需要設(shè)為true, 默認(rèn)是false; setDoOutput(): // 設(shè)置是否從httpUrlConnection讀入,默認(rèn)情況下是true;
4、setAllowUserInteraction();allowUserInteraction
如果為 true,則在允許用戶交互(例如彈出一個驗證對話框)的上下文中對此 URL 進(jìn)行檢查。
5、下面代碼的query是以 屬性=值 傳輸?shù)?,若是多個則是 屬性=值&屬性=值 這種形式傳遞的,傳遞給服務(wù)器,讓服務(wù)器自己去處理。
6、close();
setRequestMethod("POST")
; ?? ???? ? ?? ?? ????. ??? GET?? ?? ??? ?? ?? ??? ?????3. >setDoOutput( true);setDoInput(true);package com.c; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.HashMap; import java.util.Map; public class RestUtil { public String load(String url,String query) throws Exception { URL restURL = new URL(url); /* * 此處的urlConnection對象實際上是根據(jù)URL的請求協(xié)議(此處是http)生成的URLConnection類 的子類 HttpURLConnection */ HttpURLConnection conn = (HttpURLConnection) restURL.openConnection(); //請求方式 conn.setRequestMethod("POST"); //設(shè)置是否從httpUrlConnection讀入,默認(rèn)情況下是true; httpUrlConnection.setDoInput(true); conn.setDoOutput(true); //allowUserInteraction 如果為 true,則在允許用戶交互(例如彈出一個驗證對話框)的上下文中對此 URL 進(jìn)行檢查。 conn.setAllowUserInteraction(false); PrintStream ps = new PrintStream(conn.getOutputStream()); ps.print(query); ps.close(); BufferedReader bReader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line,resultStr=""; while(null != (line=bReader.readLine())) { resultStr +=line; } System.out.println("3412412---"+resultStr); bReader.close(); return resultStr; } public static void main(String []args) {try { RestUtil restUtil = new RestUtil(); String resultString = restUtil.load( "http://192.168.10.89:8080/eoffice-restful/resources/sys/oaholiday", "floor=first&year=2017&month=9&isLeader=N"); } catch (Exception e) { // TODO: handle exception System.out.print(e.getMessage()); } } }4.
setAllowUserInteraction();allowUserInteraction
true? ?? ??? ?? ??(?: ??)? ???? ?????? ?????. ?? ?? ??? ???.) ? URL? ?????. 5. ?? ??? ??? "??=?" ???? ????, ??? ?? ?? ?? "??=?&??=?" ???? ???? ??? ?????. ??? ??? ????? ???. ??6.
close();
?? ?? ??? ???? ???? ??? ? ??? ???. ?????? ????: ??rrreee???? ????: ??Java ??????????? ??? Java?? ????? ?? ?? ????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

JDBC ????? ???? ????? ?? ?? ?? ??? ?? ?? ??? ?? ? ?? ??? ?? ?? ?? ??? ???????. 1. ????? ????? Conn.SetAutoCommit (False)?? ??????. 2. ??? ? ????? ?? ?? SQL ??? ?????. 3. ?? ??? ??? ?? Conn.commit ()?? ???? ??? ???? ???? ?? ??? ???? Conn.Rollback ()?? ??????. ???, ? ??? ???? ????, ??? ???? ????, ?? ??? ??? ?? ??? ??? ???? ? ???????. ?? ?? ?? ???? ????? ??? ???? ?? ?? ???? ???? ??? ????? ?? ??? ??? ? ?? ???? ?? ????.

?? ?? ? ?? ???? ???? ?? Java.Time ???? ???? ??????. 2. LocalDate, LocalDateTime ? LocalTime? ?? ?? ??? ??? ?????. 3. () ???? ???? ?? ??? ??? ????. 4. ???/???? ??? ???? ??? ????? ??? ??????. 5. ZonedDateTime ? Zoneid? ???? ???? ??????. 6. DateTimeFormatter? ?? ?? ? ?? ?? ?? ???; 7. ??? ?? ?? ?? ??? ????? ?? ??????. ?? Java? ?? ??? ???? ??? ??? ???? Java.Timeapi ??? ?? ??? ???????.

Pre-FormancetArtUptimeMoryUsage, Quarkusandmicronautleadduetocompile-timeprocessingandgraalvsupport, withquarkusoftenperforminglightbetterine serverless sinarios.2.thyvelopecosyste,

Java 's Garbage Collection (GC)? ???? ???? ???? ??????, ?? ? ??? ??? ? ??? ??? ??? ??? ????. 1.GC? ?? ?? (? : ?? ??, ?? ???, ?? ?? ?)?? ??? ???? ????, ?? ? ??? ??? ???? ?????. 2. ?? ???? ????? ????, ?? ?? ??? ??? ???? ?? ??? ??????. 3. ?? ?? ?? ?? : ??? ?? (Eden, S0, S1)? ?? ????? ?????. ??? ??? ?? ? MajorGC? ???? ? ??? ? ????. Metaspace? ??? ?? ???? ?????. 4. JVM? ??? GC ??? ?????. SerialGC? ??? ?? ????? ?????. ParallelGC? ???? ??????. CMS? ?? ???

GradleisBetTerChoiceFormostNewProjectSduetoitssuperiorflexible, Performance, and ModernToolingsupport.1.Gradle'Sgroovy/kotlindslismoreConcisENDEXPRESSIVETHANMAVEN'SVOSEXML.2.GradleOutsMaveninbuildweedweedweedweedweedweedweedweedweedweedweedweedweedweede

DEFER? ??? ???? ?? ??? ??? ???? ? ?????. ?? ??? ?? ? ? ?? ????, ??? ??? ? ?? ?? (LIFO)? ??? ?????. 1. ?? ??? ??? ? ??? ?????. 2. ?? ??? ?? ??? ??? ????? ?????. 3. ?? ? ?? ?? ??? ? ????. 4. ??? ?????? ??? ??? ???? ?????. 5. ?? ??? ???? ?? ??? ?? ??? ?????. ??? ??? ?? ?? ? ???? ???? ? ????.

??? htmlinput ??? ???? ??? ???? ????? ??? ??? ?? ??? ???? ???? ? ????. 1. ???, ???, ??, ?? ? ??? ?? ??? ??? ?? ?? ?? ??? ???? ???? ??? ? ???? ??? ? ????. 2. HTML5? ?????? ??? ? ?? ?? ??? ?? ? ??? URL, ??, ?? ? ??? ?? ??? ??? ??????. 3. ?? ?? ? ? ??? ??? ???? ?? ??? ???? ???? ?? ???? ?? ???? ???? ?? ? ? ??? ?? ???????.

GO? HTTP ?? ????? ?? ??, ??, ????? IP ? ?? ??? ?? ? ? ????. 1. http.handlerfunc? ???? ????? ????, 2. ??? ???? ?? ?? ??? ?? ??? ??????. ?? ?? ??? ???? ??? ?????? ??? ????? ???? ? ?????. ?? ???? ?? ?? ??, JSON ?? ?? ? ?? ID ??? ?????.
