本文整理匯總了Java中org.springframework.web.util.UriComponentsBuilder.replaceQueryParam方法的典型用法代碼示例。如果您正苦於以下問題:Java UriComponentsBuilder.replaceQueryParam方法的具體用法?Java UriComponentsBuilder.replaceQueryParam怎麽用?Java UriComponentsBuilder.replaceQueryParam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.web.util.UriComponentsBuilder
的用法示例。
在下文中一共展示了UriComponentsBuilder.replaceQueryParam方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildHttpRequestEntity
import org.springframework.web.util.UriComponentsBuilder; //導入方法依賴的package包/類
private RequestEntity buildHttpRequestEntity(WxApiMethodInfo wxApiMethodInfo, Object[] args) {
UriComponentsBuilder builder = wxApiMethodInfo.fromArgs(args);
// 替換accessToken
builder.replaceQueryParam(WX_ACCESS_TOKEN_PARAM_NAME, wxAccessTokenManager.getToken());
HttpHeaders httpHeaders = null;
Object body = null;
if (wxApiMethodInfo.getRequestMethod() == WxApiRequest.Method.JSON) {
httpHeaders = buildJsonHeaders();
// body = getStringBody(wxApiMethodInfo, args);
body = getObjectBody(wxApiMethodInfo, args);
} else if (wxApiMethodInfo.getRequestMethod() == WxApiRequest.Method.XML) {
httpHeaders = buildXmlHeaders();
// 暫時不支持xml轉換。。。
body = getObjectBody(wxApiMethodInfo, args);
} else if (wxApiMethodInfo.getRequestMethod() == WxApiRequest.Method.FORM) {
body = getFormBody(wxApiMethodInfo, args);
}
return new RequestEntity(body, httpHeaders, wxApiMethodInfo.getRequestMethod().getHttpMethod(), builder.build().toUri());
}