001    package railo.runtime.rest;
002    
003    
004    import java.util.List;
005    
006    import railo.commons.lang.mimetype.MimeType;
007    import railo.runtime.type.Struct;
008    
009    public class Result {
010    
011            private final Source source;
012            private final String[] path;
013            private final Struct variables;
014            private final int format;
015            private final Struct matrix;
016            private Struct rsp;
017            private final List<MimeType> accept;
018            private final MimeType contentType;
019            private final boolean hasFormatExtension;
020    
021            public Result(Source source, Struct variables, String[] path,  Struct matrix,int format,boolean hasFormatExtension,List<MimeType> accept,MimeType contentType) {
022                    this.source=source;
023                    this.variables=variables;
024                    this.path=path;
025                    this.format=format;
026                    this.matrix=matrix;
027                    this.hasFormatExtension=hasFormatExtension;
028                    this.accept=accept;
029                    this.contentType=contentType;
030            }
031    
032            /**
033             * @return the hasFormatExtension
034             */
035            public boolean hasFormatExtension() {
036                    return hasFormatExtension;
037            }
038    
039            /**
040             * @return the accept
041             */
042            public MimeType[] getAccept() {
043                    return accept.toArray(new MimeType[accept.size()]);
044            }
045    
046            /**
047             * @return the accept
048             */
049            public MimeType getContentType() {
050                    return contentType==null?MimeType.ALL:contentType;
051            }
052    
053            /**
054             * @return the variables
055             */
056            public Struct getVariables() {
057                    return variables;
058            }
059    
060            /**
061             * @return the source
062             */
063            public Source getSource() {
064                    return source;
065            }
066    
067            /**
068             * @return the path
069             */
070            public String[] getPath() {
071                    return path;
072            }
073    
074            /**
075             * @return the format
076             */
077            public int getFormat() {
078                    return format;
079            }
080    
081            /**
082             * @return the matrix
083             */
084            public Struct getMatrix() {
085                    return matrix;
086            }
087    
088            public void setCustomResponse(Struct rsp) {
089                    this.rsp=rsp;
090            }
091            public Struct getCustomResponse() {
092                    return rsp;
093            }
094    
095    }