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.ResponseBuilderwithContentLength(long contentLength)Specifies the content length.ResponseBuilderwithContentType(java.lang.String contentType)Specifies the content type.ResponseBuilderwithHeader(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:ResponseBuilderSupportSets a header.- Specified by:
withHeaderin interfaceResponseBuilder<org.springframework.http.ResponseEntity<?>>- Specified by:
withHeaderin 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:ResponseBuilderSupportReturns a header response previously added.- Specified by:
getHeaderin 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:ResponseBuilderSupportSpecifies the content type.- Specified by:
withContentTypein interfaceResponseBuilder<org.springframework.http.ResponseEntity<?>>- Overrides:
withContentTypein 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:ResponseBuilderSupportSpecifies the content length.- Specified by:
withContentLengthin interfaceResponseBuilder<org.springframework.http.ResponseEntity<?>>- Overrides:
withContentLengthin 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:ResponseBuilderSupportThis method actually builds the response and must be provided by concrete subclasses.- Specified by:
doBuildin classResponseBuilderSupport<org.springframework.http.ResponseEntity<?>>- Returns:
- the response
-
-