001/* 002 * oauth2-oidc-sdk 003 * 004 * Copyright 2012-2016, Connect2id Ltd and contributors. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 007 * this file except in compliance with the License. You may obtain a copy of the 008 * License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software distributed 013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 015 * specific language governing permissions and limitations under the License. 016 */ 017 018package com.nimbusds.oauth2.sdk.http; 019 020 021import javax.mail.internet.ContentType; 022 023import net.jcip.annotations.Immutable; 024 025 026/** 027 * Resource with optional associated content type. 028 */ 029@Immutable 030@Deprecated 031public class Resource { 032 033 034 /** 035 * The content. 036 */ 037 private final String content; 038 039 040 /** 041 * The content type. 042 */ 043 private final ContentType contentType; 044 045 046 /** 047 * Creates a new resource with optional associated content type. 048 * 049 * @param content The resource content, empty string if none. Must 050 * not be {@code null}. 051 * @param contentType The resource content type, {@code null} if not 052 * specified. 053 */ 054 public Resource(final String content, final ContentType contentType) { 055 056 if (content == null) { 057 throw new IllegalArgumentException("The resource content must not be null"); 058 } 059 060 this.content = content; 061 this.contentType = contentType; 062 } 063 064 065 /** 066 * Gets the content of this resource. 067 * 068 * @return The content, empty string if none. 069 */ 070 public String getContent() { 071 072 return content; 073 } 074 075 076 /** 077 * Gets the content type of this resource. 078 * 079 * @return The content type, {@code null} if not specified. 080 */ 081 public ContentType getContentType() { 082 083 return contentType; 084 } 085}