我编写了简单的REST Web服务客户端类,它使用JAX-RS 2.0客户端API来发出REST请求.我试图弄清楚如何为每次调用设置请求超时.以下是请求的代码:
Client client = ClientBuilder.newBuilder().build();
WebTarget resourceTarget = client.target(restServiceUrl)
.path("{regsysID}/{appointmentID}/")
.resolveTemplate("regsysID", regSysId)
.resolveTemplate("appointmentID", apptId);
Invocation invocation = resourceTarget.request(MediaType.APPLICATION_JSON).buildPut(null);
String createSessionJson = invocation.invoke(String.class);
Run Code Online (Sandbox Code Playgroud) 我注意到Google通过网址接受任何语言的音译和IME请求:
https://inputtools.google.com/request?text=$&itc=$&num=$\
&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test
Run Code Online (Sandbox Code Playgroud)
$对于任何语言和文本,where 是下面的变量.
例如,法语(试一试):
var text = "ca me plait",
itc = "fr-t-i0-und",
num = 10;
// Result:
[
"SUCCESS",
[
[
"ca me plait",
[
"ça me plaît"
]
]
]
]
Run Code Online (Sandbox Code Playgroud)
或者,普通话(试试):
var text = "shide",
itc = "zh-t-i0-pinyin",
num = 5;
// Result:
[
"SUCCESS",
[
[
"shide",
[
"??",
"??",
"??",
"??",
"??"
],
[],
{
"annotation": [
"shi de",
"shi de",
"shi de",
"shi de",
"shi de"
] …Run Code Online (Sandbox Code Playgroud)