org.springframework.http.HttpMethod.PATCH

Here are the examples of the java api org.springframework.http.HttpMethod.PATCH taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

95 Examples 7

19 View Source File : BaseControllerTest.java
License : Apache License 2.0
Project Creator : Zoctan

protected Result patch(final String targetUrl, final Object args, final String token) throws Exception {
    return this.execute(HttpMethod.PATCH, targetUrl, args, token);
}

19 View Source File : RequestPredicates.java
License : MIT License
Project Creator : Vip-Augus

/**
 * Return a {@code RequestPredicate} that matches if request's HTTP method is {@code PATCH}
 * and the given {@code pattern} matches against the request path.
 * @param pattern the path pattern to match against
 * @return a predicate that matches if the request method is PATCH and if the given pattern
 * matches against the request path
 */
public static RequestPredicate PATCH(String pattern) {
    return method(HttpMethod.PATCH).and(path(pattern));
}

19 View Source File : MockServerHttpRequest.java
License : MIT License
Project Creator : Vip-Augus

/**
 * HTTP PATCH variant. See {@link #get(String, Object...)} for general info.
 * @param urlTemplate a URL template; the resulting URL will be encoded
 * @param uriVars zero or more URI variables
 * @return the created builder
 */
public static BodyBuilder patch(String urlTemplate, Object... uriVars) {
    return method(HttpMethod.PATCH, urlTemplate, uriVars);
}

19 View Source File : RestTemplate.java
License : MIT License
Project Creator : Vip-Augus

@Override
@Nullable
public <T> T patchForObject(String url, @Nullable Object request, Clreplaced<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
    RequestCallback requestCallback = httpEnreplacedyCallback(request, responseType);
    HttpMessageConverterExtractor<T> responseExtractor = new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
    return execute(url, HttpMethod.PATCH, requestCallback, responseExtractor, uriVariables);
}

19 View Source File : RestTemplate.java
License : MIT License
Project Creator : Vip-Augus

// PATCH
@Override
@Nullable
public <T> T patchForObject(String url, @Nullable Object request, Clreplaced<T> responseType, Object... uriVariables) throws RestClientException {
    RequestCallback requestCallback = httpEnreplacedyCallback(request, responseType);
    HttpMessageConverterExtractor<T> responseExtractor = new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
    return execute(url, HttpMethod.PATCH, requestCallback, responseExtractor, uriVariables);
}

19 View Source File : RestTemplate.java
License : MIT License
Project Creator : Vip-Augus

@Override
@Nullable
public <T> T patchForObject(URI url, @Nullable Object request, Clreplaced<T> responseType) throws RestClientException {
    RequestCallback requestCallback = httpEnreplacedyCallback(request, responseType);
    HttpMessageConverterExtractor<T> responseExtractor = new HttpMessageConverterExtractor<>(responseType, getMessageConverters());
    return execute(url, HttpMethod.PATCH, requestCallback, responseExtractor);
}

19 View Source File : NorthboundServiceV2Impl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public FlowResponseV2 partialUpdate(String flowId, FlowPatchV2 patch) {
    return restTemplate.exchange("/api/v2/flows/{flow_id}", HttpMethod.PATCH, new HttpEnreplacedy<>(patch, buildHeadersWithCorrelationId()), FlowResponseV2.clreplaced, flowId).getBody();
}

19 View Source File : NorthboundServiceV2Impl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public SwitchDtoV2 partialSwitchUpdate(SwitchId switchId, SwitchPatchDto dto) {
    return restTemplate.exchange("/api/v2/switches/{switchId}", HttpMethod.PATCH, new HttpEnreplacedy<>(dto, buildHeadersWithCorrelationId()), SwitchDtoV2.clreplaced, switchId).getBody();
}

19 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public KildaConfigurationDto updateKildaConfiguration(KildaConfigurationDto configuration) {
    log.debug("Update kilda configuration: {}", configuration);
    return restTemplate.exchange("/api/v1/config", HttpMethod.PATCH, new HttpEnreplacedy<>(configuration, buildHeadersWithCorrelationId()), KildaConfigurationDto.clreplaced).getBody();
}

19 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public FeatureTogglesDto toggleFeature(FeatureTogglesDto request) {
    HttpEnreplacedy<FeatureTogglesDto> httpEnreplacedy = new HttpEnreplacedy<>(request, buildHeadersWithCorrelationId());
    return restTemplate.exchange("/api/v1/features", HttpMethod.PATCH, httpEnreplacedy, FeatureTogglesDto.clreplaced).getBody();
}

19 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public FlowResponsePayload partialUpdate(String flowId, FlowPatchDto payload) {
    return restTemplate.exchange("/api/v1/flows/{flow_id}", HttpMethod.PATCH, new HttpEnreplacedy<>(payload, buildHeadersWithCorrelationId()), FlowResponsePayload.clreplaced, flowId).getBody();
}

19 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public FlowMeterEntries resetMeters(String flowId) {
    return restTemplate.exchange("/api/v1/flows/{flowId}/meters", HttpMethod.PATCH, new HttpEnreplacedy(buildHeadersWithCorrelationId()), FlowMeterEntries.clreplaced, flowId).getBody();
}

19 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public FlowPayload swapFlowPath(String flowId) {
    return restTemplate.exchange("/api/v1/flows/{flowId}/swap", HttpMethod.PATCH, new HttpEnreplacedy(buildHeadersWithCorrelationId()), FlowPayload.clreplaced, flowId).getBody();
}

19 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public SwitchSyncResult synchronizeSwitch(SwitchId switchId, boolean removeExcess) {
    HttpEnreplacedy<SwitchSyncRequest> httpEnreplacedy = new HttpEnreplacedy<>(new SwitchSyncRequest(removeExcess), buildHeadersWithCorrelationId());
    return restTemplate.exchange("/api/v1/switches/{switch_id}/synchronize", HttpMethod.PATCH, httpEnreplacedy, SwitchSyncResult.clreplaced, switchId).getBody();
}

19 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public FlowReroutePayload synchronizeFlow(String flowId) {
    return restTemplate.exchange("/api/v1/flows/{flowId}/sync", HttpMethod.PATCH, new HttpEnreplacedy(buildHeadersWithCorrelationId()), FlowReroutePayload.clreplaced, flowId).getBody();
}

19 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public FlowReroutePayload rerouteFlow(String flowId) {
    return restTemplate.exchange("/api/v1/flows/{flowId}/reroute", HttpMethod.PATCH, new HttpEnreplacedy(buildHeadersWithCorrelationId()), FlowReroutePayload.clreplaced, flowId).getBody();
}

19 View Source File : FlowsIntegrationService.java
License : Apache License 2.0
Project Creator : telstra

/**
 * Re sync flow.
 *
 * @param flowId the flow id
 * @return
 */
public String resyncFlow(String flowId) {
    try {
        HttpResponse response = restClientManager.invoke(applicationProperties.getNbBaseUrl() + IConstants.NorthBoundUrl.RESYNC_FLOW.replace("{flow_id}", UriUtils.encodePath(flowId, "UTF-8")), HttpMethod.PATCH, "", "application/json", applicationService.getAuthHeader());
        return IoUtil.toString(response.getEnreplacedy().getContent());
    } catch (InvalidResponseException e) {
        LOGGER.error("Error occurred while resync flow by id:" + flowId, e);
        throw new InvalidResponseException(e.getCode(), e.getResponse());
    } catch (UnsupportedEncodingException e) {
        LOGGER.warn("Error occurred while resync flow by id:" + flowId, e);
        throw new IntegrationException(e);
    } catch (IOException e) {
        LOGGER.warn("Error occurred while resync flow by id:" + flowId, e);
        throw new IntegrationException(e);
    }
}

19 View Source File : BaseITCase.java
License : Apache License 2.0
Project Creator : syndesisio

protected <T> ResponseEnreplacedy<T> patch(String url, Object body, Clreplaced<T> responseClreplaced, String token, HttpStatus expectedStatus, HttpHeaders headers) {
    return http(HttpMethod.PATCH, url, body, responseClreplaced, token, headers, expectedStatus);
}

19 View Source File : BaseITCase.java
License : Apache License 2.0
Project Creator : syndesisio

protected <T> ResponseEnreplacedy<T> patch(String url, Object body, ParameterizedTypeReference<T> responseClreplaced, String token, HttpStatus expectedStatus) {
    return http(HttpMethod.PATCH, url, body, responseClreplaced, token, new HttpHeaders(), expectedStatus);
}

19 View Source File : BaseITCase.java
License : Apache License 2.0
Project Creator : syndesisio

protected <T> ResponseEnreplacedy<T> patch(String url, Object body, Clreplaced<T> responseClreplaced, String token, HttpStatus expectedStatus) {
    return http(HttpMethod.PATCH, url, body, responseClreplaced, token, expectedStatus);
}

19 View Source File : BaseITCase.java
License : Apache License 2.0
Project Creator : syndesisio

protected <T> ResponseEnreplacedy<T> patch(String url, Object body, ParameterizedTypeReference<T> responseClreplaced) {
    return http(HttpMethod.PATCH, url, body, responseClreplaced, tokenRule.validToken(), new HttpHeaders(), HttpStatus.OK);
}

19 View Source File : AbstractWebResource.java
License : GNU Affero General Public License v3.0
Project Creator : overture-stack

public ResponseEnreplacedy<T> patch() {
    return doRequest(this.body, HttpMethod.PATCH);
}

19 View Source File : RequestsDbClient.java
License : Apache License 2.0
Project Creator : onap

public void patchInfraActiveRequests(InfraActiveRequests request) {
    HttpHeaders headers = getHttpHeaders();
    URI uri = getUri(infraActiveRequestURI + request.getRequestId());
    HttpEnreplacedy<InfraActiveRequests> enreplacedy = new HttpEnreplacedy<>(request, headers);
    restTemplate.exchange(uri, HttpMethod.PATCH, enreplacedy, String.clreplaced);
}

19 View Source File : FrameworkServlet.java
License : Apache License 2.0
Project Creator : langtianya

/**
 * Override the parent clreplaced implementation in order to intercept PATCH requests.
 */
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    if (HttpMethod.PATCH.matches(request.getMethod())) {
        processRequest(request, response);
    } else {
        super.service(request, response);
    }
}

19 View Source File : HttpClientUtils.java
License : MIT License
Project Creator : chingov

public static String sendPatch(final String url, String content, Map<String, String> headerMap, String contentCharset, String resultCharset) {
    return send(url, content, headerMap, null, contentCharset, resultCharset, HttpMethod.PATCH);
}

19 View Source File : KubernetesServiceImpl.java
License : MIT License
Project Creator : att

@Override
public <T> T apiPatchRequest(String targetCluster, String path, T enreplacedy) {
    return executeApiRequest(targetCluster, path, HttpMethod.PATCH, enreplacedy, true);
}

18 View Source File : DefaultWebClient.java
License : MIT License
Project Creator : Vip-Augus

@Override
public RequestBodyUriSpec patch() {
    return methodInternal(HttpMethod.PATCH);
}

18 View Source File : SwitchIntegrationService.java
License : Apache License 2.0
Project Creator : telstra

/**
 * Updates the switch location.
 *
 * @return the SwitchInfo
 */
public SwitchInfo updateSwitchLocation(String switchId, SwitchLocation switchLocation) {
    try {
        HttpResponse response = restClientManager.invoke(applicationProperties.getNbBaseUrl() + IConstants.NorthBoundUrl.UPDATE_SWITCH_LOCATION.replace("{switch_id}", switchId), HttpMethod.PATCH, objectMapper.writeValuereplacedtring(switchLocation), "application/json", applicationService.getAuthHeader());
        if (RestClientManager.isValidResponse(response)) {
            return restClientManager.getResponse(response, SwitchInfo.clreplaced);
        }
    } catch (InvalidResponseException e) {
        LOGGER.error("Error occurred while updating switch location:" + switchId, e);
        throw new InvalidResponseException(e.getCode(), e.getResponse());
    } catch (JsonProcessingException e) {
        LOGGER.warn("Error occurred while updating switch location:" + switchId, e);
        throw new IntegrationException(e.getMessage(), e);
    }
    return null;
}

18 View Source File : SwitchIntegrationService.java
License : Apache License 2.0
Project Creator : telstra

/**
 * Updates the isl max bandwidth.
 *
 * @return the LinkMaxBandwidth
 */
public LinkMaxBandwidth updateLinkBandwidth(String srcSwitch, String srcPort, String dstSwitch, String dstPort, LinkMaxBandwidth linkMaxBandwidth) {
    try {
        HttpResponse response = restClientManager.invoke(applicationProperties.getNbBaseUrl() + IConstants.NorthBoundUrl.UPDATE_LINK_BANDWIDTH.replace("{src_switch}", srcSwitch).replace("{src_port}", srcPort).replace("{dst_switch}", dstSwitch).replace("{dst_port}", dstPort), HttpMethod.PATCH, objectMapper.writeValuereplacedtring(linkMaxBandwidth), "application/json", applicationService.getAuthHeader());
        if (RestClientManager.isValidResponse(response)) {
            return restClientManager.getResponse(response, LinkMaxBandwidth.clreplaced);
        }
    } catch (InvalidResponseException e) {
        LOGGER.error("Error occurred while updating link bandwidth", e);
        throw new InvalidResponseException(e.getCode(), e.getResponse());
    } catch (JsonProcessingException e) {
        LOGGER.error("Error occurred while updating link bandwidth", e);
        throw new IntegrationException(e);
    }
    return null;
}

18 View Source File : SwitchIntegrationService.java
License : Apache License 2.0
Project Creator : telstra

/**
 * Updates the isl bfd flag.
 *
 * @return the IslLink
 */
public List<IslLink> updateLinkBfdFlag(final LinkParametersDto linkParametersDto) {
    try {
        HttpResponse response = restClientManager.invoke(applicationProperties.getNbBaseUrl() + IConstants.NorthBoundUrl.UPDATE_LINK_BFD_FLAG, HttpMethod.PATCH, objectMapper.writeValuereplacedtring(linkParametersDto), "application/json", applicationService.getAuthHeader());
        if (RestClientManager.isValidResponse(response)) {
            return restClientManager.getResponseList(response, IslLink.clreplaced);
        }
    } catch (InvalidResponseException e) {
        LOGGER.error("Error occurred while updating isl bfd-flag", e);
        throw new InvalidResponseException(e.getCode(), e.getResponse());
    } catch (JsonProcessingException e) {
        LOGGER.error("Error occurred while updating isl bfd-flag", e);
        throw new IntegrationException(e);
    }
    return null;
}

18 View Source File : InstanceExchangeFilterFunctionsTest.java
License : Apache License 2.0
Project Creator : SpringCloud

@Test
public void should_not_retry_for_put_post_patch_delete() {
    ExchangeFilterFunction filter = InstanceExchangeFilterFunctions.retry(1, emptyMap());
    AtomicLong invocationCount = new AtomicLong(0L);
    ExchangeFunction exchange = r -> Mono.fromSupplier(() -> {
        invocationCount.incrementAndGet();
        throw new IllegalStateException("Test");
    });
    ClientRequest patchRequest = ClientRequest.create(HttpMethod.PATCH, URI.create("/test")).build();
    StepVerifier.create(filter.filter(patchRequest, exchange)).expectError(IllegalStateException.clreplaced).verify();
    replacedertThat(invocationCount.get()).isEqualTo(1);
    invocationCount.set(0L);
    ClientRequest putRequest = ClientRequest.create(HttpMethod.PUT, URI.create("/test")).build();
    StepVerifier.create(filter.filter(putRequest, exchange)).expectError(IllegalStateException.clreplaced).verify();
    replacedertThat(invocationCount.get()).isEqualTo(1);
    invocationCount.set(0L);
    ClientRequest postRequest = ClientRequest.create(HttpMethod.POST, URI.create("/test")).build();
    StepVerifier.create(filter.filter(postRequest, exchange)).expectError(IllegalStateException.clreplaced).verify();
    replacedertThat(invocationCount.get()).isEqualTo(1);
    invocationCount.set(0L);
    ClientRequest deleteRequest = ClientRequest.create(HttpMethod.DELETE, URI.create("/test")).build();
    StepVerifier.create(filter.filter(deleteRequest, exchange)).expectError(IllegalStateException.clreplaced).verify();
    replacedertThat(invocationCount.get()).isEqualTo(1);
}

18 View Source File : AppUserResource.java
License : MIT License
Project Creator : rocketbase-io

@Override
@SneakyThrows
public AppUserRead patch(String usernameOrId, AppUserUpdate update) {
    ResponseEnreplacedy<AppUserRead> response = restTemplate.exchange(createUriComponentsBuilder(baseAuthApiUrl).path(API_USER).path(usernameOrId).toUriString(), HttpMethod.PATCH, new HttpEnreplacedy<>(update, createHeaderWithLanguage()), AppUserRead.clreplaced);
    return response.getBody();
}

18 View Source File : FakeApi.java
License : Apache License 2.0
Project Creator : OpenAPITools

/**
 * To test \"client\" model
 * To test \"client\" model
 * <p><b>200</b> - successful operation
 * @param body client model
 * @return Client
 * @throws WebClientResponseException if an error occurs while attempting to invoke the API
 */
public Mono<Client> testClientModel(Client body) throws WebClientResponseException {
    Object postBody = body;
    // verify the required parameter 'body' is set
    if (body == null) {
        throw new WebClientResponseException("Missing the required parameter 'body' when calling testClientModel", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
    }
    // create path and map variables
    final Map<String, Object> pathParams = new HashMap<String, Object>();
    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<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
    final String[] localVarAccepts = { "application/json" };
    final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
    final String[] localVarContentTypes = { "application/json" };
    final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
    String[] localVarAuthNames = new String[] {};
    ParameterizedTypeReference<Client> localVarReturnType = new ParameterizedTypeReference<Client>() {
    };
    return apiClient.invokeAPI("/fake", HttpMethod.PATCH, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}

18 View Source File : FakeApi.java
License : Apache License 2.0
Project Creator : OpenAPITools

/**
 * To test \"client\" model
 * To test \"client\" model
 * <p><b>200</b> - successful operation
 * @param body client model (required)
 * @return ResponseEnreplacedy<Client>
 * @throws RestClientException if an error occurs while attempting to invoke the API
 */
public ResponseEnreplacedy<Client> testClientModelWithHttpInfo(Client 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 testClientModel");
    }
    String path = apiClient.expandPath("/fake", 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<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
    final String[] localVarAccepts = { "application/json" };
    final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
    final String[] contentTypes = { "application/json" };
    final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
    String[] authNames = new String[] {};
    ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {
    };
    return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}

18 View Source File : DefaultFirebaseRealtimeDatabaseRepository.java
License : MIT License
Project Creator : fabiomaffioletti

@Override
public T update(T doreplacedent, Object... uriVariables) {
    ReflectionUtils.makeAccessible(doreplacedentId);
    ID id = (ID) ReflectionUtils.getField(doreplacedentId, doreplacedent);
    replacedert id != null : "When using update an id value must be specified";
    HttpEnreplacedy httpEnreplacedy = HttpEnreplacedyBuilder.create(firebaseObjectMapper, firebaseApplicationService).header("X-HTTP-Method-Override", HttpMethod.PATCH.name()).doreplacedent(doreplacedent).build();
    T response = restTemplate.exchange(getDoreplacedentPath(id), HttpMethod.PUT, httpEnreplacedy, doreplacedentClreplaced, uriVariables).getBody();
    ReflectionUtils.setField(doreplacedentId, response, id);
    return response;
}

18 View Source File : HttpServerSteps.java
License : Apache License 2.0
Project Creator : citrusframework

/**
 * Receives server request.
 * @param request
 */
private void receiveServerRequest(HttpMessage request) {
    if (!httpServer.isRunning()) {
        httpServer.start();
    }
    HttpServerActionBuilder.HttpServerReceiveActionBuilder receiveBuilder = http().server(httpServer).receive();
    HttpServerRequestActionBuilder.HttpMessageBuilderSupport requestBuilder;
    if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
        requestBuilder = receiveBuilder.post().message(request);
    } else if (request.getRequestMethod().equals(HttpMethod.GET)) {
        requestBuilder = receiveBuilder.get().message(request);
    } else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
        requestBuilder = receiveBuilder.put().message(request);
    } else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
        requestBuilder = receiveBuilder.delete().message(request);
    } else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
        requestBuilder = receiveBuilder.head().message(request);
    } else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
        requestBuilder = receiveBuilder.trace().message(request);
    } else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
        requestBuilder = receiveBuilder.patch().message(request);
    } else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
        requestBuilder = receiveBuilder.options().message(request);
    } else {
        requestBuilder = receiveBuilder.post().message(request);
    }
    requestBuilder.validate(pathExpression().expressions(bodyValidationExpressions));
    bodyValidationExpressions.clear();
    requestBuilder.timeout(timeout).type(requestMessageType);
    runner.run(requestBuilder);
}

18 View Source File : MockMvcSupport.java
License : Apache License 2.0
Project Creator : ch4mpy

/* PATCH */
/**
 * Factory for a patch request builder (with Content-type already set).
 *
 * @param payload     request body
 * @param charset     char-set to be used for serialized payloads
 * @param contentType payload serialization format
 * @param urlTemplate API end-point
 * @param uriVars     values for end-point placeholders
 * @param <T>         payload type
 * @return request builder to further configure (additional headers, cookies,
 *         etc.)
 * @throws Exception if payload serialization goes wrong
 */
public <T> MockHttpServletRequestBuilder patchRequestBuilder(T payload, MediaType contentType, Charset charset, String urlTemplate, Object... uriVars) throws Exception {
    return feed(requestBuilder(Optional.empty(), Optional.of(charset), HttpMethod.PATCH, urlTemplate, uriVars), payload, contentType, charset);
}

18 View Source File : CseRestTemplate.java
License : Apache License 2.0
Project Creator : apache

@Override
@Nullable
public <T> T patchForObject(String url, @Nullable Object request, Clreplaced<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
    RequestCallback requestCallback = httpEnreplacedyCallback(request, responseType);
    CseHttpMessageConverterExtractor<T> responseExtractor = new CseHttpMessageConverterExtractor<>();
    return execute(url, HttpMethod.PATCH, requestCallback, responseExtractor, uriVariables);
}

18 View Source File : CseRestTemplate.java
License : Apache License 2.0
Project Creator : apache

// PUT
// no override
// PATCH
@Override
@Nullable
public <T> T patchForObject(String url, @Nullable Object request, Clreplaced<T> responseType, Object... uriVariables) throws RestClientException {
    RequestCallback requestCallback = httpEnreplacedyCallback(request, responseType);
    CseHttpMessageConverterExtractor<T> responseExtractor = new CseHttpMessageConverterExtractor<>();
    return execute(url, HttpMethod.PATCH, requestCallback, responseExtractor, uriVariables);
}

18 View Source File : JdkProxyCreate.java
License : Apache License 2.0
Project Creator : 0428402001

/**
 * 得到请求的URL和方法
 *
 * @param method
 * @param methodInfo
 */
private void extractUrlAndMethod(Method method, MethodInfo methodInfo) {
    // 得到请求URL和请求方法
    Annotation[] annotations = method.getDeclaredAnnotations();
    for (Annotation annotation : annotations) {
        // GET
        if (annotation instanceof GetMapping) {
            GetMapping a = (GetMapping) annotation;
            methodInfo.setUrl(a.value()[0]);
            methodInfo.setMethod(HttpMethod.GET);
        } else // POST
        if (annotation instanceof PostMapping) {
            PostMapping a = (PostMapping) annotation;
            methodInfo.setUrl(a.value()[0]);
            methodInfo.setMethod(HttpMethod.POST);
        } else // DELETE
        if (annotation instanceof DeleteMapping) {
            DeleteMapping a = (DeleteMapping) annotation;
            methodInfo.setUrl(a.value()[0]);
            methodInfo.setMethod(HttpMethod.DELETE);
        } else // PUT
        if (annotation instanceof PutMapping) {
            PutMapping a = (PutMapping) annotation;
            methodInfo.setUrl(a.value()[0]);
            methodInfo.setMethod(HttpMethod.PUT);
        } else // PATCH
        if (annotation instanceof PatchMapping) {
            PatchMapping a = (PatchMapping) annotation;
            methodInfo.setUrl(a.value()[0]);
            methodInfo.setMethod(HttpMethod.PATCH);
        }
    }
}

17 View Source File : SpringConfig.java
License : Apache License 2.0
Project Creator : yujunhao8831

/**
 * cors跨域处理
 *
 * @param registry
 */
@Override
public void addCorsMappings(CorsRegistry registry) {
    registry.addMapping("/**").allowedMethods(HttpMethod.HEAD.name(), HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.PUT.name(), HttpMethod.DELETE.name(), HttpMethod.OPTIONS.name(), HttpMethod.PATCH.name(), HttpMethod.TRACE.name()).allowedOrigins("*");
}

17 View Source File : StreamingHttpComponentsClientHttpRequestFactoryTests.java
License : MIT License
Project Creator : Vip-Augus

@Override
@Test
public void httpMethods() throws Exception {
    replacedertHttpMethod("patch", HttpMethod.PATCH);
}

17 View Source File : OkHttp3ClientHttpRequestFactoryTests.java
License : MIT License
Project Creator : Vip-Augus

@Override
@Test
public void httpMethods() throws Exception {
    super.httpMethods();
    replacedertHttpMethod("patch", HttpMethod.PATCH);
}

17 View Source File : BufferedSimpleHttpRequestFactoryTests.java
License : MIT License
Project Creator : Vip-Augus

@Override
@Test
public void httpMethods() throws Exception {
    try {
        replacedertHttpMethod("patch", HttpMethod.PATCH);
    } catch (ProtocolException ex) {
    // Currently HttpURLConnection does not support HTTP PATCH
    }
}

17 View Source File : BufferedSimpleAsyncHttpRequestFactoryTests.java
License : MIT License
Project Creator : Vip-Augus

@Override
@Test
public void httpMethods() throws Exception {
    super.httpMethods();
    try {
        replacedertHttpMethod("patch", HttpMethod.PATCH);
    } catch (ProtocolException ex) {
    // Currently HttpURLConnection does not support HTTP PATCH
    }
}

17 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public List<LinkDto> setLinkMaintenance(LinkUnderMaintenanceDto link) {
    LinkDto[] updatedLink = restTemplate.exchange("/api/v1/links/under-maintenance", HttpMethod.PATCH, new HttpEnreplacedy<>(link, buildHeadersWithCorrelationId()), LinkDto[].clreplaced).getBody();
    return Arrays.asList(updatedLink);
}

17 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public LinkMaxBandwidthDto updateLinkMaxBandwidth(SwitchId srcSwitch, Integer srcPort, SwitchId dstSwitch, Integer dstPort, Long linkMaxBandwidth) {
    UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString("/api/v1/links/bandwidth");
    if (srcSwitch != null) {
        uriBuilder.queryParam("src_switch", srcSwitch);
    }
    if (srcPort != null) {
        uriBuilder.queryParam("src_port", srcPort);
    }
    if (dstSwitch != null) {
        uriBuilder.queryParam("dst_switch", dstSwitch);
    }
    if (dstPort != null) {
        uriBuilder.queryParam("dst_port", dstPort);
    }
    return restTemplate.exchange(uriBuilder.build().toString(), HttpMethod.PATCH, new HttpEnreplacedy<>(new LinkMaxBandwidthRequest(linkMaxBandwidth), buildHeadersWithCorrelationId()), LinkMaxBandwidthDto.clreplaced).getBody();
}

17 View Source File : NorthboundServiceImpl.java
License : Apache License 2.0
Project Creator : telstra

@Override
public List<LinkDto> setLinkBfd(LinkEnableBfdDto link) {
    log.debug("Changing bfd status to '{}' for link {}:{}-{}:{}", link.isEnableBfd(), link.getSrcSwitch(), link.getSrcPort(), link.getDstSwitch(), link.getDstPort());
    LinkDto[] updatedLinks = restTemplate.exchange("api/v1/links/enable-bfd", HttpMethod.PATCH, new HttpEnreplacedy<>(link, buildHeadersWithCorrelationId()), LinkDto[].clreplaced).getBody();
    return Arrays.asList(updatedLinks);
}

17 View Source File : SwitchIntegrationService.java
License : Apache License 2.0
Project Creator : telstra

/**
 * Updates the isl links.
 *
 * @return the isl links
 */
public List<IslLink> updateIslLinkMaintenanceStatus(final LinkUnderMaintenanceDto islLinkInfo) {
    try {
        HttpResponse response = restClientManager.invoke(applicationProperties.getNbBaseUrl() + IConstants.NorthBoundUrl.UPDATE_LINK_MAINTENANCE, HttpMethod.PATCH, objectMapper.writeValuereplacedtring(islLinkInfo), "application/json", applicationService.getAuthHeader());
        if (RestClientManager.isValidResponse(response)) {
            return restClientManager.getResponseList(response, IslLink.clreplaced);
        }
    } catch (JsonProcessingException e) {
        LOGGER.error("Error occurred while updating link", e);
    }
    return null;
}

17 View Source File : FlowsIntegrationService.java
License : Apache License 2.0
Project Creator : telstra

/**
 * Reroute flow.
 *
 * @param flowId the flow id
 * @return the flow path
 */
public FlowPath rerouteFlow(String flowId) {
    try {
        HttpResponse response = restClientManager.invoke(applicationProperties.getNbBaseUrl() + IConstants.NorthBoundUrl.GET_FLOW_REROUTE.replace("{flow_id}", UriUtils.encodePath(flowId, "UTF-8")), HttpMethod.PATCH, "", "", applicationService.getAuthHeader());
        if (RestClientManager.isValidResponse(response)) {
            FlowPath flowPath = restClientManager.getResponse(response, FlowPath.clreplaced);
            return flowPath;
        } else {
            String content = IoUtil.toString(response.getEnreplacedy().getContent());
            throw new InvalidResponseException(response.getStatusLine().getStatusCode(), content);
        }
    } catch (InvalidResponseException e) {
        LOGGER.error("Error occurred while rerouting flow by id:" + flowId, e);
        throw new InvalidResponseException(e.getCode(), e.getResponse());
    } catch (UnsupportedEncodingException e) {
        LOGGER.warn("Error occurred while rerouting flow by id:" + flowId, e);
        throw new IntegrationException(e);
    } catch (IOException e) {
        LOGGER.warn("Error occurred while rerouting flow by id:" + flowId, e);
        throw new IntegrationException(e);
    }
}

See More Examples