001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.rest.beans;
018
019import java.net.*;
020import java.util.*;
021
022import org.apache.http.*;
023import org.apache.http.Header;
024import org.apache.juneau.annotation.*;
025import org.apache.juneau.http.*;
026import org.apache.juneau.http.annotation.*;
027import org.apache.juneau.http.header.*;
028import org.apache.juneau.http.response.*;
029
030/**
031 * Convenience subclass of {@link SeeOther} for redirecting a response to the servlet root.
032 *
033 * <h5 class='section'>See Also:</h5><ul>
034 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/UtilityBeans">Utility Beans</a>
035 * </ul>
036 */
037@Response
038@Schema(description = "Redirect to servlet root")
039public class SeeOtherRoot extends SeeOther {
040
041   /**
042    * Reusable instance.
043    */
044   public static final SeeOtherRoot INSTANCE = new SeeOtherRoot();
045
046   /**
047    * Constructor.
048    */
049   public SeeOtherRoot() {
050      setLocation("servlet:/");
051   }
052
053   /**
054    * Copy constructor.
055    *
056    * @param copyFrom The object to copy.
057    */
058   public SeeOtherRoot(SeeOtherRoot copyFrom) {
059      super(copyFrom);
060   }
061
062   /**
063    * Constructor with no redirect.
064    * <p>
065    * Used for end-to-end interfaces.
066    *
067    * @param content Message to send as the response.
068    */
069   public SeeOtherRoot(String content) {
070      setLocation("servlet:/");
071      setContent(content);
072   }
073
074   @Override /* Overridden from SeeOther */
075   public SeeOtherRoot copy() {
076      return new SeeOtherRoot(this);
077   }
078
079   @Override /* Overridden from SeeOther */
080   public SeeOtherRoot setContent(HttpEntity value) {
081      super.setContent(value);
082      return this;
083   }
084
085   @Override /* Overridden from SeeOther */
086   public SeeOtherRoot setContent(String value) {
087      super.setContent(value);
088      return this;
089   }
090
091   @Override /* Overridden from SeeOther */
092   public SeeOtherRoot setHeader2(Header value) {
093      super.setHeader2(value);
094      return this;
095   }
096
097   @Override /* Overridden from SeeOther */
098   public SeeOtherRoot setHeader2(String name, String value) {
099      super.setHeader2(name, value);
100      return this;
101   }
102
103   @Override /* Overridden from SeeOther */
104   public SeeOtherRoot setHeaders(HeaderList value) {
105      super.setHeaders(value);
106      return this;
107   }
108
109   @Override /* Overridden from SeeOther */
110   public SeeOtherRoot setHeaders(List<Header> values) {
111      super.setHeaders(values);
112      return this;
113   }
114
115   @Override /* Overridden from SeeOther */
116   public SeeOtherRoot setHeaders2(Header...values) {
117      super.setHeaders2(values);
118      return this;
119   }
120
121   @Override /* Overridden from SeeOther */
122   public SeeOtherRoot setLocale2(Locale value) {
123      super.setLocale2(value);
124      return this;
125   }
126
127   @Override /* Overridden from SeeOther */
128   public SeeOtherRoot setLocation(String value) {
129      super.setLocation(value);
130      return this;
131   }
132
133   @Override /* Overridden from SeeOther */
134   public SeeOtherRoot setLocation(URI value) {
135      super.setLocation(value);
136      return this;
137   }
138
139   @Override /* Overridden from SeeOther */
140   public SeeOtherRoot setProtocolVersion(ProtocolVersion value) {
141      super.setProtocolVersion(value);
142      return this;
143   }
144
145   @Override /* Overridden from SeeOther */
146   public SeeOtherRoot setReasonPhrase2(String value) {
147      super.setReasonPhrase2(value);
148      return this;
149   }
150
151   @Override /* Overridden from SeeOther */
152   public SeeOtherRoot setReasonPhraseCatalog(ReasonPhraseCatalog value) {
153      super.setReasonPhraseCatalog(value);
154      return this;
155   }
156
157   @Override /* Overridden from SeeOther */
158   public SeeOtherRoot setStatusCode2(int value) {
159      super.setStatusCode2(value);
160      return this;
161   }
162
163   @Override /* Overridden from SeeOther */
164   public SeeOtherRoot setStatusLine(BasicStatusLine value) {
165      super.setStatusLine(value);
166      return this;
167   }
168
169   @Override /* Overridden from SeeOther */
170   public SeeOtherRoot setUnmodifiable() {
171      super.setUnmodifiable();
172      return this;
173   }
174}