001package io.jstach.opt.spring.boot.webmvc;
002
003import org.springframework.boot.context.properties.ConfigurationProperties;
004import org.springframework.http.MediaType;
005
006import io.jstach.opt.spring.web.JStachioHttpMessageConverter;
007
008/**
009 * {@link ConfigurationProperties @ConfigurationProperties} for JStachio.
010 *
011 * @author agentgt
012 *
013 */
014@ConfigurationProperties(prefix = "spring.jstachio.webmvc")
015public class JStachioProperties {
016
017        private int bufferLimit = JStachioHttpMessageConverter.DEFAULT_BUFFER_LIMIT;
018
019        private MediaType mediaType = JStachioHttpMessageConverter.DEFAULT_MEDIA_TYPE;
020
021        /**
022         * Because JStachio does pre-encoding of templates it can handle buffering the
023         * template output better than the builtin servlet framework buffering while reliable
024         * setting the <code>Content-Length</code>. If the servlet frameworks buffer is set
025         * higher than this value it will be used as the limit instead.
026         * @return the buffer limit in number of bytes which by default is
027         * "{@value JStachioHttpMessageConverter#DEFAULT_BUFFER_LIMIT}".
028         */
029        public int getBufferLimit() {
030                return bufferLimit;
031        }
032
033        /**
034         * See {@link #getBufferLimit()}
035         * @param bufferLimit a zero or negative number will disable buffering.
036         */
037        public void setBufferLimit(int bufferLimit) {
038                this.bufferLimit = bufferLimit;
039        }
040
041        /**
042         * The media type which by default is "<code>text/html; charset=UTF-8</code>". If the
043         * charset is not in the media type than UTF-8 will be used.
044         * @return media type ideally with charset.
045         */
046        @SuppressWarnings("exports")
047        public MediaType getMediaType() {
048                return mediaType;
049        }
050
051        /**
052         * See {@link #getMediaType()}
053         * @param mediaType media type ideally with charset.
054         */
055        public void setMediaType(@SuppressWarnings("exports") MediaType mediaType) {
056                this.mediaType = mediaType;
057        }
058
059}