Package org.springframework.http

Examples of org.springframework.http.HttpMethod


  }
 
  protected <T extends ApiEntity> T saveEntity(String baseUrl, T entity) {
   
    String url;
    HttpMethod method;
   
    if(hasText(entity.getId())) {
      url = baseUrl + '/' + entity.getId();
      method = PUT;
    } else {
View Full Code Here


  }
 
  protected <T extends ApiEntity> T saveEntity(String baseUrl, T entity) {
   
    String url;
    HttpMethod method;
   
    if(hasText(entity.getId())) {
      url = baseUrl + '/' + entity.getId();
      method = PUT;
    } else {
View Full Code Here

*/
public class RestTemplateClient implements Client {
    @Override
    public Response execute(Request request, Request.Options options) throws IOException {
        RestTemplate restTemplate = new RestTemplate();
        HttpMethod method = HttpMethod.valueOf(request.method());

        HttpHeaders requestHeaders = new HttpHeaders();
        for (String header: request.headers().keySet()) {
            Collection<String> values = request.headers().get(header);
            if (values != null && !values.isEmpty())
View Full Code Here

      HttpServletRequest httpServletRequest = (HttpServletRequest) request;

      String method = httpServletRequest.getHeader(HEADER_NAME);
      if (method != null) {
        if (ALLOWED_METHODS.contains(method.toUpperCase())) {
          final HttpMethod httpMethod = HttpMethod.valueOf(method.toUpperCase());
          HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(httpServletRequest){
            @Override
            public String getMethod() {
              return httpMethod.toString();
            }
          };

          chain.doFilter(requestWrapper, response);
          return;
View Full Code Here

    private OperationMap assertRequestDetails(OperationMap op, ClientHttpRequest request) {
        assertNotNull("No request details", op);

        URI uri = request.getURI();
        HttpMethod method = request.getMethod();
        assertEquals("Mismatched method", method.name(), op.get("method", String.class));
        assertEquals("Mismatched URI", uri.toString(), op.get(OperationFields.URI, String.class));
        assertMethodHeaders("request", op, request.getHeaders());
        return op;
    }
View Full Code Here

        Operation op = getLastEntered();
        assertNotNull("No operation collected", op);
        assertEquals("Mismatched type", ClientHttpRequestOperationCollector.TYPE, op.getType());

        URI uri = request.getURI();
        HttpMethod method = request.getMethod();
        assertEquals("Mismatched label", method + " " + uri.toString(), op.getLabel());
        return op;
    }
View Full Code Here

        factory.setBufferRequestBody(false);
        factory.setConnectTimeout(15 * 1000);
        factory.setReadTimeout(15 * 1000);

        URI uri = new URI("http://localhost:" + TEST_PORT + "/testConnectionFactory");
        HttpMethod method = HttpMethod.GET;
        ClientHttpRequest request = factory.createRequest(uri, method);
        ClientHttpResponse response = request.execute();
        assertEquals("Mismatched response code", HttpStatus.OK.value(), response.getRawStatusCode());

        BufferedReader rdr = new BufferedReader(new InputStreamReader(response.getBody()));
View Full Code Here

        return op;
    }

    Operation fillRequestDetails(Operation op, ClientHttpRequest request) {
        URI uri = request.getURI();
        HttpMethod method = request.getMethod();
        op.label(method + " " + uri.toString());
        fillRequestDetails(op.createMap("request"), request);
        return op;
    }
View Full Code Here

        return op;
    }

    OperationMap fillRequestDetails(OperationMap op, ClientHttpRequest request) {
        URI uri = request.getURI();
        HttpMethod method = request.getMethod();
        op.put(OperationFields.URI, uri.toString())
                .put("method", method.name())
        ;

        if (collectExtraInformation()) {
            fillMethodHeaders(op.createList("headers"), request.getHeaders());
        }
View Full Code Here

        for (UrlMappingInfo urlMappingInfo : urlMappingInfos) {
            if (urlMappingInfo.getHttpMethod() == null || urlMappingInfo.getHttpMethod().equals(UrlMapping.ANY_HTTP_METHOD)) {
                methods.addAll(Arrays.asList(HttpMethod.values())); break;
            }
            else {
                HttpMethod method = HttpMethod.valueOf(urlMappingInfo.getHttpMethod().toUpperCase());
                methods.add(method);
            }
        }

        return Collections.unmodifiableSet(methods);
View Full Code Here

TOP

Related Classes of org.springframework.http.HttpMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.