當前位置: 首頁>>代碼示例>>Java>>正文


Java MultiValueMap.set方法代碼示例

本文整理匯總了Java中org.springframework.util.MultiValueMap.set方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiValueMap.set方法的具體用法?Java MultiValueMap.set怎麽用?Java MultiValueMap.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.util.MultiValueMap的用法示例。


在下文中一共展示了MultiValueMap.set方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: call

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public <P extends EasyTransRequest<R, ?>, R extends Serializable> R call(String appId, String busCode, String innerMethod, Map<String,Object> header, P params) {
	
	String context = properties.getConsumer().get(appId).getContext();
	if(context == null){
		context = "";
	}
	
	Class<? extends EasyTransRequest> paramsClass = params.getClass();
	Class<?> resultClass = ReflectUtil.getResultClass(paramsClass);
	
	
	MultiValueMap<String, String> headers = new HttpHeaders();
	headers.set(RestRibbonEasyTransConstants.HttpHeaderKey.EASYTRANS_HEADER_KEY, encodeEasyTransHeader(header));
	HttpEntity<P> requestEntity = new HttpEntity<>(params, headers);
	
	ResponseEntity<?> exchangeResult = loadBalancedRestTemplate.exchange("http://" + appId + "/" + context + "/" + busCode + "/" + innerMethod, HttpMethod.POST, requestEntity, resultClass);
	if(!exchangeResult.getStatusCode().is2xxSuccessful()){
		throw new RuntimeException("遠程請求發生錯誤:" + exchangeResult);
	}
	
	return (R) exchangeResult.getBody();
}
 
開發者ID:QNJR-GROUP,項目名稱:EasyTransaction,代碼行數:25,代碼來源:RestRibbonEasyTransRpcConsumerImpl.java

示例2: getBody

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
private MultiValueMap<String, Object> getBody() {
	MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
	body.set("grant_type", "password");
	body.set("username", "foo");
	body.set("password", "bar");
	body.set("scope", "read");
	return body;
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:9,代碼來源:OAuth2AutoConfigurationTests.java

示例3: preparePostForRegisterForm

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
/**
 * Prepare post statement for registering user, prepopulates params with
 * valid data and changes one parameter to given value
 * 
 * @param paramName
 *            name of AppUserDTO property
 * @param paramValue
 *            value of given property
 * @return RequestBuilder
 */
private RequestBuilder preparePostForRegisterForm(String paramName, String paramValue) {
	MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
	parameters.set("userName", "test1");
	parameters.set("email", "[email protected]");
	parameters.set("password", "123456");
	parameters.set("passwordVerification", "123456");

	// replace value for parameter given in arguments
	parameters.set(paramName, paramValue);

	return post("/register")//
			.params(parameters);
}
 
開發者ID:Azanx,項目名稱:Smart-Shopping,代碼行數:24,代碼來源:MvcControllerRegistrationTest.java

示例4: remoteAgentsApiDefaultUser

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
public ObjectNode remoteAgentsApiDefaultUser (	List<String> hosts, String commandUrl,
												MultiValueMap<String, String> urlVariables ) {

	urlVariables.set( SpringAuthCachingFilter.USERID, csapApp.lifeCycleSettings().getAgentUser() );
	urlVariables.set( SpringAuthCachingFilter.PASSWORD, csapApp.lifeCycleSettings().getAgentPass() );

	return remoteHttpQuery( hosts, commandUrl, urlVariables, STATELESS );
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:9,代碼來源:ServiceOsManager.java

示例5: remoteAgentsApi

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
public ObjectNode remoteAgentsApi (	String apiUser, String apiPass, List<String> hosts, String commandUrl,
									MultiValueMap<String, String> urlVariables ) {

	urlVariables.set( SpringAuthCachingFilter.USERID, apiUser );
	urlVariables.set( SpringAuthCachingFilter.PASSWORD, apiPass );

	return remoteHttpQuery( hosts, commandUrl, urlVariables, STATELESS );
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:9,代碼來源:ServiceOsManager.java

示例6: deployProgress

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
@RequestMapping ( value = { DEPLOY_PROGRESS_URL } , produces = MediaType.APPLICATION_JSON_VALUE )
@ResponseBody
public JsonNode deployProgress (
									@RequestParam ( CSAP.HOST_PARAM ) String hostName,
									@RequestParam ( CSAP.SERVICE_PORT_PARAM ) String serviceName_port,
									@RequestParam ( FileRequests.LOG_FILE_OFFSET_PARAM ) long offsetLong )
		throws IOException {

	String fromFolder = "//" + serviceName_port + "_deploy.log";
	JsonNode progress = null;

	long bufferSize = 100 * 1024;
	if ( Application.isJvmInManagerMode() ) {
		MultiValueMap<String, String> urlVariables = new LinkedMultiValueMap<String, String>();

		urlVariables.set( CSAP.SERVICE_PORT_PARAM, serviceName_port );
		urlVariables.set( FileRequests.LOG_FILE_OFFSET_PARAM, Long.toString( offsetLong ) );
		String url = CsapCoreService.SERVICE_URL + DEPLOY_PROGRESS_URL;
		List<String> hosts = new ArrayList<>();
		hosts.add( hostName );
		progress = serviceOsManager
			.remoteAgentsStateless( hosts, url, urlVariables )
			.get( hostName );

	} else {
		File targetFile = csapApp.getRequestedFile( fromFolder, serviceName_port, false );
		logger.debug( "Getting progress from: {}", targetFile.getAbsolutePath() );
		progress = fileRequests.readFileChanges( bufferSize, offsetLong, targetFile );
	}

	return progress;
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:33,代碼來源:ServiceRequests.java

示例7: shouldGenerateCallbackUrlWithParameters

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
@Test
public void shouldGenerateCallbackUrlWithParameters() {
    final MultiValueMap<String, String> some = new LinkedMultiValueMap<>();
    some.set("param1", "value1");
    some.set("param2", "value2");

    assertThat(BaseCredentialProvider.callbackUrlFor(URI.create("https://syndesis.io/api/v1/"), some))
        .as("The computed callback URL is not as expected")
        .isEqualTo("https://syndesis.io/api/v1/credentials/callback?param1=value1&param2=value2");
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:11,代碼來源:BaseCredentialProviderTest.java

示例8: getParametersForTokenRequest

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
private MultiValueMap<String, String> getParametersForTokenRequest(AuthorizationCodeResourceDetails resource, AccessTokenRequest request) {
        MultiValueMap<String, String> form = new LinkedMultiValueMap();
        String state = request.getStateKey();
//        if (state.contains("session")) {
//            form.set("appid", resource.getClientId());
//            form.set("secret", resource.getClientSecret());
//        } else {
//            form.set("appid", "wx38871ac04c8208af");
//            form.set("secret", "50f7e835165d91006bf32fb3ba8d53dd");
//        }
        form.set("appid", resource.getClientId());
        form.set("secret", resource.getClientSecret());
        form.set("code", request.getAuthorizationCode());
        form.set("grant_type", "authorization_code");
        Object preservedState = request.getPreservedState();
        //if((request.getStateKey() != null || this.stateMandatory) && preservedState == null) {
        if(false) {
            throw new InvalidRequestException("Possible CSRF detected - state parameter was required but no state could be found");
        } else {
            String redirectUri = null;
            if(preservedState instanceof String) {
                redirectUri = String.valueOf(preservedState);
            } else {
                redirectUri = resource.getRedirectUri(request);
            }

            if(redirectUri != null && !"NONE".equals(redirectUri)) {
                form.set("redirect_uri", redirectUri);
            }

            return form;
        }
    }
 
開發者ID:luotuo,項目名稱:springboot-security-wechat,代碼行數:34,代碼來源:MyAuthorizationCodeAccessTokenProvider.java

示例9: getParametersForAuthorizeRequest

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
private MultiValueMap<String, String> getParametersForAuthorizeRequest(AuthorizationCodeResourceDetails resource, AccessTokenRequest request) {
    MultiValueMap<String, String> form = new LinkedMultiValueMap();
    form.set("response_type", "code");
    form.set("client_id", resource.getClientId());
    if(request.get("scope") != null) {
        form.set("scope", request.getFirst("scope"));
    } else {
        form.set("scope", OAuth2Utils.formatParameterList(resource.getScope()));
    }

    String redirectUri = resource.getPreEstablishedRedirectUri();
    Object preservedState = request.getPreservedState();
    if(redirectUri == null && preservedState != null) {
        redirectUri = String.valueOf(preservedState);
    } else {
        redirectUri = request.getCurrentUri();
    }

    String stateKey = request.getStateKey();
    if(stateKey != null) {
        form.set("state", stateKey);
        if(preservedState == null) {
            throw new InvalidRequestException("Possible CSRF detected - state parameter was present but no state could be found");
        }
    }

    if(redirectUri != null) {
        form.set("redirect_uri", redirectUri);
    }

    return form;
}
 
開發者ID:luotuo,項目名稱:springboot-security-wechat,代碼行數:33,代碼來源:MyAuthorizationCodeAccessTokenProvider.java

示例10: restoreAsFieldDict

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
private void restoreAsFieldDict(IntensionDai.ChannelExtensionId extension, MultiValueMap<String, IntensionDai.Record> map) throws BadRequest, NotFound, Panic {
    List<IntensionDai.Record> records = intensionDai.loadLast(extension);
    for (IntensionDai.Record record : records) {
        String refSet = record.getRefSet();
        if (refSet != null) {
            ModelPublicationDai.ChannelSet set = new ModelPublicationDai.ChannelSet();
            set.setSet(refSet);
            List<ModelPublicationDai.Record> publications = modelPublicationDai.loadPublications(set);

            ModelPublicationDai.Record publication = publications.get(0);
            IntensionDai.ChannelExtensionId refExt = new IntensionDai.ChannelExtensionId();
            refExt.setBeginTime(publication.getBeginTime());
            refExt.setEndTime(record.getBeginTime());
            refExt.setId(publication.getExtId());

            MultiValueMap<String, IntensionDai.Record> subMap = restoreAsIntensionDict(refExt);
            for (String key : subMap.keySet()) {
                List<IntensionDai.Record> subRecords = subMap.get(key);
                for (IntensionDai.Record subRecord : subRecords) {
                    map.add(record.getField(), subRecord);
                }
            }
        } else {
            map.set(record.getField(), record);
        }
    }
}
 
開發者ID:SINeWang,項目名稱:kiimate,代碼行數:28,代碼來源:DefaultModelRestoreFui.java

示例11: sendIssues

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
public ResponseEntity<List> sendIssues(List<IssueDTO> issues) {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.set("collectorId", collectorId);

    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(mirrorGateUrl + MIRROR_GATE_SEND_ISSUES_ENDPOINT).queryParams(params);

    return restTemplate.postForEntity(builder.build().toUriString(), issues, List.class);
}
 
開發者ID:BBVA,項目名稱:mirrorgate-jira-stories-collector,代碼行數:9,代碼來源:SprintService.java

示例12: deleteIssue

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
public void deleteIssue(Long issueId) {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.set("collectorId", collectorId);

    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(mirrorGateUrl + MIRROR_GATE_HANDLE_ISSUE_ENDPOINT).queryParams(params);

    restTemplate.delete(builder.build().toUriString(), issueId);
}
 
開發者ID:BBVA,項目名稱:mirrorgate-jira-stories-collector,代碼行數:9,代碼來源:SprintService.java

示例13: getSprintSamples

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
public List<SprintDTO> getSprintSamples() {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.set("collectorId", collectorId);

    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(mirrorGateUrl + MIRROR_GATE_GET_SPRINT_SAMPLE_ENDPOINT).queryParams(params);

    return Arrays.asList(restTemplate.getForObject(builder.build().toUriString(), SprintDTO[].class));
}
 
開發者ID:BBVA,項目名稱:mirrorgate-jira-stories-collector,代碼行數:9,代碼來源:SprintService.java

示例14: getSprint

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
public SprintDTO getSprint(String name) {
    try{
        MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
        params.set("collectorId", collectorId);

        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(mirrorGateUrl + MIRROR_GATE_GET_SPRINT_ISSUES_ENDPOINT).queryParams(params);

        return restTemplate.getForObject(builder.build().toUriString(), SprintDTO.class, name);
    }catch(Exception e){
        LOGGER.warn("Error getting sprint {}", name, e);
        return null;
    }
}
 
開發者ID:BBVA,項目名稱:mirrorgate-jira-stories-collector,代碼行數:14,代碼來源:SprintService.java

示例15: buildUri

import org.springframework.util.MultiValueMap; //導入方法依賴的package包/類
protected URI buildUri(String path, String parameterName, String parameterValue) {
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
    parameters.set(parameterName, parameterValue);
    return buildUri(path, parameters);
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:6,代碼來源:AbstractTwitterOperations.java


注:本文中的org.springframework.util.MultiValueMap.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。