org.springframework.util.MultiValueMap Java Examples

The following examples show how to use org.springframework.util.MultiValueMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File:    From mojito with Apache License 2.0 7 votes vote down vote up
Channel openIm(User user) throws SlackClientException {

    MultiValueMap<String, Object> payload = getBasePayloadMapWithAuthToken();
    payload.add("user", user.getId());
    payload.add("return_im", "true");

    HttpEntity<MultiValueMap<String, Object>> httpEntity = getHttpEntityForPayload(payload);

    ImOpenResponse imOpenResponse = restTemplate.postForObject(getUrl(API_IM_OPEN), httpEntity, ImOpenResponse.class);

    if (!imOpenResponse.getOk()) {
        String msg = MessageFormat.format("Cannot open instant message: {0}", imOpenResponse.getError());
        throw new SlackClientException(msg);

    return imOpenResponse.getChannel();
Example #2
Source File:    From springcloud-idempotent-starter with GNU General Public License v3.0 7 votes vote down vote up
public void execDifferentCall() {
	String requestId1 = "execDiffrentCall_:"+UUID.randomUUID();
	String requestId2 = "execDiffrentCall_:"+UUID.randomUUID();

	MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
	headers.add(Constants.REQ_IDEM_ID, requestId1);
	headers.add("Content-Type", "application/json");
	HttpEntity requests = new HttpEntity(headers);
	ResponseEntity<String> response =, HttpMethod.GET, requests,
	String reponse1 = response.getBody();
	MultiValueMap<String, String> headers2 = new LinkedMultiValueMap<String, String>();
	headers.add(Constants.REQ_IDEM_ID, requestId2);
	headers.add("Content-Type", "application/json");
	HttpEntity requests2 = new HttpEntity(headers2);
	ResponseEntity<String> response2 =, HttpMethod.GET, requests2,
	String reponse2 = response2.getBody();
	System.out.println(reponse1 + "\n" + reponse2);
	Assert.assertNotEquals("The different result", reponse1, reponse2);
Example #3
Source File:    From spring-analysis-note with MIT License 6 votes vote down vote up
public void multipartFileResource() throws IOException {
	String name = "file";
	String disposition = "form-data; name=\"" + name + "\"; filename=\"myFile.txt\"";
	StandardMultipartHttpServletRequest request = requestWithPart(name, disposition, "myBody");
	MultipartFile multipartFile = request.getFile(name);


	MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
	map.add(name, multipartFile.getResource());

	MockHttpOutputMessage output = new MockHttpOutputMessage();
	new FormHttpMessageConverter().write(map, null, output);

	assertThat(output.getBodyAsString(StandardCharsets.UTF_8), containsString(
			"Content-Disposition: form-data; name=\"file\"; filename=\"myFile.txt\"\r\n" +
					"Content-Type: text/plain\r\n" +
					"Content-Length: 6\r\n" +
					"\r\n" +
Example #4
Source File:    From tutorials with MIT License 6 votes vote down vote up
public void givenFooService_whenFormSubmit_thenResourceIsCreated() {
    HttpHeaders headers = new HttpHeaders();

    MultiValueMap<String, String> map= new LinkedMultiValueMap<>();
    map.add("id", "1");

    HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);

    ResponseEntity<String> response = restTemplate.postForEntity( fooResourceUrl+"/form", request , String.class);

    assertThat(response.getStatusCode(), is(HttpStatus.CREATED));
    final String fooResponse = response.getBody();
    assertThat(fooResponse, notNullValue());
    assertThat(fooResponse, is("1"));
Example #5
Source File:    From java-technology-stack with MIT License 6 votes vote down vote up
public void createWithConnectNativeHeaders() {
	MultiValueMap<String, String> extHeaders = new LinkedMultiValueMap<>();
	extHeaders.add(StompHeaderAccessor.STOMP_LOGIN_HEADER, "joe");
	extHeaders.add(StompHeaderAccessor.STOMP_PASSCODE_HEADER, "joe123");

	StompHeaderAccessor headerAccessor = StompHeaderAccessor.create(StompCommand.CONNECT, extHeaders);

	assertEquals(StompCommand.CONNECT, headerAccessor.getCommand());
	assertEquals(SimpMessageType.CONNECT, headerAccessor.getMessageType());
	assertEquals("joe", headerAccessor.getLogin());
	assertEquals("joe123", headerAccessor.getPasscode());
	assertThat(headerAccessor.toString(), CoreMatchers.containsString("passcode=[PROTECTED]"));

	Map<String, List<String>> output = headerAccessor.toNativeHeaderMap();
	assertEquals("joe", output.get(StompHeaderAccessor.STOMP_LOGIN_HEADER).get(0));
	assertEquals("PROTECTED", output.get(StompHeaderAccessor.STOMP_PASSCODE_HEADER).get(0));
Example #6
Source File:    From OAuth-2.0-Cookbook with MIT License 6 votes vote down vote up
public Map<String, String> getUserInfoFor(OAuth2AccessToken accessToken) {
    RestTemplate restTemplate = new RestTemplate();

    RequestEntity<MultiValueMap<String, String>> requestEntity = new RequestEntity<>(

    ResponseEntity<Map> result =
            requestEntity, Map.class);

    if (result.getStatusCode().is2xxSuccessful()) {
        return result.getBody();

    throw new RuntimeException("It wasn't possible to retrieve userInfo");
Example #7
Source File:    From lams with GNU General Public License v2.0 6 votes vote down vote up
 * Encode all URI components using their specific encoding rules and return
 * the result as a new {@code UriComponents} instance.
 * @param encoding the encoding of the values
 * @return the encoded uri components
 * @throws UnsupportedEncodingException if the given encoding is not supported
public HierarchicalUriComponents encode(String encoding) throws UnsupportedEncodingException {
	if (this.encoded) {
		return this;
	Assert.hasLength(encoding, "Encoding must not be empty");
	String schemeTo = encodeUriComponent(getScheme(), encoding, Type.SCHEME);
	String userInfoTo = encodeUriComponent(this.userInfo, encoding, Type.USER_INFO);
	String hostTo = encodeUriComponent(, encoding, getHostType());
	PathComponent pathTo = this.path.encode(encoding);
	MultiValueMap<String, String> paramsTo = encodeQueryParams(encoding);
	String fragmentTo = encodeUriComponent(getFragment(), encoding, Type.FRAGMENT);
	return new HierarchicalUriComponents(schemeTo, userInfoTo, hostTo, this.port,
			pathTo, paramsTo, fragmentTo, true, false);
Example #8
Source File:    From taskana with Apache License 2.0 6 votes vote down vote up
@GetMapping(path = Mapping.URL_WORKBASKET)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> getWorkbaskets(
    @RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Entry to getWorkbaskets(params= {})", params);

  WorkbasketQuery query = workbasketService.createWorkbasketQuery();
  query = applySortingParams(query, params);
  applyFilterParams(query, params);

  PageMetadata pageMetadata = getPageMetadata(params, query);
  List<WorkbasketSummary> workbasketSummaries = getQueryList(query, pageMetadata);
  TaskanaPagedModel<WorkbasketSummaryRepresentationModel> pagedModels =
          workbasketSummaries, pageMetadata);

  ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> response =
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Exit from getWorkbaskets(), returning {}", response);

  return response;
Example #9
Source File:    From spring-analysis-note with MIT License 6 votes vote down vote up
public void handshakeHandlerAndInterceptorWithAllowedOrigins() {
	WebMvcStompWebSocketEndpointRegistration registration =
			new WebMvcStompWebSocketEndpointRegistration(new String[] {"/foo"}, this.handler, this.scheduler);

	DefaultHandshakeHandler handshakeHandler = new DefaultHandshakeHandler();
	HttpSessionHandshakeInterceptor interceptor = new HttpSessionHandshakeInterceptor();
	String origin = "";

	MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
	assertEquals(1, mappings.size());

	Map.Entry<HttpRequestHandler, List<String>> entry = mappings.entrySet().iterator().next();
	assertEquals(Arrays.asList("/foo"), entry.getValue());

	WebSocketHttpRequestHandler requestHandler = (WebSocketHttpRequestHandler) entry.getKey();
	assertSame(handshakeHandler, requestHandler.getHandshakeHandler());
	assertEquals(2, requestHandler.getHandshakeInterceptors().size());
	assertEquals(interceptor, requestHandler.getHandshakeInterceptors().get(0));
	assertEquals(OriginHandshakeInterceptor.class, requestHandler.getHandshakeInterceptors().get(1).getClass());
Example #10
Source File:    From java-technology-stack with MIT License 6 votes vote down vote up
public void canRead() {
			forClassWithGenerics(MultiValueMap.class, String.class, Part.class),

			forClassWithGenerics(MultiValueMap.class, String.class, Object.class),

			forClassWithGenerics(MultiValueMap.class, String.class, String.class),

			forClassWithGenerics(Map.class, String.class, String.class),

			forClassWithGenerics(MultiValueMap.class, String.class, Part.class),
Example #11
Source File:    From lams with GNU General Public License v2.0 6 votes vote down vote up
 * Get the annotation attributes of <strong>all</strong> annotations of
 * the specified {@code annotationName} in the annotation hierarchy above
 * the supplied {@link AnnotatedElement} and store the results in a
 * {@link MultiValueMap}.
 * <p>Note: in contrast to {@link #getMergedAnnotationAttributes(AnnotatedElement, String)},
 * this method does <em>not</em> support attribute overrides.
 * <p>This method follows <em>get semantics</em> as described in the
 * {@linkplain AnnotatedElementUtils class-level javadoc}.
 * @param element the annotated element
 * @param annotationName the fully qualified class name of the annotation type to find
 * @param classValuesAsString whether to convert Class references into Strings or to
 * preserve them as Class references
 * @param nestedAnnotationsAsMap whether to convert nested Annotation instances into
 * {@code AnnotationAttributes} maps or to preserve them as Annotation instances
 * @return a {@link MultiValueMap} keyed by attribute name, containing the annotation
 * attributes from all annotations found, or {@code null} if not found
public static MultiValueMap<String, Object> getAllAnnotationAttributes(AnnotatedElement element,
		String annotationName, final boolean classValuesAsString, final boolean nestedAnnotationsAsMap) {

	final MultiValueMap<String, Object> attributesMap = new LinkedMultiValueMap<String, Object>();

	searchWithGetSemantics(element, null, annotationName, new SimpleAnnotationProcessor<Object>() {
		public Object process(AnnotatedElement annotatedElement, Annotation annotation, int metaDepth) {
			AnnotationAttributes annotationAttributes = AnnotationUtils.getAnnotationAttributes(
					annotation, classValuesAsString, nestedAnnotationsAsMap);
			for (Map.Entry<String, Object> entry : annotationAttributes.entrySet()) {
				attributesMap.add(entry.getKey(), entry.getValue());
			return CONTINUE;

	return (!attributesMap.isEmpty() ? attributesMap : null);
Example #12
Source File:    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
 * Gets the HTTP request entity encapsulating the headers and body of the HTTP message.  The body of the HTTP request
 * message will consist of an URL encoded application form (a mapping of key-value pairs) for POST/PUT HTTP requests.
 * <p/>
 * @return an HttpEntity with the headers and body for the HTTP request message.
 * @see #getParameters()
 * @see org.springframework.http.HttpEntity
 * @see org.springframework.http.HttpHeaders
public HttpEntity<?> createRequestEntity() {
  if (isPost() || isPut()) {
    // NOTE HTTP request parameters take precedence over HTTP message body content/media
    if (!getParameters().isEmpty()) {
      return new HttpEntity<MultiValueMap<String, Object>>(getParameters(), getHeaders());
    else {
      // NOTE the HTTP "Content-Type" header will be determined and set by the appropriate HttpMessageConverter
      // based on the Class type of the "content".
      return new HttpEntity<Object>(getContent(), getHeaders());
  else {
    return new HttpEntity<Object>(getHeaders());
Example #13
Source File:    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
protected void doFilterInternal(final HttpServletRequest request, HttpServletResponse response,
		FilterChain filterChain) throws ServletException, IOException {

	if (("PUT".equals(request.getMethod()) || "PATCH".equals(request.getMethod())) && isFormContentType(request)) {
		HttpInputMessage inputMessage = new ServletServerHttpRequest(request) {
			public InputStream getBody() throws IOException {
				return request.getInputStream();
		MultiValueMap<String, String> formParameters =, inputMessage);
		HttpServletRequest wrapper = new HttpPutFormContentRequestWrapper(request, formParameters);
		filterChain.doFilter(wrapper, response);
	else {
		filterChain.doFilter(request, response);
Example #14
Source File:    From lams with GNU General Public License v2.0 6 votes vote down vote up
private boolean validateBeforeFinish(HttpServletRequest request, String sessionMapID) {
SessionMap<String, Object> sessionMap = getSessionMap(request);
Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);

HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
Long userID = user.getUserID().longValue();

int numberCompletedTasks = taskListService.getNumTasksCompletedByUser(sessionId, userID);
int minimumNumberTasks = taskListService.getTaskListBySessionId(sessionId).getMinimumNumberTasks();
// if current user view less than reqired view count number, then just return error message.
if ((minimumNumberTasks - numberCompletedTasks) > 0) {
    MultiValueMap<String, String> errorMap = new LinkedMultiValueMap<>();
    errorMap.add("GLOBAL", messageService.getMessage("lable.learning.minimum.view.number"));
    request.setAttribute("errorMap", errorMap);
    return false;

return true;
Example #15
Source File:    From geowave with Apache License 2.0 6 votes vote down vote up
public OAuth2Authentication loadAuthentication(final String accessToken)
    throws AuthenticationException, InvalidTokenException {

  final MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
  formData.add(tokenName, accessToken);

  final HttpHeaders headers = new HttpHeaders();
  String req = "";
  try {
    req = checkTokenEndpointUrl + "?access_token=" + URLEncoder.encode(accessToken, "UTF-8");
  } catch (final UnsupportedEncodingException e) {
    logger.error("Unsupported encoding", e);

  final Map<String, Object> map = getForMap(req, formData, headers);

  if (map.containsKey("error")) {
    logger.debug("check_token returned error: " + map.get("error"));
    throw new InvalidTokenException(accessToken);

  return tokenConverter.extractAuthentication(map);
Example #16
Source File:    From servicecomb-java-chassis with Apache License 2.0 6 votes vote down vote up
public void ableToPostDate() throws Exception {
  ZonedDateTime date =;
  MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
  body.add("date", RestObjectMapperFactory.getRestObjectMapper().convertToString(Date.from(date.toInstant())));

  HttpHeaders headers = new HttpHeaders();

  int seconds = 1;
  Date result = restTemplate.postForObject(codeFirstUrl + "addDate?seconds={seconds}",
      new HttpEntity<>(body, headers),

  assertThat(result, is(Date.from(date.plusSeconds(seconds).toInstant())));

  ListenableFuture<ResponseEntity<Date>> listenableFuture = asyncRestTemplate
      .postForEntity(codeFirstUrl + "addDate?seconds={seconds}",
          new HttpEntity<>(body, headers),
  ResponseEntity<Date> dateResponseEntity = listenableFuture.get();
  assertThat(dateResponseEntity.getBody(), is(Date.from(date.plusSeconds(seconds).toInstant())));
Example #17
Source File:    From cloud-security-xsuaa-integration with Apache License 2.0 5 votes vote down vote up
public void retrieveToken_setsUsername() throws OAuth2ServiceException {
	cut.retrieveAccessTokenViaPasswordGrant(tokenEndpoint, clientCredentials,
			username, password, null, null);

	ArgumentCaptor<HttpEntity<MultiValueMap<String, String>>> requestEntityCaptor = captureRequestEntity();

	assertThat(valueOfParameter(USERNAME, requestEntityCaptor)).isEqualTo(username);
Example #18
Source File:    From spring-analysis-note with MIT License 5 votes vote down vote up
 * Expose URI template variables, matrix variables, and producible media types in the request.
protected void handleMatch(RequestMappingInfo info, HandlerMethod handlerMethod,
		ServerWebExchange exchange) {

	super.handleMatch(info, handlerMethod, exchange);

	PathContainer lookupPath = exchange.getRequest().getPath().pathWithinApplication();

	PathPattern bestPattern;
	Map<String, String> uriVariables;
	Map<String, MultiValueMap<String, String>> matrixVariables;

	Set<PathPattern> patterns = info.getPatternsCondition().getPatterns();
	if (patterns.isEmpty()) {
		bestPattern = getPathPatternParser().parse(lookupPath.value());
		uriVariables = Collections.emptyMap();
		matrixVariables = Collections.emptyMap();
	else {
		bestPattern = patterns.iterator().next();
		PathPattern.PathMatchInfo result = bestPattern.matchAndExtract(lookupPath);
		Assert.notNull(result, () ->
				"Expected bestPattern: " + bestPattern + " to match lookupPath " + lookupPath);
		uriVariables = result.getUriVariables();
		matrixVariables = result.getMatrixVariables();

	exchange.getAttributes().put(BEST_MATCHING_HANDLER_ATTRIBUTE, handlerMethod);
	exchange.getAttributes().put(BEST_MATCHING_PATTERN_ATTRIBUTE, bestPattern);
	exchange.getAttributes().put(URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriVariables);
	exchange.getAttributes().put(MATRIX_VARIABLES_ATTRIBUTE, matrixVariables);

	if (!info.getProducesCondition().getProducibleMediaTypes().isEmpty()) {
		Set<MediaType> mediaTypes = info.getProducesCondition().getProducibleMediaTypes();
		exchange.getAttributes().put(PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, mediaTypes);
Example #19
Source File:    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test  // SPR-12283
public void disableCorsWithSockJsService() {
	WebMvcStompWebSocketEndpointRegistration registration =
			new WebMvcStompWebSocketEndpointRegistration(new String[] {"/foo"}, this.handler, this.scheduler);


	MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
	assertEquals(1, mappings.size());
	SockJsHttpRequestHandler requestHandler = (SockJsHttpRequestHandler)mappings.entrySet().iterator().next().getKey();
	DefaultSockJsService sockJsService = (DefaultSockJsService)requestHandler.getSockJsService();
Example #20
Source File:    From java-microservices-examples with Apache License 2.0 5 votes vote down vote up
 * {@code GET  /audits} : get a page of {@link AuditEvent} between the {@code fromDate} and {@code toDate}.
 * @param fromDate the start of the time period of {@link AuditEvent} to get.
 * @param toDate the end of the time period of {@link AuditEvent} to get.
 * @param pageable the pagination information.
 * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of {@link AuditEvent} in body.
@GetMapping(params = {"fromDate", "toDate"})
public ResponseEntity<List<AuditEvent>> getByDates(
    @RequestParam(value = "fromDate") LocalDate fromDate,
    @RequestParam(value = "toDate") LocalDate toDate,
    @RequestParam MultiValueMap<String, String> queryParams, UriComponentsBuilder uriBuilder,
    Pageable pageable) {

    Page<AuditEvent> page = auditEventService.findByDates(
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(uriBuilder.queryParams(queryParams), page);
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
Example #21
Source File:    From java-technology-stack with MIT License 5 votes vote down vote up
private URI getUrlToUse() {
	MultiValueMap<String, String> params =

	if (!params.isEmpty()) {
		return UriComponentsBuilder.fromUri(this.url).queryParams(params).build(true).toUri();

	return this.url;
Example #22
Source File:    From openapi-generator with Apache License 2.0 5 votes vote down vote up
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
    if (username == null && password == null) {
    String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
    headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8)));
Example #23
Source File:    From tutorials with MIT License 5 votes vote down vote up
 * Add a new pet to the store
 * <p><b>405</b> - Invalid input
 * @param body Pet object that needs to be added to the store (required)
 * @return ResponseEntity&lt;Void&gt;
 * @throws RestClientException if an error occurs while attempting to invoke the API
public ResponseEntity<Void> addPetWithHttpInfo(Pet body) throws RestClientException {
    Object postBody = body;

    // verify the required parameter 'body' is set
    if (body == null) {
        throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling addPet");

    String path = apiClient.expandPath("/pet", Collections.<String, Object>emptyMap());

    final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
    final HttpHeaders headerParams = new HttpHeaders();
    final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
    final MultiValueMap formParams = new LinkedMultiValueMap();

    final String[] accepts = { };
    final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
    final String[] contentTypes = {
        "application/json", "application/xml"
    final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

    String[] authNames = new String[] { "petstore_auth" };

    ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
    return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
Example #24
Source File:    From spring-analysis-note with MIT License 5 votes vote down vote up
public void getAllAnnotationAttributesOnJavaxType() {
	MultiValueMap<String, Object> attributes = getAllAnnotationAttributes(
			ParametersAreNonnullByDefault.class, Nonnull.class.getName());
	assertNotNull("Annotation attributes map for @Nonnull on NonNullApi", attributes);
	assertEquals("value for NonNullApi", asList(When.ALWAYS), attributes.get("when"));
Example #25
Source File:    From java-technology-stack with MIT License 5 votes vote down vote up
private static <K,V> void copy(MultiValueMap<K,V> src, MultiValueMap<K,V> dst) {
	if (!src.isEmpty()) {
				.filter(entry -> !dst.containsKey(entry.getKey()))
				.forEach(entry -> dst.put(entry.getKey(), entry.getValue()));
Example #26
Source File:    From taoshop with Apache License 2.0 5 votes vote down vote up
public Credential fromRequestBody(@NotNull final MultiValueMap<String, String> requestBody) {
    final String username = requestBody.getFirst("username");
    final String password = requestBody.getFirst("password");
    if(username == null || password == null) {
        throw new BadRequestException("Invalid payload. 'username' and 'password' form fields are required.");
    return new UsernamePasswordCredential(requestBody.getFirst("username"), requestBody.getFirst("password"));
Example #27
Source File:    From java-technology-stack with MIT License 5 votes vote down vote up
protected MultiValueMap<String, HttpCookie> initCookies() {
	MultiValueMap<String, HttpCookie> cookies = new LinkedMultiValueMap<>();
	for (String name : {
		Cookie cookie =;
		HttpCookie httpCookie = new HttpCookie(name, cookie.getValue());
		cookies.add(name, httpCookie);
	return cookies;
Example #28
Source File:    From FEBS-Security with Apache License 2.0 5 votes vote down vote up
public AccessGrant refreshAccess(String refreshToken, MultiValueMap<String, String> additionalParameters) {

    StringBuilder refreshTokenUrl = new StringBuilder(FebsConstant.WEIXIN_REFRESH_TOKEN_URL);


    return getAccessToken(refreshTokenUrl);
Example #29
Source File:    From spring-analysis-note with MIT License 5 votes vote down vote up
public void setup() throws Exception {
	resolver = new RequestHeaderMapMethodArgumentResolver();

	Method method = getClass().getMethod("params", Map.class, MultiValueMap.class, HttpHeaders.class, Map.class);
	paramMap = new SynthesizingMethodParameter(method, 0);
	paramMultiValueMap = new SynthesizingMethodParameter(method, 1);
	paramHttpHeaders = new SynthesizingMethodParameter(method, 2);
	paramUnsupported = new SynthesizingMethodParameter(method, 3);

	request = new MockHttpServletRequest();
	webRequest = new ServletWebRequest(request, new MockHttpServletResponse());
Example #30
Source File:    From tutorials with MIT License 5 votes vote down vote up
public ResponseEntity<String> multiValue(@RequestHeader MultiValueMap<String, String> headers) {
    headers.forEach((key, value) -> {"Header '%s' = %s", key,"|"))));
    return new ResponseEntity<String>(String.format("Listed %d headers", headers.size()), HttpStatus.OK);