当前位置: 首页>>代码示例>>Java>>正文


Java MultiValueMap.getFirst方法代码示例

本文整理汇总了Java中org.springframework.util.MultiValueMap.getFirst方法的典型用法代码示例。如果您正苦于以下问题:Java MultiValueMap.getFirst方法的具体用法?Java MultiValueMap.getFirst怎么用?Java MultiValueMap.getFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.util.MultiValueMap的用法示例。


在下文中一共展示了MultiValueMap.getFirst方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createServiceInfo

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public VaultServiceInfo createServiceInfo(String id, String uri) {

	UriComponents uriInfo = UriComponentsBuilder.fromUriString(uri).build();

	String address = UriComponentsBuilder.newInstance() //
			.scheme(uriInfo.getScheme()) //
			.host(uriInfo.getHost()) //
			.port(uriInfo.getPort()) //
			.build().toString();

	MultiValueMap<String, String> queryParams = uriInfo.getQueryParams();

	String token = queryParams.getFirst("token");
	Assert.hasText(token, "Token (token=…) must not be empty");

	Map<String, String> backends = getBackends(queryParams, backendPattern);
	Map<String, String> sharedBackends = getBackends(queryParams,
			sharedBackendPattern);

	return new VaultServiceInfo(id, address, token.toCharArray(), backends,
			sharedBackends);
}
 
开发者ID:pivotal-cf,项目名称:spring-cloud-vault-connector,代码行数:24,代码来源:VaultServiceInfoCreator.java

示例2: registerBeanDefinitions

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
        public void registerBeanDefinitions(AnnotationMetadata metadata,
                                            BeanDefinitionRegistry registry) {
            MultiValueMap<String, Object> attributes = metadata
                    .getAllAnnotationAttributes(
                            EnableConfigService.class.getName(), false);
            Object[] type = attributes == null ? null
                    : (Object[]) attributes.getFirst("converters");
            if (type == null || type.length == 0) {
                return;
            }

            List<Class<?>> types = collectClasses(attributes.get("converters"));
//            for (Class<?> type : types) {
//                String name = type.getName();
//                if (!registry.containsBeanDefinition(name)) {
//                    registerBeanDefinition(registry, type, name);
//                }
//            }

            registerConverters(registry, types);
        }
 
开发者ID:zouzhirong,项目名称:configx,代码行数:23,代码来源:EnableConfigServiceImportSelector.java

示例3: findAllConnections

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void findAllConnections() {
    connectionFactoryRegistry.addConnectionFactory(new TestTwitterConnectionFactory());
    insertTwitterConnection();
    insertFacebookConnection();
    MultiValueMap<String, Connection<?>> connections = connectionRepository.findAllConnections();
    assertEquals(2, connections.size());
    Connection<TestFacebookApi> facebook = (Connection<TestFacebookApi>) connections.getFirst("facebook");
    assertFacebookConnection(facebook);
    Connection<TestTwitterApi> twitter = (Connection<TestTwitterApi>) connections.getFirst("twitter");
    assertTwitterConnection(twitter);
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:14,代码来源:CustomSocialUsersConnectionRepositoryIntTest.java

示例4: fromRequestBody

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
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"));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:TicketsResource.java

示例5: fromRequestBody

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public Credential fromRequestBody(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));
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:11,代码来源:DefaultCredentialFactory.java

示例6: fromRequestBody

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public Credential fromRequestBody(final MultiValueMap<String, String> requestBody) {
    final String cert = requestBody.getFirst(CERTIFICATE);
    LOGGER.debug("Certificate in the request body: [{}]", cert);
    if (StringUtils.isBlank(cert)) {
        return super.fromRequestBody(requestBody);
    }
    final InputStream is = new ByteArrayInputStream(cert.getBytes());
    final InputStreamSource iso = new InputStreamResource(is);
    final X509Certificate certificate = CertUtils.readCertificate(iso);
    final X509CertificateCredential credential = new X509CertificateCredential(new X509Certificate[]{certificate});
    credential.setCertificate(certificate);
    return credential;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:15,代码来源:X509CredentialFactory.java

示例7: registerBeanDefinitions

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
    MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(EnableMessageSource.class.getName(), false);
    boolean fallbackToSystemLocale = (boolean) (attributes != null ? attributes.getFirst("fallbackToSystemLocale") : false);
    String[] basenames = (String[]) (attributes != null ? attributes.getFirst("basenames") : null);

    BeanDefinitionBuilder bean = BeanDefinitionBuilder.genericBeanDefinition(ConfigMessageSourceConfigurer.class);
    bean.addPropertyValue("fallbackToSystemLocale", fallbackToSystemLocale);
    if (basenames != null && basenames.length > 0) {
        bean.addPropertyValue("basenames", basenames);
    }
    registry.registerBeanDefinition(ConfigMessageSourceConfigurer.class.getName(), bean.getBeanDefinition());
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:14,代码来源:EnableMessageSourceImportSelector.java

示例8: doPost

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
  // Check that we have a file upload request
  boolean isMultipart = ServletFileUpload.isMultipartContent(request);
  if (!isMultipart) {
    return;
  }
  try {
    MultipartHttpServletRequest
        multiRequest =
        new CommonsMultipartResolver().resolveMultipart(request);
    MultiValueMap<String, MultipartFile> fileMap = multiRequest.getMultiFileMap();
    BlobstoreService blobstoreService = AppFactory.get().getBlobstoreService();
    Map<String, String> names = new HashMap<>(1);
    for (String fieldName : fileMap.keySet()) {
      MultipartFile file = fileMap.getFirst(fieldName);
      String fileName = file.getOriginalFilename();
      String contentType = file.getContentType();
      long sizeInBytes = file.getSize();
      String
          blobKey =
          blobstoreService.store(fileName, contentType, sizeInBytes, file.getInputStream());
      names.put(fieldName, blobKey);

    }
    request.getSession().setAttribute("blobs", names);
    RequestDispatcher
        dispatcher =
        getServletContext().getRequestDispatcher(request.getParameter("ru"));
    dispatcher.forward(multiRequest, response);
  } catch (Exception ex) {
    _logger.severe("Upload failed", ex);
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:35,代码来源:FileUploadServlet.java

示例9: doPost

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
  // Check that we have a file upload request
  boolean isMultipart = ServletFileUpload.isMultipartContent(request);
  if (!isMultipart) {
    return;
  }
  try {
    MultipartHttpServletRequest
        multiRequest =
        new CommonsMultipartResolver().resolveMultipart(request);
    MultiValueMap<String, MultipartFile> fileMap = multiRequest.getMultiFileMap();
    BlobstoreService blobstoreService = AppFactory.get().getBlobstoreService();
    Map<String, String> names = new HashMap<>(1);
    for (String fieldName : fileMap.keySet()) {
      MultipartFile file = fileMap.getFirst(fieldName);
      String fileName = file.getOriginalFilename();
      String contentType = file.getContentType();
      long sizeInBytes = file.getSize();
      String
          blobKey =
          blobstoreService.store(fileName, contentType, sizeInBytes, file.getInputStream());
      names.put(fieldName, blobKey);
      names.put("file", fileName);

    }
    response.getWriter().write(new Gson().toJson(names));
    response.setStatus(HttpStatus.SC_CREATED);
  } catch (Exception ex) {
    _logger.severe("Upload failed", ex);
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:33,代码来源:DirectFileUploadServlet.java

示例10: selectImports

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public String[] selectImports(AnnotationMetadata metadata) {
	MultiValueMap<String,Object> attributes = metadata.getAllAnnotationAttributes(EnableMenu.class.getName(),
																				  false);
	String pluginId = attributes == null ? null : (String) attributes.getFirst("pluginId");

	if (StringUtils.isEmpty(pluginId)) {
		return new String[0];

	}
	return new String[]{MenuPluginBeanRegistrar.class.getName()};
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:13,代码来源:EnableMenuImportSelector.java

示例11: extract

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public List<InstanceDai.Value> extract(WriteContext context, RefreshEntireValueApi.SubIdForm form, MultiValueMap<String, IntensionDai.Record> dict) {
    List<InstanceDai.Value> instances = new ArrayList<>();
    Date now = new Date();
    Map<String, List<String>> map = form.getMap();
    for (String field : map.keySet()) {
        String dictField = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, field);
        IntensionDai.Record record = dict.getFirst(dictField);
        if (record == null) {
            logger.warn("cannot find field [{}]", field);
            continue;
        }
        String intId = record.getId();

        String[] values = cleanUpValues(map.get(field).toArray(new RefreshPartialValueApi.Value[0]));
        InstanceDai.Value value = ValueMapping.from(InstanceDai.Value.class, context, form);
        value.setId(String.valueOf(setgen.born()));
        value.setExtId(record.getExtId());
        value.setIntId(intId);
        value.setField(dictField);
        value.setValues(values);
        value.setBeginTime(now);
        value.setCommit(HashTools.hashHex(value));
        instances.add(value);
    }
    return instances;
}
 
开发者ID:SINeWang,项目名称:kiimate,代码行数:28,代码来源:DefaultInstanceExtractor.java

示例12: submitDeployJob

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
public String submitDeployJob (	String requestedByUserid, ServiceInstance instance,
								MultiValueMap<String, String> rebuildVariables, boolean isPerformStart,
								boolean isForceDeploy ) {

	String buildItem = "User: " + requestedByUserid + " service: " + instance.getServiceName_Port();

	if ( getBuildList().size() == 0 ||
			(getBuildList().size() > 0 && !getBuildList().contains( buildItem )) ) {
		// update deploy file to reflect new schedule in progress.
		try {
			OutputFileMgr outputFm = new OutputFileMgr(
				csapApp.getProcessingDir(), "/"
						+ instance.getServiceName_Port() + DEPLOY_OP );
			outputFm.print( "*** Scheduling Deployment" );
			outputFm.close();
			// do not to opComplete as UI polling will end
		} catch (IOException e) {
			// Emptying
		}
	}

	if ( !instance.getServiceName().equals( INIT_COMPLETE ) ) {
		buildItem = "User: " + requestedByUserid + " Service: " + instance.getServiceName();
		getBuildList().add( buildItem );

		String userName = Application.SYS_USER;
		if ( rebuildVariables != null && rebuildVariables.containsKey( "scmUserid" ) ) {
			userName = rebuildVariables.getFirst( "scmUserid" );
		}

		csapEventClient.generateEvent( CsapEventClient.CSAP_SVC_CATEGORY + "/" + instance.getServiceName(),
			userName, "Deployment Queued",
			"Timeout configured in cluster.js: "
					+ instance.getDeployTimeOutSeconds() + ", Command: \n" + rebuildVariables );
	}

	serviceJobExecutor.submit( () -> deployServiceRunnable( requestedByUserid,
		instance, rebuildVariables, isPerformStart, isForceDeploy ) );

	return buildItem;
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:42,代码来源:ServiceOsManager.java

示例13: shouldInitiateCredentialFlow

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Test
public void shouldInitiateCredentialFlow() throws UnsupportedEncodingException {
    final ResponseEntity<AcquisitionResponse> acquisitionResponse = post(
        "/api/v1/connectors/test-provider/credentials", Collections.singletonMap("returnUrl", "/ui#state"),
        AcquisitionResponse.class, tokenRule.validToken(), HttpStatus.ACCEPTED);

    assertThat(acquisitionResponse.hasBody()).as("Should present a acquisition response in the HTTP body").isTrue();

    final AcquisitionResponse response = acquisitionResponse.getBody();
    assertThat(response.getType()).isEqualTo(Type.OAUTH2);

    final String redirectUrl = response.getRedirectUrl();
    assertThat(redirectUrl).as("Should redirect to Salesforce and containthe correct callback URL")
        .startsWith("https://test/oauth2/authorize?client_id=testClientId&response_type=code&redirect_uri=")
        .contains(encode("/api/v1/credentials/callback", "ASCII"));

    final MultiValueMap<String, String> params = UriComponentsBuilder.fromHttpUrl(redirectUrl).build()
        .getQueryParams();

    final String state = params.getFirst("state");

    assertThat(state).as("state parameter should be set").isNotEmpty();

    final State responseStateInstruction = response.state();
    assertThat(responseStateInstruction).as("acquisition response should contain the state instruction")
        .isNotNull();
    assertThat(responseStateInstruction.persist()).isEqualByComparingTo(State.Persist.COOKIE);
    assertThat(responseStateInstruction.spec()).isNotEmpty();

    final CredentialFlowState credentialFlowState = clientSideState
        .restoreFrom(Cookie.valueOf(responseStateInstruction.spec()), CredentialFlowState.class);

    final CredentialFlowState expected = new OAuth2CredentialFlowState.Builder().key("test-state")
        .providerId("test-provider").build();

    assertThat(credentialFlowState).as("The flow state should be as expected")
        .isEqualToIgnoringGivenFields(expected, "returnUrl");
    final URI returnUrl = credentialFlowState.getReturnUrl();
    assertThat(returnUrl).isNotNull();
    assertThat(returnUrl.isAbsolute()).isTrue();
    assertThat(returnUrl.getPath()).isEqualTo("/ui");
    assertThat(returnUrl.getFragment()).isEqualTo("state");
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:44,代码来源:CredentialITCase.java

示例14: obtainCredential

import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
/**
 * Obtain credential from the request. Could be overridden by subclasses.
 *
 * @param requestBody raw entity request body
 * @return the credential instance
 */
protected Credential obtainCredential(final MultiValueMap<String, String> requestBody) {
    return new UsernamePasswordCredential(requestBody.getFirst("username"), requestBody.getFirst("password"));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:TicketsResource.java


注:本文中的org.springframework.util.MultiValueMap.getFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。