
变化后的情况是: 写出下面这个答案以来, 已然差不多过去5年时间了就在今日, 我持有不一样的看法。1. 当99%的人提及REST这个术语时。2. 他们实际所指的确实是HTTP。3. 然而, 他们或许并不怎么在意“资源”。4. 也不在意“表示”。5. 同样不在意“状态转移”。6. 更不在意“统一接口”。7. 甚至对于确定的REST架构风格的任何其他约束或方面也不关心。8. 所以, 各种REST框架所提供的抽象乃是令人困惑且无益的。所以, 你打算在二零一五年运用Java去发送HTTP请求, 你期望有一个清晰的、富有表现力的、直观的、惯用的、简单的API, 用什么呢? 我已不再使用Java, 不过在过去几年当中, 似乎最具前途且最为有趣的Java HTTP客户端库是, 瞧瞧这个。您能够借助运用或者针对HTTP请求予以编码的方式, 来同Web服务开展交互行为。然而, 一般而言, 会更倾向于运用库或者框架, 它们可提供专门针对此目的所设计的,更为简易且更具语义性的API, 这会让代码处在撰写、读取以及调试方面变得更加容易, 并且还减少了重复性工作, 这些框架通常会实现一些相当不错的功能, 这些功能在低级库当中未必会存在或者易于使用, 比如内容的协商、缓存以及身份验证。一些最成熟的选项是,和.对于我最为熟识的那个和, 咱们来瞧瞧怎么运用这两个API去发出POST请求, 该怎么做呢。泽西示例Form form new Form(); form.add(x, foo); form.add(y, bar); Client client ClientBuilder.newClient(); WebTarget resource client.target(http://localhost:8080/someresource); Builder request resource.request(); request.accept(MediaType.APPLICATION_JSON); Response response request.get(); if (response.getStatusInfo().getFamily() Family.SUCCESSFUL) { System.out.println(Success! response.getStatus()); System.out.println(response.getEntity()); } else { System.out.println(ERROR! response.getStatus()); System.out.println(response.getEntity()); }Run Code ( Code )示例Form form new Form(); form.add(x, foo); form.add(y, bar); ClientResource resource new ClientResource(http://localhost:8080/someresource); Response response resource.post(form.getWebRepresentation()); if (response.getStatus().isSuccess()) { System.out.println(Success! response.getStatus()); System.out.println(response.getEntity().getText()); } else { System.out.println(ERROR! response.getStatus()); System.out.println(response.getEntity().getText()); }Run Code ( Code )当然, GET请求更为简单, 你能够指定实体标签以及标题这类事物, 不望这些例子极具效用, 然而并非过度复杂。您所见到的这般, 有着类似模样的客户端应用程序编程接口。我坚信它们是于同一个时间段内发展进步起来的, 所以彼此之间产生了相互影响的状况。我发现 API更具语义性,因此更清晰,但YMMV.如同我讲过的, 我最为熟悉, 我于诸多应用程序里用它多年了, 我对它极为满意。它是一个相当成熟、强大、简单、有效、活跃且获良好支持的框架。我不能和或交谈, 不过我的印象是它们皆是不错的选择。WWw.m.Mbma.cN/Article/details/07070.shtmlWWw.m.Mbma.cN/Article/details/10112.shtmlWWw.m.Mbma.cN/Article/details/66186.shtmlWWw.m.Mbma.cN/Article/details/36764.shtmlWWw.m.Mbma.cN/Article/details/06714.shtmlWWw.m.Mbma.cN/Article/details/11555.shtmlWWw.m.Mbma.cN/Article/details/02428.shtmlWWw.m.Mbma.cN/Article/details/64200.shtmlWWw.m.Mbma.cN/Article/details/62117.shtmlWWw.m.Mbma.cN/Article/details/40868.shtmlWWw.m.Mbma.cN/Article/details/93911.shtmlWWw.m.Mbma.cN/Article/details/04180.shtmlWWw.m.Mbma.cN/Article/details/72347.shtmlWWw.m.Mbma.cN/Article/details/22052.shtmlWWw.m.Mbma.cN/Article/details/57248.shtmlWWw.m.Mbma.cN/Article/details/23229.shtmlWWw.m.Mbma.cN/Article/details/30759.shtmlWWw.m.Mbma.cN/Article/details/39070.shtmlWWw.m.Mbma.cN/Article/details/48649.shtmlWWw.m.Mbma.cN/Article/details/86808.shtmlWWw.m.Mbma.cN/Article/details/48912.shtmlWWw.m.Mbma.cN/Article/details/38767.shtmlWWw.m.Mbma.cN/Article/details/85880.shtmlWWw.m.Mbma.cN/Article/details/95695.shtmlWWw.m.Mbma.cN/Article/details/07148.shtmlWWw.m.Mbma.cN/Article/details/79129.shtmlWWw.m.Mbma.cN/Article/details/63623.shtmlWWw.m.Mbma.cN/Article/details/48398.shtmlWWw.m.Mbma.cN/Article/details/91348.shtmlWWw.m.Mbma.cN/Article/details/48558.shtmlWWw.m.Mbma.cN/Article/details/69726.shtmlWWw.m.Mbma.cN/Article/details/57916.shtmlWWw.m.Mbma.cN/Article/details/20559.shtmlWWw.m.Mbma.cN/Article/details/18260.shtmlWWw.m.Mbma.cN/Article/details/12598.shtmlWWw.m.Mbma.cN/Article/details/97485.shtmlWWw.m.Mbma.cN/Article/details/67672.shtmlWWw.m.Mbma.cN/Article/details/41146.shtmlWWw.m.Mbma.cN/Article/details/30528.shtmlWWw.m.Mbma.cN/Article/details/39148.shtmlWWw.m.Mbma.cN/Article/details/36822.shtmlWWw.m.Mbma.cN/Article/details/51119.shtmlWWw.m.Mbma.cN/Article/details/53333.shtmlWWw.m.Mbma.cN/Article/details/31493.shtmlWWw.m.Mbma.cN/Article/details/57387.shtmlWWw.m.Mbma.cN/Article/details/12152.shtmlWWw.m.Mbma.cN/Article/details/91360.shtmlWWw.m.Mbma.cN/Article/details/96663.shtmlWWw.m.Mbma.cN/Article/details/04367.shtmlWWw.m.Mbma.cN/Article/details/23562.shtmlWWw.m.Mbma.cN/Article/details/42119.shtmlWWw.m.Mbma.cN/Article/details/70855.shtmlWWw.m.Mbma.cN/Article/details/12140.shtmlWWw.m.Mbma.cN/Article/details/34472.shtmlWWw.m.Mbma.cN/Article/details/76608.shtmlWWw.m.Mbma.cN/Article/details/28487.shtmlWWw.m.Mbma.cN/Article/details/02171.shtmlWWw.m.Mbma.cN/Article/details/88895.shtmlWWw.m.Mbma.cN/Article/details/91585.shtmlWWw.m.Mbma.cN/Article/details/41289.shtmlWWw.m.Mbma.cN/Article/details/38801.shtmlWWw.m.Mbma.cN/Article/details/86642.shtmlWWw.m.Mbma.cN/Article/details/32059.shtmlWWw.m.Mbma.cN/Article/details/70453.shtmlWWw.m.Mbma.cN/Article/details/26234.shtmlWWw.m.Mbma.cN/Article/details/26691.shtmlWWw.m.Mbma.cN/Article/details/80728.shtmlWWw.m.Mbma.cN/Article/details/36318.shtmlWWw.m.Mbma.cN/Article/details/10079.shtmlWWw.m.Mbma.cN/Article/details/52406.shtmlWWw.m.Mbma.cN/Article/details/85625.shtmlWWw.m.Mbma.cN/Article/details/72450.shtmlWWw.m.Mbma.cN/Article/details/62669.shtmlWWw.m.Mbma.cN/Article/details/10474.shtmlWWw.m.Mbma.cN/Article/details/72550.shtmlWWw.m.Mbma.cN/Article/details/27402.shtmlWWw.m.Mbma.cN/Article/details/39323.shtmlWWw.m.Mbma.cN/Article/details/35120.shtmlWWw.m.Mbma.cN/Article/details/50624.shtmlWWw.m.Mbma.cN/Article/details/44952.shtmlWWw.m.Mbma.cN/Article/details/69325.shtmlWWw.m.Mbma.cN/Article/details/01337.shtmlWWw.m.Mbma.cN/Article/details/60930.shtmlWWw.m.Mbma.cN/Article/details/35449.shtmlWWw.m.Mbma.cN/Article/details/25292.shtmlWWw.m.Mbma.cN/Article/details/30551.shtmlWWw.m.Mbma.cN/Article/details/86838.shtmlWWw.m.Mbma.cN/Article/details/12193.shtmlWWw.m.Mbma.cN/Article/details/02208.shtmlWWw.m.Mbma.cN/Article/details/37943.shtmlWWw.m.Mbma.cN/Article/details/18238.shtmlWWw.m.Mbma.cN/Article/details/48651.shtmlWWw.m.Mbma.cN/Article/details/19092.shtmlWWw.m.Mbma.cN/Article/details/27274.shtmlWWw.m.Mbma.cN/Article/details/60394.shtmlWWw.m.Mbma.cN/Article/details/62444.shtmlWWw.m.Mbma.cN/Article/details/14581.shtmlWWw.m.Mbma.cN/Article/details/15217.shtmlWWw.m.Mbma.cN/Article/details/41408.shtmlWWw.m.Mbma.cN/Article/details/48592.shtmlWWw.m.Mbma.cN/Article/details/08201.shtmlWWw.m.Mbma.cN/Article/details/19905.shtmlWWw.m.Mbma.cN/Article/details/20549.shtmlWWw.m.Mbma.cN/Article/details/22822.shtmlWWw.m.Mbma.cN/Article/details/12708.shtmlWWw.m.Mbma.cN/Article/details/80008.shtmlWWw.m.Mbma.cN/Article/details/45127.shtmlWWw.m.Mbma.cN/Article/details/10424.shtmlWWw.m.Mbma.cN/Article/details/49886.shtmlWWw.m.Mbma.cN/Article/details/59863.shtmlWWw.m.Mbma.cN/Article/details/80577.shtmlWWw.m.Mbma.cN/Article/details/36094.shtmlWWw.m.Mbma.cN/Article/details/28648.shtmlWWw.m.Mbma.cN/Article/details/27202.shtmlWWw.m.Mbma.cN/Article/details/56399.shtmlWWw.m.Mbma.cN/Article/details/65872.shtmlWWw.m.Mbma.cN/Article/details/17041.shtmlWWw.m.Mbma.cN/Article/details/96603.shtmlWWw.m.Mbma.cN/Article/details/55585.shtmlWWw.m.Mbma.cN/Article/details/30408.shtmlWWw.m.Mbma.cN/Article/details/31900.shtmlWWw.m.Mbma.cN/Article/details/57545.shtmlWWw.m.Mbma.cN/Article/details/64278.shtmlWWw.m.Mbma.cN/Article/details/33601.shtmlWWw.m.Mbma.cN/Article/details/99564.shtmlWWw.m.Mbma.cN/Article/details/66961.shtmlWWw.m.Mbma.cN/Article/details/19110.shtmlWWw.m.Mbma.cN/Article/details/69320.shtmlWWw.m.Mbma.cN/Article/details/74482.shtmlWWw.m.Mbma.cN/Article/details/79849.shtmlWWw.m.Mbma.cN/Article/details/01922.shtmlWWw.m.Mbma.cN/Article/details/08181.shtmlWWw.m.Mbma.cN/Article/details/72823.shtmlWWw.m.Mbma.cN/Article/details/08478.shtmlWWw.m.Mbma.cN/Article/details/19366.shtmlWWw.m.Mbma.cN/Article/details/64671.shtmlWWw.m.Mbma.cN/Article/details/84567.shtmlWWw.m.Mbma.cN/Article/details/78000.shtmlWWw.m.Mbma.cN/Article/details/84190.shtmlWWw.m.Mbma.cN/Article/details/19748.shtmlWWw.m.Mbma.cN/Article/details/71636.shtmlWWw.m.Mbma.cN/Article/details/85393.shtmlWWw.m.Mbma.cN/Article/details/96190.shtmlWWw.m.Mbma.cN/Article/details/62513.shtmlWWw.m.Mbma.cN/Article/details/99984.shtmlWWw.m.Mbma.cN/Article/details/64001.shtmlWWw.m.Mbma.cN/Article/details/96810.shtmlWWw.m.Mbma.cN/Article/details/52892.shtmlWWw.m.Mbma.cN/Article/details/72779.shtmlWWw.m.Mbma.cN/Article/details/42817.shtmlWWw.m.Mbma.cN/Article/details/09516.shtmlWWw.m.Mbma.cN/Article/details/66190.shtmlWWw.m.Mbma.cN/Article/details/15064.shtmlWWw.m.Mbma.cN/Article/details/40639.shtmlWWw.m.Mbma.cN/Article/details/49489.shtmlWWw.m.Mbma.cN/Article/details/18106.shtmlWWw.m.Mbma.cN/Article/details/13448.shtmlWWw.m.Mbma.cN/Article/details/82345.shtmlWWw.m.Mbma.cN/Article/details/59019.shtmlWWw.m.Mbma.cN/Article/details/21505.shtmlWWw.m.Mbma.cN/Article/details/32036.shtmlWWw.m.Mbma.cN/Article/details/97795.shtmlWWw.m.Mbma.cN/Article/details/76823.shtmlWWw.m.Mbma.cN/Article/details/39573.shtmlWWw.m.Mbma.cN/Article/details/64041.shtmlWWw.m.Mbma.cN/Article/details/40840.shtmlWWw.m.Mbma.cN/Article/details/71815.shtmlWWw.m.Mbma.cN/Article/details/38100.shtmlWWw.m.Mbma.cN/Article/details/78052.shtmlWWw.m.Mbma.cN/Article/details/87673.shtmlWWw.m.Mbma.cN/Article/details/42566.shtmlWWw.m.Mbma.cN/Article/details/74224.shtmlWWw.m.Mbma.cN/Article/details/76587.shtmlWWw.m.Mbma.cN/Article/details/79710.shtmlWWw.m.Mbma.cN/Article/details/12217.shtmlWWw.m.Mbma.cN/Article/details/42884.shtmlWWw.m.Mbma.cN/Article/details/14250.shtmlWWw.m.Mbma.cN/Article/details/41453.shtmlWWw.m.Mbma.cN/Article/details/47528.shtmlWWw.m.Mbma.cN/Article/details/61571.shtmlWWw.m.Mbma.cN/Article/details/74593.shtmlWWw.m.Mbma.cN/Article/details/49094.shtmlWWw.m.Mbma.cN/Article/details/78054.shtmlWWw.m.Mbma.cN/Article/details/14921.shtmlWWw.m.Mbma.cN/Article/details/16664.shtmlWWw.m.Mbma.cN/Article/details/29552.shtmlWWw.m.Mbma.cN/Article/details/05560.shtmlWWw.m.Mbma.cN/Article/details/54100.shtmlWWw.m.Mbma.cN/Article/details/31220.shtmlWWw.m.Mbma.cN/Article/details/35339.shtmlWWw.m.Mbma.cN/Article/details/11834.shtmlWWw.m.Mbma.cN/Article/details/08050.shtmlWWw.m.Mbma.cN/Article/details/08425.shtmlWWw.m.Mbma.cN/Article/details/70467.shtmlWWw.m.Mbma.cN/Article/details/25061.shtmlWWw.m.Mbma.cN/Article/details/69211.shtmlWWw.m.Mbma.cN/Article/details/81093.shtmlWWw.m.Mbma.cN/Article/details/38026.shtmlWWw.m.Mbma.cN/Article/details/38945.shtmlWWw.m.Mbma.cN/Article/details/61897.shtmlWWw.m.Mbma.cN/Article/details/78523.shtmlWWw.m.Mbma.cN/Article/details/07058.shtmlWWw.m.Mbma.cN/Article/details/72015.shtmlWWw.m.Mbma.cN/Article/details/54785.shtmlWWw.m.Mbma.cN/Article/details/81326.shtmlWWw.m.Mbma.cN/Article/details/97215.shtmlWWw.m.Mbma.cN/Article/details/91335.shtmlWWw.m.Mbma.cN/Article/details/41845.shtmlWWw.m.Mbma.cN/Article/details/99908.shtmlWWw.m.Mbma.cN/Article/details/33508.shtmlWWw.m.Mbma.cN/Article/details/10853.shtmlWWw.m.Mbma.cN/Article/details/80561.shtmlWWw.m.Mbma.cN/Article/details/29532.shtmlWWw.m.Mbma.cN/Article/details/17155.shtmlWWw.m.Mbma.cN/Article/details/56783.shtmlWWw.m.Mbma.cN/Article/details/60747.shtmlWWw.m.Mbma.cN/Article/details/00490.shtmlWWw.m.Mbma.cN/Article/details/25147.shtmlWWw.m.Mbma.cN/Article/details/22468.shtmlWWw.m.Mbma.cN/Article/details/15348.shtmlWWw.m.Mbma.cN/Article/details/25993.shtmlWWw.m.Mbma.cN/Article/details/20841.shtmlWWw.m.Mbma.cN/Article/details/73153.shtmlWWw.m.Mbma.cN/Article/details/25198.shtmlWWw.m.Mbma.cN/Article/details/82991.shtmlWWw.m.Mbma.cN/Article/details/37426.shtmlWWw.m.Mbma.cN/Article/details/38953.shtmlWWw.m.Mbma.cN/Article/details/92405.shtmlWWw.m.Mbma.cN/Article/details/27020.shtmlWWw.m.Mbma.cN/Article/details/55281.shtmlWWw.m.Mbma.cN/Article/details/82814.shtmlWWw.m.Mbma.cN/Article/details/88789.shtmlWWw.m.Mbma.cN/Article/details/29082.shtmlWWw.m.Mbma.cN/Article/details/52279.shtmlWWw.m.Mbma.cN/Article/details/44821.shtmlWWw.m.Mbma.cN/Article/details/16984.shtmlWWw.m.Mbma.cN/Article/details/32293.shtmlWWw.m.Mbma.cN/Article/details/41234.shtmlWWw.m.Mbma.cN/Article/details/80219.shtmlWWw.m.Mbma.cN/Article/details/21616.shtmlWWw.m.Mbma.cN/Article/details/52752.shtmlWWw.m.Mbma.cN/Article/details/32359.shtmlWWw.m.Mbma.cN/Article/details/30967.shtmlWWw.m.Mbma.cN/Article/details/60218.shtmlWWw.m.Mbma.cN/Article/details/96802.shtmlWWw.m.Mbma.cN/Article/details/67620.shtmlWWw.m.Mbma.cN/Article/details/73716.shtmlWWw.m.Mbma.cN/Article/details/01087.shtmlWWw.m.Mbma.cN/Article/details/19046.shtmlWWw.m.Mbma.cN/Article/details/75097.shtmlWWw.m.Mbma.cN/Article/details/28877.shtmlWWw.m.Mbma.cN/Article/details/77298.shtmlWWw.m.Mbma.cN/Article/details/35669.shtmlWWw.m.Mbma.cN/Article/details/44091.shtmlWWw.m.Mbma.cN/Article/details/44243.shtmlWWw.m.Mbma.cN/Article/details/21801.shtmlWWw.m.Mbma.cN/Article/details/29157.shtmlWWw.m.Mbma.cN/Article/details/39514.shtmlWWw.m.Mbma.cN/Article/details/33348.shtmlWWw.m.Mbma.cN/Article/details/87291.shtmlWWw.m.Mbma.cN/Article/details/68092.shtmlWWw.m.Mbma.cN/Article/details/99680.shtmlWWw.m.Mbma.cN/Article/details/90287.shtmlWWw.m.Mbma.cN/Article/details/58766.shtmlWWw.m.Mbma.cN/Article/details/34332.shtmlWWw.m.Mbma.cN/Article/details/31881.shtmlWWw.m.Mbma.cN/Article/details/86211.shtmlWWw.m.Mbma.cN/Article/details/14690.shtmlWWw.m.Mbma.cN/Article/details/75813.shtmlWWw.m.Mbma.cN/Article/details/13215.shtmlWWw.m.Mbma.cN/Article/details/21838.shtmlWWw.m.Mbma.cN/Article/details/93316.shtmlWWw.m.Mbma.cN/Article/details/36736.shtmlWWw.m.Mbma.cN/Article/details/91643.shtmlWWw.m.Mbma.cN/Article/details/25434.shtmlWWw.m.Mbma.cN/Article/details/30717.shtmlWWw.m.Mbma.cN/Article/details/85118.shtmlWWw.m.Mbma.cN/Article/details/45774.shtmlWWw.m.Mbma.cN/Article/details/51081.shtmlWWw.m.Mbma.cN/Article/details/07598.shtmlWWw.m.Mbma.cN/Article/details/61823.shtmlWWw.m.Mbma.cN/Article/details/28720.shtmlWWw.m.Mbma.cN/Article/details/38218.shtmlWWw.m.Mbma.cN/Article/details/72314.shtmlWWw.m.Mbma.cN/Article/details/08624.shtmlWWw.m.Mbma.cN/Article/details/13276.shtmlWWw.m.Mbma.cN/Article/details/11086.shtmlWWw.m.Mbma.cN/Article/details/31831.shtmlWWw.m.Mbma.cN/Article/details/39364.shtmlWWw.m.Mbma.cN/Article/details/40361.shtmlWWw.m.Mbma.cN/Article/details/44836.shtmlWWw.m.Mbma.cN/Article/details/46960.shtmlWWw.m.Mbma.cN/Article/details/57633.shtmlWWw.m.Mbma.cN/Article/details/13935.shtmlWWw.m.Mbma.cN/Article/details/16880.shtmlWWw.m.Mbma.cN/Article/details/47000.shtmlWWw.m.Mbma.cN/Article/details/49506.shtmlWWw.m.Mbma.cN/Article/details/89659.shtmlWWw.m.Mbma.cN/Article/details/91367.shtmlWWw.m.Mbma.cN/Article/details/41024.shtmlWWw.m.Mbma.cN/Article/details/04711.shtmlWWw.m.Mbma.cN/Article/details/85299.shtmlWWw.m.Mbma.cN/Article/details/05375.shtmlWWw.m.Mbma.cN/Article/details/90295.shtmlWWw.m.Mbma.cN/Article/details/92989.shtmlWWw.m.Mbma.cN/Article/details/70728.shtmlWWw.m.Mbma.cN/Article/details/07714.shtmlWWw.m.Mbma.cN/Article/details/10774.shtmlWWw.m.Mbma.cN/Article/details/00250.shtmlWWw.m.Mbma.cN/Article/details/68411.shtmlWWw.m.Mbma.cN/Article/details/11237.shtmlWWw.m.Mbma.cN/Article/details/79822.shtmlWWw.m.Mbma.cN/Article/details/91067.shtmlWWw.m.Mbma.cN/Article/details/50579.shtmlWWw.m.Mbma.cN/Article/details/45956.shtmlWWw.m.Mbma.cN/Article/details/26107.shtmlWWw.m.Mbma.cN/Article/details/71942.shtmlWWw.m.Mbma.cN/Article/details/91686.shtmlWWw.m.Mbma.cN/Article/details/57791.shtmlWWw.m.Mbma.cN/Article/details/67488.shtmlWWw.m.Mbma.cN/Article/details/93409.shtmlWWw.m.Mbma.cN/Article/details/22657.shtmlWWw.m.Mbma.cN/Article/details/42773.shtmlWWw.m.Mbma.cN/Article/details/62360.shtmlWWw.m.Mbma.cN/Article/details/34591.shtmlWWw.m.Mbma.cN/Article/details/49530.shtmlWWw.m.Mbma.cN/Article/details/19187.shtmlWWw.m.Mbma.cN/Article/details/76840.shtmlWWw.m.Mbma.cN/Article/details/63199.shtmlWWw.m.Mbma.cN/Article/details/16269.shtmlWWw.m.Mbma.cN/Article/details/78798.shtmlWWw.m.Mbma.cN/Article/details/40350.shtmlWWw.m.Mbma.cN/Article/details/26798.shtmlWWw.m.Mbma.cN/Article/details/40854.shtmlWWw.m.Mbma.cN/Article/details/13107.shtmlWWw.m.Mbma.cN/Article/details/96374.shtmlWWw.m.Mbma.cN/Article/details/19557.shtmlWWw.m.Mbma.cN/Article/details/62530.shtmlWWw.m.Mbma.cN/Article/details/73077.shtmlWWw.m.Mbma.cN/Article/details/07599.shtmlWWw.m.Mbma.cN/Article/details/95290.shtmlWWw.m.Mbma.cN/Article/details/90214.shtmlWWw.m.Mbma.cN/Article/details/11983.shtmlWWw.m.Mbma.cN/Article/details/66710.shtmlWWw.m.Mbma.cN/Article/details/55321.shtml