Java Code Examples for org.springframework.core.codec.Hints#none()

The following examples show how to use org.springframework.core.codec.Hints#none() . 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: Jackson2CodecSupport.java    From spring-analysis-note with MIT License 5 votes vote down vote up
protected Map<String, Object> getHints(ResolvableType resolvableType) {
	MethodParameter param = getParameter(resolvableType);
	if (param != null) {
		JsonView annotation = getAnnotation(param, JsonView.class);
		if (annotation != null) {
			Class<?>[] classes = annotation.value();
			Assert.isTrue(classes.length == 1, JSON_VIEW_HINT_ERROR + param);
			return Hints.from(JSON_VIEW_HINT, classes[0]);
		}
	}
	return Hints.none();
}
 
Example 2
Source File: ResourceHttpMessageReader.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected Map<String, Object> getReadHints(ResolvableType actualType, ResolvableType elementType,
		ServerHttpRequest request, ServerHttpResponse response) {

	String name = request.getHeaders().getContentDisposition().getFilename();
	return StringUtils.hasText(name) ? Hints.from(ResourceDecoder.FILENAME_HINT, name) : Hints.none();
}
 
Example 3
Source File: Jackson2CodecSupport.java    From java-technology-stack with MIT License 5 votes vote down vote up
protected Map<String, Object> getHints(ResolvableType resolvableType) {
	MethodParameter param = getParameter(resolvableType);
	if (param != null) {
		JsonView annotation = getAnnotation(param, JsonView.class);
		if (annotation != null) {
			Class<?>[] classes = annotation.value();
			Assert.isTrue(classes.length == 1, JSON_VIEW_HINT_ERROR + param);
			return Hints.from(JSON_VIEW_HINT, classes[0]);
		}
	}
	return Hints.none();
}
 
Example 4
Source File: AbstractJackson2Encoder.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public Map<String, Object> getEncodeHints(@Nullable ResolvableType actualType, ResolvableType elementType,
		@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {

	return (actualType != null ? getHints(actualType) : Hints.none());
}
 
Example 5
Source File: AbstractJackson2Encoder.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public Map<String, Object> getEncodeHints(@Nullable ResolvableType actualType, ResolvableType elementType,
		@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {

	return (actualType != null ? getHints(actualType) : Hints.none());
}
 
Example 6
Source File: HttpMessageEncoder.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Get decoding hints based on the server request or annotations on the
 * target controller method parameter.
 * @param actualType the actual source type to encode, possibly a reactive
 * wrapper and sourced from {@link org.springframework.core.MethodParameter},
 * i.e. providing access to method annotations.
 * @param elementType the element type within {@code Flux/Mono} that we're
 * trying to encode.
 * @param request the current request
 * @param response the current response
 * @return a Map with hints, possibly empty
 */
default Map<String, Object> getEncodeHints(ResolvableType actualType, ResolvableType elementType,
		@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {

	return Hints.none();
}
 
Example 7
Source File: HttpMessageEncoder.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Get decoding hints based on the server request or annotations on the
 * target controller method parameter.
 * @param actualType the actual source type to encode, possibly a reactive
 * wrapper and sourced from {@link org.springframework.core.MethodParameter},
 * i.e. providing access to method annotations.
 * @param elementType the element type within {@code Flux/Mono} that we're
 * trying to encode.
 * @param request the current request
 * @param response the current response
 * @return a Map with hints, possibly empty
 */
default Map<String, Object> getEncodeHints(ResolvableType actualType, ResolvableType elementType,
		@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {

	return Hints.none();
}