Spring Framework HttpMethod - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework HttpMethod class.

This code example shows how to use the following methods:name
	 * @param method the HTTP method to exectute (GET, POST, etc.) 
	 * @return the created request 
	 * @throws IOException in case of I/O errors 
	 */ 
	protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
		ClientHttpRequest request = getRequestFactory().createRequest(url, method);
		if (logger.isDebugEnabled()) {
			logger.debug("Created " + method.name() + " request for \"" + url + "\"");
		} 
		return request;
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:name
	 * @return the created request 
	 * @throws IOException in case of I/O errors 
	 */ 
	protected AsyncClientHttpRequest createAsyncRequest(URI url, HttpMethod method)
			throws IOException {
		AsyncClientHttpRequest request = getAsyncRequestFactory().createAsyncRequest(url, method);
		if (logger.isDebugEnabled()) {
			logger.debug("Created asynchronous " + method.name() + " request for \"" + url + "\"");
		} 
		return request;
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:ordinal
This code example shows how to use the following methods:name
 
 
	@Override 
	public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException {
		HttpURLConnection connection = openConnection(uri.toURL(), this.proxy);
		prepareConnection(connection, httpMethod.name());
		if (this.bufferRequestBody) {
			return new SimpleBufferingClientHttpRequest(connection, this.outputStreaming);
		} 
		else { 
			return new SimpleStreamingClientHttpRequest(connection, this.chunkSize, this.outputStreaming);
		} 
	} 
 
	/** 
	 * {@inheritDoc} 
	 * <p>Setting the {@link #setTaskExecutor(org.springframework.core.task.AsyncListenableTaskExecutor) taskExecutor} property 
	 * is required before calling this method. 
	 */ 
	@Override 
5
CodeRank
This code example shows how to use the following methods:toString
         * @param regexPatterns the regular expressions to create {@link RegexRequestMatcher} from 
         * 
         * @return a {@link List} of {@link RegexRequestMatcher} instances 
         */ 
        public static List<RequestMatcher> regexMatchers(HttpMethod httpMethod, String...regexPatterns) {
            String method = httpMethod == null ? null : httpMethod.toString();
            List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
            for(String pattern : regexPatterns) {
                matchers.add(new RegexRequestMatcher(pattern, method));
            } 
            return matchers;
        } 
 
        /** 
         * Create a {@link List} of {@link RegexRequestMatcher} instances that do not specify an {@link HttpMethod}. 
         * 
         * @param regexPatterns the regular expressions to create {@link RegexRequestMatcher} from 
         * 
         * @return a {@link List} of {@link RegexRequestMatcher} instances 
         */ 
5
CodeRank
This code example shows how to use the following methods:name
     * 
     * @param method method to set 
     * @return chained definition builder 
     */ 
    public ReceiveHttpMessageActionDefinition method(HttpMethod method) {
        header(HttpMessageHeaders.HTTP_REQUEST_METHOD, method.name());
        return this;
    } 
 
    /** 
     * Validates the request uri used. 
     * 
     * @param uri absolute URI for the endpoint 
     * @return chained definition builder 
     */ 
    public ReceiveHttpMessageActionDefinition uri(String uri) {
        header(HttpMessageHeaders.HTTP_REQUEST_URI, uri);
        return this;
    } 
 
4
CodeRank
This code example shows how to use the following methods:name
     * 
     * @param method method to set 
     * @return chained definition builder 
     */ 
    public SendHttpMessageActionDefinition method(HttpMethod method) {
        header(HttpMessageHeaders.HTTP_REQUEST_METHOD, method.name());
        return this;
    } 
 
    /** 
     * Set the endpoint URI for the request. This works only if the HTTP endpoint used 
     * doesn't provide an own endpoint URI resolver. 
     * 
     * @param uri absolute URI to use for the endpoint 
     * @return chained definition builder 
     */ 
    public SendHttpMessageActionDefinition uri(String uri) {
        // Set the endpoint URL properly. 
        header(DynamicEndpointUriResolver.ENDPOINT_URI_HEADER_NAME, uri);
        return this;
4
CodeRank
This code example shows how to use the following methods:name
 
		DateTime now = new DateTime();
 
		// Check the cache first 
		PresignedUrlCacheKey key = new PresignedUrlCacheKey(userId, s3Key,
				method.name());
		PresignedUrlCacheValue value = URL_CACHE.get(key);
		if (null != value) {
			// if url is not too stale, reuse it 
			DateTime minimumTimeLeft = now.plusSeconds(expiresSeconds / 2);
			if (value.getExpires().isAfter(minimumTimeLeft)) {
				return value.getUrl();
			} 
		} 
 
		// Get the credentials with which to sign the request 
		Credentials token = createFederationTokenForS3(userId, method, s3Key);
		AWSCredentials creds = new BasicAWSCredentials(token.getAccessKeyId(),
				token.getSecretAccessKey()); 
 
3
CodeRank
See Code Examples for Spring Framework HttpMethod Methods: