Class SpringMvcResponseBuilder
- java.lang.Object
-
- it.tidalwave.northernwind.core.model.spi.ResponseBuilderSupport<org.springframework.http.ResponseEntity<?>>
-
- it.tidalwave.northernwind.frontend.springmvc.SpringMvcResponseBuilder
-
- All Implemented Interfaces:
ResponseBuilder<org.springframework.http.ResponseEntity<?>>
@NotThreadSafe public class SpringMvcResponseBuilder extends ResponseBuilderSupport<org.springframework.http.ResponseEntity<?>>
- Author:
- Fabrizio Giudici
-
-
Field Summary
-
Fields inherited from class it.tidalwave.northernwind.core.model.spi.ResponseBuilderSupport
body, HEADER_CACHE_CONTROL, HEADER_CONTENT_DISPOSITION, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_ETAG, HEADER_EXPIRES, HEADER_IF_MODIFIED_SINCE, HEADER_IF_NONE_MATCH, HEADER_LAST_MODIFIED, HEADER_LOCATION, httpStatus, PATTERN_RFC1123, requestIfModifiedSince, requestIfNoneMatch
-
-
Constructor Summary
Constructors Constructor Description SpringMvcResponseBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.http.ResponseEntity<?>
doBuild()
This method actually builds the response and must be provided by concrete subclasses.protected java.util.Optional<java.lang.String>
getHeader(java.lang.String header)
Returns a header response previously added.ResponseBuilder
withContentLength(long contentLength)
Specifies the content length.ResponseBuilder
withContentType(java.lang.String contentType)
Specifies the content type.ResponseBuilder
withHeader(java.lang.String header, java.lang.String value)
Sets a header.-
Methods inherited from class it.tidalwave.northernwind.core.model.spi.ResponseBuilderSupport
build, cacheSupport, forException, forException, forException, forRequest, fromFile, getDateTimeHeader, permanentRedirect, put, withBody, withContentDisposition, withExpirationTime, withHeaders, withLatestModifiedTime, withStatus
-
-
-
-
Method Detail
-
withHeader
@Nonnull public ResponseBuilder withHeader(@Nonnull java.lang.String header, @Nonnull java.lang.String value)
Description copied from class:ResponseBuilderSupport
Sets a header.- Specified by:
withHeader
in interfaceResponseBuilder<org.springframework.http.ResponseEntity<?>>
- Specified by:
withHeader
in classResponseBuilderSupport<org.springframework.http.ResponseEntity<?>>
- Parameters:
header
- the header namevalue
- the header value- Returns:
- itself for fluent interface style
-
getHeader
@Nonnull protected java.util.Optional<java.lang.String> getHeader(@Nonnull java.lang.String header)
Description copied from class:ResponseBuilderSupport
Returns a header response previously added.- Specified by:
getHeader
in classResponseBuilderSupport<org.springframework.http.ResponseEntity<?>>
- Parameters:
header
- the header name- Returns:
- the header value
-
withContentType
@Nonnull public ResponseBuilder withContentType(@Nonnull java.lang.String contentType)
Description copied from class:ResponseBuilderSupport
Specifies the content type.- Specified by:
withContentType
in interfaceResponseBuilder<org.springframework.http.ResponseEntity<?>>
- Overrides:
withContentType
in classResponseBuilderSupport<org.springframework.http.ResponseEntity<?>>
- Parameters:
contentType
- the content type- Returns:
- itself for fluent interface style
-
withContentLength
@Nonnull public ResponseBuilder withContentLength(@Nonnegative long contentLength)
Description copied from class:ResponseBuilderSupport
Specifies the content length.- Specified by:
withContentLength
in interfaceResponseBuilder<org.springframework.http.ResponseEntity<?>>
- Overrides:
withContentLength
in classResponseBuilderSupport<org.springframework.http.ResponseEntity<?>>
- Parameters:
contentLength
- the content length- Returns:
- itself for fluent interface style
-
doBuild
@Nonnull protected org.springframework.http.ResponseEntity<?> doBuild()
Description copied from class:ResponseBuilderSupport
This method actually builds the response and must be provided by concrete subclasses.- Specified by:
doBuild
in classResponseBuilderSupport<org.springframework.http.ResponseEntity<?>>
- Returns:
- the response
-
-