Java Code Examples for org.springframework.http.HttpEntity#EMPTY

The following examples show how to use org.springframework.http.HttpEntity#EMPTY . 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: LoggersHtmlEndpoint.java    From edison-microservice with Apache License 2.0 6 votes vote down vote up
@RequestMapping(
        value = "${edison.application.management.base-path:/internal}/loggers/{name:.*}",
        consumes = {
                ActuatorMediaType.V2_JSON,
                APPLICATION_JSON_VALUE},
        produces = {
                ActuatorMediaType.V2_JSON,
                APPLICATION_JSON_VALUE},
        method = POST)
@ResponseBody
public Object post(@PathVariable String name,
                   @RequestBody Map<String, String> configuration) {
    final String level = configuration.get("configuredLevel");
    final LogLevel logLevel = level == null ? null : LogLevel.valueOf(level.toUpperCase());
    loggersEndpoint.configureLogLevel(name, logLevel);
    return HttpEntity.EMPTY;
}
 
Example 2
Source File: RestTemplate.java    From spring-analysis-note with MIT License 5 votes vote down vote up
public HttpEntityRequestCallback(@Nullable Object requestBody, @Nullable Type responseType) {
	super(responseType);
	if (requestBody instanceof HttpEntity) {
		this.requestEntity = (HttpEntity<?>) requestBody;
	}
	else if (requestBody != null) {
		this.requestEntity = new HttpEntity<>(requestBody);
	}
	else {
		this.requestEntity = HttpEntity.EMPTY;
	}
}
 
Example 3
Source File: RestTemplate.java    From java-technology-stack with MIT License 5 votes vote down vote up
public HttpEntityRequestCallback(@Nullable Object requestBody, @Nullable Type responseType) {
	super(responseType);
	if (requestBody instanceof HttpEntity) {
		this.requestEntity = (HttpEntity<?>) requestBody;
	}
	else if (requestBody != null) {
		this.requestEntity = new HttpEntity<>(requestBody);
	}
	else {
		this.requestEntity = HttpEntity.EMPTY;
	}
}
 
Example 4
Source File: RestTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private HttpEntityRequestCallback(Object requestBody, Type responseType) {
	super(responseType);
	if (requestBody instanceof HttpEntity) {
		this.requestEntity = (HttpEntity<?>) requestBody;
	}
	else if (requestBody != null) {
		this.requestEntity = new HttpEntity<Object>(requestBody);
	}
	else {
		this.requestEntity = HttpEntity.EMPTY;
	}
}
 
Example 5
Source File: WxMappingHandlerMapping.java    From FastBootWeixin with Apache License 2.0 5 votes vote down vote up
public WxMappingHandlerMapping(String path, WxBuildinVerifyService wxBuildinVerifyService, WxMenuManager wxMenuManager,
                               WxSessionManager wxSessionManager, WxAsyncMessageTemplate wxAsyncMessageTemplate,
                               WxXmlMessageConverter wxXmlMessageConverter) {
    super();
    this.path = (path.startsWith("/") ? "" : "/") + path;
    this.wxVerifyMethodHandler = new HandlerMethod(wxBuildinVerifyService, WX_VERIFY_METHOD);
    this.wxMenuManager = wxMenuManager;
    this.wxSessionManager = wxSessionManager;
    this.wxAsyncHandlerFactory = new WxAsyncHandlerFactory(wxAsyncMessageTemplate);
    this.defaultHandlerMethod = new HandlerMethod((Supplier)(() -> HttpEntity.EMPTY), SUPPLIER_METHOD);
    this.setHandlerMethodMappingNamingStrategy(new WxMappingHandlerMethodNamingStrategy());
    this.wxXmlMessageConverter = wxXmlMessageConverter;
}
 
Example 6
Source File: RestTemplate.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private HttpEntityRequestCallback(Object requestBody, Type responseType) {
	super(responseType);
	if (requestBody instanceof HttpEntity) {
		this.requestEntity = (HttpEntity<?>) requestBody;
	}
	else if (requestBody != null) {
		this.requestEntity = new HttpEntity<Object>(requestBody);
	}
	else {
		this.requestEntity = HttpEntity.EMPTY;
	}
}
 
Example 7
Source File: AuthenticationStepsOperator.java    From spring-vault with Apache License 2.0 5 votes vote down vote up
private static HttpEntity<?> getEntity(HttpEntity<?> entity, Object state) {

		if (entity == null) {
			return state == null ? HttpEntity.EMPTY : new HttpEntity<>(state);
		}

		if (entity.getBody() == null && state != null) {
			return new HttpEntity<>(state, entity.getHeaders());
		}

		return entity;
	}
 
Example 8
Source File: AuthenticationStepsExecutor.java    From spring-vault with Apache License 2.0 5 votes vote down vote up
private static HttpEntity<?> getEntity(HttpEntity<?> entity, @Nullable Object state) {

		if (entity == null) {
			return state == null ? HttpEntity.EMPTY : new HttpEntity<>(state);
		}

		if (entity.getBody() == null && state != null) {
			return new HttpEntity<>(state, entity.getHeaders());
		}

		return entity;
	}