当前位置: 首页>>代码示例>>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;未经允许,请勿转载。