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.*; 030 031/** 032 * Represents an <c>HTTP 102 Processing</c> response. 033 * 034 * <p> 035 * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request. 036 * This code indicates that the server has received and is processing the request, but no response is available yet. 037 * This prevents the client from timing out and assuming the request was lost. 038 * 039 * <h5 class='section'>See Also:</h5><ul> 040 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauRestCommonBasics">juneau-rest-common Basics</a> 041 * </ul> 042 */ 043@Response 044@StatusCode(STATUS_CODE) 045@Schema(description = REASON_PHRASE) 046public class Processing extends BasicHttpResponse { 047 048 /** HTTP status code */ 049 public static final int STATUS_CODE = 102; 050 051 /** Reason phrase */ 052 public static final String REASON_PHRASE = "Processing"; 053 054 /** Default status line */ 055 private static final BasicStatusLine STATUS_LINE = BasicStatusLine.create(STATUS_CODE, REASON_PHRASE); 056 057 /** Default unmodifiable instance */ 058 public static final Processing INSTANCE = new Processing().setUnmodifiable(); 059 060 /** 061 * Constructor. 062 */ 063 public Processing() { 064 super(STATUS_LINE); 065 } 066 067 /** 068 * Constructor. 069 * 070 * <p> 071 * This is the constructor used when parsing an HTTP response. 072 * 073 * @param response The HTTP response to copy from. Must not be <jk>null</jk>. 074 * @throws AssertionError If HTTP response status code does not match what was expected. 075 */ 076 public Processing(HttpResponse response) { 077 super(response); 078 assertStatusCode(response); 079 } 080 081 /** 082 * Copy constructor. 083 * 084 * @param copyFrom The bean to copy from. 085 */ 086 public Processing(Processing copyFrom) { 087 super(copyFrom); 088 } 089 090 /** 091 * Creates a builder for this class initialized with the contents of this bean. 092 * 093 * @return A new builder bean. 094 */ 095 public Processing copy() { 096 return new Processing(this); 097 } 098 099 @Override /* Overridden from BasicHttpResponse */ 100 public Processing setContent(HttpEntity value) { 101 super.setContent(value); 102 return this; 103 } 104 105 @Override /* Overridden from BasicHttpResponse */ 106 public Processing setContent(String 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(HeaderList value) { 125 super.setHeaders(value); 126 return this; 127 } 128 129 @Override /* Overridden from BasicHttpResponse */ 130 public Processing setHeaders(List<Header> values) { 131 super.setHeaders(values); 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}