001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.http.response;
014
015import static org.apache.juneau.http.response.NotModified.*;
016
017import org.apache.juneau.http.annotation.*;
018
019/**
020 * Represents an <c>HTTP 304 Not Modified</c> response.
021 *
022 * <p>
023 * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.
024 * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
025 */
026@Response(code=CODE, description=MESSAGE)
027public class NotModified extends HttpResponse {
028
029   /** HTTP status code */
030   public static final int CODE = 304;
031
032   /** Default message */
033   public static final String MESSAGE = "Not Modified";
034
035   /** Reusable instance. */
036   public static final NotModified INSTANCE = new NotModified();
037
038   /**
039    * Constructor using HTTP-standard message.
040    */
041   public NotModified() {
042      this(MESSAGE);
043   }
044
045   /**
046    * Constructor using custom message.
047    * @param message Message to send as the response.
048    */
049   public NotModified(String message) {
050      super(message);
051   }
052
053   //------------------------------------------------------------------------------------------------------------------
054   // Fluent setters.
055   //------------------------------------------------------------------------------------------------------------------
056
057   // <FluentSetters>
058
059   @Override /* GENERATED - HttpResponse */
060   public NotModified header(String name, Object val) {
061      super.header(name, val);
062      return this;
063   }
064
065   // </FluentSetters>
066}