001package com.nimbusds.oauth2.sdk.http;
002
003
004import javax.mail.internet.ContentType;
005
006import net.jcip.annotations.Immutable;
007
008
009/**
010 * Resource with optional associated content type.
011 */
012@Immutable
013@Deprecated
014public class Resource {
015
016
017        /**
018         * The content.
019         */
020        private final String content;
021
022
023        /**
024         * The content type.
025         */
026        private final ContentType contentType;
027
028
029        /**
030         * Creates a new resource with optional associated content type.
031         *
032         * @param content     The resource content, empty string if none. Must 
033         *                    not be {@code null}.
034         * @param contentType The resource content type, {@code null} if not
035         *                    specified.
036         */
037        public Resource(final String content, final ContentType contentType) {
038
039                if (content == null) {
040                        throw new IllegalArgumentException("The resource content must not be null");
041                }
042
043                this.content = content;
044                this.contentType = contentType;
045        }
046
047
048        /**
049         * Gets the content of this resource.
050         *
051         * @return The content, empty string if none.
052         */
053        public String getContent() {
054
055                return content;
056        }
057
058
059        /**
060         * Gets the content type of this resource.
061         *
062         * @return The content type, {@code null} if not specified.
063         */
064        public ContentType getContentType() {
065
066                return contentType;
067        }
068}