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         * Do nothing constructor for Spring
023         */
024        public JStachioProperties() {
025        }
026
027        /**
028         * Because JStachio does pre-encoding of templates it can handle buffering the
029         * template output better than the builtin servlet framework buffering while reliably
030         * setting the <code>Content-Length</code>. If the servlet frameworks buffer is set
031         * higher than this value it will be used as the limit instead.
032         * @return the buffer limit in number of bytes which by default is
033         * "{@value JStachioHttpMessageConverter#DEFAULT_BUFFER_LIMIT}".
034         */
035        public int getBufferLimit() {
036                return bufferLimit;
037        }
038
039        /**
040         * See {@link #getBufferLimit()}
041         * @param bufferLimit a zero or negative number will disable buffering.
042         */
043        public void setBufferLimit(int bufferLimit) {
044                this.bufferLimit = bufferLimit;
045        }
046
047        /**
048         * The media type which by default is "<code>text/html; charset=UTF-8</code>". If the
049         * charset is not in the media type than UTF-8 will be used.
050         * @return media type ideally with charset.
051         */
052        @SuppressWarnings("exports")
053        public MediaType getMediaType() {
054                return mediaType;
055        }
056
057        /**
058         * See {@link #getMediaType()}
059         * @param mediaType media type ideally with charset.
060         */
061        public void setMediaType(@SuppressWarnings("exports") MediaType mediaType) {
062                this.mediaType = mediaType;
063        }
064
065}