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.http.response; 018 019import static org.apache.juneau.http.response.Processing.*; 020 021import java.net.*; 022import java.util.*; 023 024import org.apache.http.*; 025import org.apache.http.Header; 026import org.apache.juneau.annotation.*; 027import org.apache.juneau.http.*; 028import org.apache.juneau.http.annotation.*; 029import org.apache.juneau.http.header.*; 030import org.apache.juneau.internal.*; 031 032/** 033 * Represents an <c>HTTP 102 Processing</c> response. 034 * 035 * <p> 036 * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request. 037 * This code indicates that the server has received and is processing the request, but no response is available yet. 038 * This prevents the client from timing out and assuming the request was lost. 039 * 040 * <h5 class='section'>See Also:</h5><ul> 041 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauRestCommonBasics">juneau-rest-common Basics</a> 042 * </ul> 043 */ 044@Response 045@StatusCode(STATUS_CODE) 046@Schema(description=REASON_PHRASE) 047public class Processing extends BasicHttpResponse { 048 049 /** HTTP status code */ 050 public static final int STATUS_CODE = 102; 051 052 /** Reason phrase */ 053 public static final String REASON_PHRASE = "Processing"; 054 055 /** Default status line */ 056 private static final BasicStatusLine STATUS_LINE = BasicStatusLine.create(STATUS_CODE, REASON_PHRASE); 057 058 /** Default unmodifiable instance */ 059 public static final Processing INSTANCE = new Processing().setUnmodifiable(); 060 061 /** 062 * Constructor. 063 */ 064 public Processing() { 065 super(STATUS_LINE); 066 } 067 068 /** 069 * Copy constructor. 070 * 071 * @param copyFrom The bean to copy from. 072 */ 073 public Processing(Processing copyFrom) { 074 super(copyFrom); 075 } 076 077 /** 078 * Constructor. 079 * 080 * <p> 081 * This is the constructor used when parsing an HTTP response. 082 * 083 * @param response The HTTP response to copy from. Must not be <jk>null</jk>. 084 * @throws AssertionError If HTTP response status code does not match what was expected. 085 */ 086 public Processing(HttpResponse response) { 087 super(response); 088 assertStatusCode(response); 089 } 090 091 /** 092 * Creates a builder for this class initialized with the contents of this bean. 093 * 094 * @return A new builder bean. 095 */ 096 public Processing copy() { 097 return new Processing(this); 098 } 099 @Override /* Overridden from BasicHttpResponse */ 100 public Processing setContent(String value) { 101 super.setContent(value); 102 return this; 103 } 104 105 @Override /* Overridden from BasicHttpResponse */ 106 public Processing setContent(HttpEntity value) { 107 super.setContent(value); 108 return this; 109 } 110 111 @Override /* Overridden from BasicHttpResponse */ 112 public Processing setHeader2(Header value) { 113 super.setHeader2(value); 114 return this; 115 } 116 117 @Override /* Overridden from BasicHttpResponse */ 118 public Processing setHeader2(String name, String value) { 119 super.setHeader2(name, value); 120 return this; 121 } 122 123 @Override /* Overridden from BasicHttpResponse */ 124 public Processing setHeaders(List<Header> values) { 125 super.setHeaders(values); 126 return this; 127 } 128 129 @Override /* Overridden from BasicHttpResponse */ 130 public Processing setHeaders(HeaderList value) { 131 super.setHeaders(value); 132 return this; 133 } 134 135 @Override /* Overridden from BasicHttpResponse */ 136 public Processing setHeaders2(Header...values) { 137 super.setHeaders2(values); 138 return this; 139 } 140 141 @Override /* Overridden from BasicHttpResponse */ 142 public Processing setLocale2(Locale value) { 143 super.setLocale2(value); 144 return this; 145 } 146 147 @Override /* Overridden from BasicHttpResponse */ 148 public Processing setLocation(String value) { 149 super.setLocation(value); 150 return this; 151 } 152 153 @Override /* Overridden from BasicHttpResponse */ 154 public Processing setLocation(URI value) { 155 super.setLocation(value); 156 return this; 157 } 158 159 @Override /* Overridden from BasicHttpResponse */ 160 public Processing setProtocolVersion(ProtocolVersion value) { 161 super.setProtocolVersion(value); 162 return this; 163 } 164 165 @Override /* Overridden from BasicHttpResponse */ 166 public Processing setReasonPhrase2(String value) { 167 super.setReasonPhrase2(value); 168 return this; 169 } 170 171 @Override /* Overridden from BasicHttpResponse */ 172 public Processing setReasonPhraseCatalog(ReasonPhraseCatalog value) { 173 super.setReasonPhraseCatalog(value); 174 return this; 175 } 176 177 @Override /* Overridden from BasicHttpResponse */ 178 public Processing setStatusCode2(int value) { 179 super.setStatusCode2(value); 180 return this; 181 } 182 183 @Override /* Overridden from BasicHttpResponse */ 184 public Processing setStatusLine(BasicStatusLine value) { 185 super.setStatusLine(value); 186 return this; 187 } 188 189 @Override /* Overridden from BasicHttpResponse */ 190 public Processing setUnmodifiable() { 191 super.setUnmodifiable(); 192 return this; 193 } 194}