Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D96FE200C7E for ; Mon, 8 May 2017 17:33:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D7E6A160BA5; Mon, 8 May 2017 15:33:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5D5F4160B99 for ; Mon, 8 May 2017 17:32:59 +0200 (CEST) Received: (qmail 18532 invoked by uid 500); 8 May 2017 15:32:58 -0000 Mailing-List: contact commits-help@juneau.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@juneau.incubator.apache.org Delivered-To: mailing list commits@juneau.incubator.apache.org Received: (qmail 18518 invoked by uid 99); 8 May 2017 15:32:56 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 May 2017 15:32:56 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 5B15EC030F for ; Mon, 8 May 2017 15:32:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.022 X-Spam-Level: X-Spam-Status: No, score=-3.022 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LINEPADDING=1.2, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id MzJDKaDQ5xaA for ; Mon, 8 May 2017 15:32:40 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 7C03C60EC8 for ; Mon, 8 May 2017 15:32:33 +0000 (UTC) Received: (qmail 17034 invoked by uid 99); 8 May 2017 15:32:32 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 May 2017 15:32:32 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C9008F1596; Mon, 8 May 2017 15:32:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: jamesbognar@apache.org To: commits@juneau.incubator.apache.org Date: Mon, 08 May 2017 15:32:50 -0000 Message-Id: <6fa86ceae8a547a9961fcf6afdda57e6@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [20/51] [partial] incubator-juneau-website git commit: Support for passing in more class types to REST methods. archived-at: Mon, 08 May 2017 15:33:02 -0000 http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/f1f17bc3/content/site/apidocs/src-html/org/apache/juneau/http/ContentRange.html ---------------------------------------------------------------------- diff --git a/content/site/apidocs/src-html/org/apache/juneau/http/ContentRange.html b/content/site/apidocs/src-html/org/apache/juneau/http/ContentRange.html new file mode 100644 index 0000000..1586ea6 --- /dev/null +++ b/content/site/apidocs/src-html/org/apache/juneau/http/ContentRange.html @@ -0,0 +1,198 @@ + + + +Source code + + + +
+
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;
+014
+015/**
+016 * Represents a parsed <l>Content-Range</l> HTTP response header.
+017 * <p>
+018 * Where in a full body message this partial message belongs.
+019 *
+020 * <h6 class='figure'>Example</h6>
+021 * <p class='bcode'>
+022 *    Content-Range: bytes 21010-47021/47022
+023 * </p>
+024 *
+025 * <h6 class='topic'>RFC2616 Specification</h6>
+026 * The Content-Range entity-header is sent with a partial entity-body to specify where in the full entity-body the
+027 * partial body should be applied.
+028 * Range units are defined in section 3.12.
+029 * <p class='bcode'>
+030 *    Content-Range = "Content-Range" ":" content-range-spec
+031 *    content-range-spec      = byte-content-range-spec
+032 *    byte-content-range-spec = bytes-unit SP
+033 *                              byte-range-resp-spec "/"
+034 *                              ( instance-length | "*" )
+035 *    byte-range-resp-spec = (first-byte-pos "-" last-byte-pos)
+036 *                                   | "*"
+037 *    instance-length           = 1*DIGIT
+038 * </p>
+039 * <p>
+040 * The header SHOULD indicate the total length of the full entity-body, unless this length is unknown or difficult to
+041 * determine.
+042 * The asterisk "*" character means that the instance-length is unknown at the time when the response was generated.
+043 * <p>
+044 * Unlike byte-ranges-specifier values (see section 14.35.1), a byte- range-resp-spec MUST only specify one range, and
+045 * MUST contain absolute byte positions for both the first and last byte of the range.
+046 * <p>
+047 * A byte-content-range-spec with a byte-range-resp-spec whose last- byte-pos value is less than its first-byte-pos
+048 * value, or whose instance-length value is less than or equal to its last-byte-pos value, is invalid.
+049 * The recipient of an invalid byte-content-range- spec MUST ignore it and any content transferred along with it.
+050 * <p>
+051 * A server sending a response with status code 416 (Requested range not satisfiable) SHOULD include a Content-Range
+052 * field with a byte-range- resp-spec of "*".
+053 * The instance-length specifies the current length of the selected resource.
+054 * A response with status code 206 (Partial Content) MUST NOT include a Content-Range field with a byte-range-resp-spec
+055 * of "*".
+056 * <p>
+057 * Examples of byte-content-range-spec values, assuming that the entity contains a total of 1234 bytes:
+058 * <p class='bcode'>
+059 *    The first 500 bytes:
+060 *     bytes 0-499/1234
+061 *    The second 500 bytes:
+062 *     bytes 500-999/1234
+063 *    All except for the first 500 bytes:
+064 *     bytes 500-1233/1234
+065 *    The last 500 bytes:
+066 *     bytes 734-1233/1234
+067 * </p>
+068 * <p>
+069 * When an HTTP message includes the content of a single range (for example, a response to a request for a single range,
+070 * or to a request for a set of ranges that overlap without any holes), this content is transmitted with a Content-Range
+071 * header, and a Content-Length header showing the number of bytes actually transferred.
+072 * For example:
+073 * <p class='bcode'>
+074 *    HTTP/1.1 206 Partial content
+075 *    Date: Wed, 15 Nov 1995 06:25:24 GMT
+076 *    Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
+077 *    Content-Range: bytes 21010-47021/47022
+078 *    Content-Length: 26012
+079 *    Content-Type: image/gif
+080 * </p>
+081 * <p>
+082 * When an HTTP message includes the content of multiple ranges (for example, a response to a request for multiple
+083 * non-overlapping ranges), these are transmitted as a multipart message.
+084 * The multipart media type used for this purpose is "multipart/byteranges" as defined in appendix 19.2.
+085 * See appendix 19.6.3 for a compatibility issue.
+086 * <p>
+087 * A response to a request for a single range MUST NOT be sent using the multipart/byteranges media type.
+088 * A response to a request for multiple ranges, whose result is a single range, MAY be sent as a multipart/byteranges
+089 * media type with one part.
+090 * A client that cannot decode a multipart/byteranges message MUST NOT ask for multiple byte-ranges in a single request.
+091 * <p>
+092 * When a client requests multiple byte-ranges in one request, the server SHOULD return them in the order that they
+093 * appeared in the request.
+094 * <p>
+095 * If the server ignores a byte-range-spec because it is syntactically invalid, the server SHOULD treat the request as
+096 * if the invalid Range header field did not exist.
+097 * (Normally, this means return a 200 response containing the full entity).
+098 * <p>
+099 * If the server receives a request (other than one including an If- Range request-header field) with an unsatisfiable
+100 * Range request- header field
+101 * (that is, all of whose byte-range-spec values have a first-byte-pos value greater than the current length of the
+102 * selected resource),
+103 * it SHOULD return a response code of 416 (Requested range not satisfiable) (section 10.4.17).
+104 * <p>
+105 * Note: clients cannot depend on servers to send a 416 (Requested range not satisfiable) response instead of a 200 (OK)
+106 * response for
+107 * an unsatisfiable Range request-header, since not all servers implement this request-header.
+108 */
+109public final class ContentRange extends HeaderString {
+110
+111   /**
+112    * Returns a parsed <code>Content-Range</code> header.
+113    *
+114    * @param value The <code>Content-Range</code> header string.
+115    * @return The parsed <code>Content-Range</code> header, or <jk>null</jk> if the string was null.
+116    */
+117   public static ContentRange forString(String value) {
+118      if (value == null)
+119         return null;
+120      return new ContentRange(value);
+121   }
+122
+123   private ContentRange(String value) {
+124      super(value);
+125   }
+126}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/f1f17bc3/content/site/apidocs/src-html/org/apache/juneau/http/ContentType.html ---------------------------------------------------------------------- diff --git a/content/site/apidocs/src-html/org/apache/juneau/http/ContentType.html b/content/site/apidocs/src-html/org/apache/juneau/http/ContentType.html index 36dcfa2..676e664 100644 --- a/content/site/apidocs/src-html/org/apache/juneau/http/ContentType.html +++ b/content/site/apidocs/src-html/org/apache/juneau/http/ContentType.html @@ -20,88 +20,86 @@ 012// *************************************************************************************************************************** 013package org.apache.juneau.http; 014 -015import java.util.concurrent.*; +015import static org.apache.juneau.http.Constants.*; 016 -017/** -018 * Represents a parsed <code>Content-Type:</code> HTTP header. -019 * <p> -020 * The formal RFC2616 header field definition is as follows: -021 * <p class='bcode'> -022 * 14.17 Content-Type +017import org.apache.juneau.internal.*; +018 +019/** +020 * Represents a parsed <l>Content-Type</l> HTTP request/response header. +021 * <p> +022 * The MIME type of this content. 023 * -024 * The Content-Type entity-header field indicates the media type of the -025 * entity-body sent to the recipient or, in the case of the HEAD method, -026 * the media type that would have been sent had the request been a GET. -027 * -028 * Content-Type = "Content-Type" ":" media-type -029 * -030 * Media types are defined in section 3.7. An example of the field is -031 * -032 * Content-Type: text/html; charset=ISO-8859-4 -033 * </p> -034 */ -035public class ContentType extends MediaType { -036 -037 private static final boolean nocache = Boolean.getBoolean("juneau.http.ContentType.nocache"); -038 private static final ConcurrentHashMap<String,ContentType> cache = new ConcurrentHashMap<String,ContentType>(); -039 -040 /** -041 * Returns a parsed <code>Content-Type</code> header. -042 * -043 * @param s The <code>Content-Type</code> header string. -044 * @return The parsed <code>Content-Type</code> header, or <jk>null</jk> if the string was null. -045 */ -046 public static ContentType forString(String s) { -047 if (s == null) -048 return null; -049 -050 // Prevent OOM in case of DDOS -051 if (cache.size() > 1000) -052 cache.clear(); -053 -054 while (true) { -055 ContentType mt = cache.get(s); -056 if (mt != null) -057 return mt; -058 mt = new ContentType(s); -059 if (nocache) -060 return mt; -061 cache.putIfAbsent(s, mt); -062 } -063 } -064 -065 private ContentType(String s) { -066 super(s); -067 } -068 -069 /** -070 * Given a list of media types, returns the best match for this <code>Content-Type</code> header. -071 * <p> -072 * Note that fuzzy matching is allowed on the media types where the <code>Content-Types</code> header may -073 * contain additional subtype parts. -074 * <br>For example, given a <code>Content-Type</code> value of <js>"text/json+activity"</js>, -075 * the media type <js>"text/json"</js> will match if <js>"text/json+activity"</js> or <js>"text/activity+json"</js> -076 * isn't found. -077 * <br>The purpose for this is to allow parsers to match when artifacts such as <code>id</code> properties are present -078 * in the header. -079 * -080 * @param mediaTypes The media types to match against. -081 * @return The index into the array of the best match, or <code>-1</code> if no suitable matches could be found. -082 */ -083 public int findMatch(MediaType[] mediaTypes) { -084 int matchQuant = 0, matchIndex = -1; -085 -086 for (int i = 0; i < mediaTypes.length; i++) { -087 MediaType mt = mediaTypes[i]; -088 int matchQuant2 = mt.match(this); -089 if (matchQuant2 > matchQuant) { -090 matchIndex = i; -091 } -092 } -093 -094 return matchIndex; -095 } -096} +024 * <h6 class='figure'>Example</h6> +025 * <p class='bcode'> +026 * Content-Type: text/html; charset=utf-8 +027 * </p> +028 * +029 * <h6 class='topic'>RFC2616 Specification</h6> +030 * +031 * The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the +032 * case of the HEAD method, the media type that would have been sent had the request been a GET. +033 * <p class='bcode'> +034 * Content-Type = "Content-Type" ":" media-type +035 * </p> +036 * <p> +037 * Media types are defined in section 3.7. +038 * An example of the field is... +039 * <p class='bcode'> +040 * Content-Type: text/html; charset=ISO-8859-4 +041 * </p> +042 */ +043public class ContentType extends MediaType { +044 +045 private static Cache<String,ContentType> cache = new Cache<String,ContentType>(NOCACHE, CACHE_MAX_SIZE); +046 +047 /** +048 * Returns a parsed <code>Content-Type</code> header. +049 * +050 * @param value The <code>Content-Type</code> header string. +051 * @return The parsed <code>Content-Type</code> header, or <jk>null</jk> if the string was null. +052 */ +053 public static ContentType forString(String value) { +054 if (value == null) +055 return null; +056 ContentType ct = cache.get(value); +057 if (ct == null) +058 ct = cache.put(value, new ContentType(value)); +059 return ct; +060 } +061 +062 +063 private ContentType(String s) { +064 super(s); +065 } +066 +067 /** +068 * Given a list of media types, returns the best match for this <code>Content-Type</code> header. +069 * <p> +070 * Note that fuzzy matching is allowed on the media types where the <code>Content-Types</code> header may +071 * contain additional subtype parts. +072 * <br>For example, given a <code>Content-Type</code> value of <js>"text/json+activity"</js>, +073 * the media type <js>"text/json"</js> will match if <js>"text/json+activity"</js> or <js>"text/activity+json"</js> +074 * isn't found. +075 * <br>The purpose for this is to allow parsers to match when artifacts such as <code>id</code> properties are present +076 * in the header. +077 * +078 * @param mediaTypes The media types to match against. +079 * @return The index into the array of the best match, or <code>-1</code> if no suitable matches could be found. +080 */ +081 public int findMatch(MediaType[] mediaTypes) { +082 int matchQuant = 0, matchIndex = -1; +083 +084 for (int i = 0; i < mediaTypes.length; i++) { +085 MediaType mt = mediaTypes[i]; +086 int matchQuant2 = mt.match(this); +087 if (matchQuant2 > matchQuant) { +088 matchIndex = i; +089 } +090 } +091 +092 return matchIndex; +093 } +094} http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/f1f17bc3/content/site/apidocs/src-html/org/apache/juneau/http/Date.html ---------------------------------------------------------------------- diff --git a/content/site/apidocs/src-html/org/apache/juneau/http/Date.html b/content/site/apidocs/src-html/org/apache/juneau/http/Date.html new file mode 100644 index 0000000..5053380 --- /dev/null +++ b/content/site/apidocs/src-html/org/apache/juneau/http/Date.html @@ -0,0 +1,155 @@ + + + +Source code + + + +
+
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;
+014
+015/**
+016 * Represents a parsed <l>Date</l> HTTP request/response header.
+017 * <p>
+018 * The date and time that the message was sent (in "HTTP-date" format as defined by RFC 7231).
+019 *
+020 * <h6 class='figure'>Example</h6>
+021 * <p class='bcode'>
+022 *    Date: Tue, 15 Nov 1994 08:12:31 GMT
+023 * </p>
+024 *
+025 * <h6 class='topic'>RFC2616 Specification</h6>
+026 *
+027 * The Date general-header field represents the date and time at which the message was originated, having the same
+028 * semantics as orig-date in RFC 822.
+029 * The field value is an HTTP-date, as described in section 3.3.1; it MUST be sent in RFC 1123 [8]-date format.
+030 * <p class='bcode'>
+031 *    Date  = "Date" ":" HTTP-date
+032 * </p>
+033 * <p>
+034 * An example is...
+035 * <p class='bcode'>
+036 *    Date: Tue, 15 Nov 1994 08:12:31 GMT
+037 * </p>
+038 * <p>
+039 * Origin servers MUST include a Date header field in all responses, except in these cases:
+040 * <ol>
+041 *    <li>If the response status code is 100 (Continue) or 101 (Switching Protocols), the response MAY include a Date
+042 * header field, at the server's option.
+043 *    <li>If the response status code conveys a server error, e.g. 500 (Internal Server Error) or 503 (Service
+044 * Unavailable), and it is inconvenient or impossible to generate a valid Date.
+045 *    <li>If the server does not have a clock that can provide a reasonable approximation of the current time, its
+046 * responses MUST NOT include a Date header field.
+047 *       In this case, the rules in section 14.18.1 MUST be followed.
+048 * </ol>
+049 * A received message that does not have a Date header field MUST be assigned one by the recipient if the message will
+050 * be cached by that recipient or gatewayed via a protocol which requires a Date.
+051 * An HTTP implementation without a clock MUST NOT cache responses without revalidating them on every use.
+052 * An HTTP cache, especially a shared cache, SHOULD use a mechanism, such as NTP, to synchronize its clock with a
+053 * reliable external standard.
+054 * <p>
+055 * Clients SHOULD only send a Date header field in messages that include an entity-body, as in the case of the PUT and
+056 * POST requests, and even then it is optional.
+057 * A client without a clock MUST NOT send a Date header field in a request.
+058 * <p>
+059 * The HTTP-date sent in a Date header SHOULD NOT represent a date and time subsequent to the generation of the message.
+060 * It SHOULD represent the best available approximation of the date and time of message generation, unless the
+061 * implementation has no means of generating a reasonably accurate date and time.
+062 * In theory, the date ought to represent the moment just before the entity is generated.
+063 * In practice, the date can be generated at any time during the message origination without affecting its semantic
+064 * value.
+065 */
+066public final class Date extends HeaderDate {
+067
+068   /**
+069    * Returns a parsed <code>Date</code> header.
+070    *
+071    * @param value The <code>Date</code> header string.
+072    * @return The parsed <code>Date</code> header, or <jk>null</jk> if the string was null.
+073    */
+074   public static Date forString(String value) {
+075      if (value == null)
+076         return null;
+077      return new Date(value);
+078   }
+079
+080   private Date(String value) {
+081      super(value);
+082   }
+083}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/f1f17bc3/content/site/apidocs/src-html/org/apache/juneau/http/ETag.html ---------------------------------------------------------------------- diff --git a/content/site/apidocs/src-html/org/apache/juneau/http/ETag.html b/content/site/apidocs/src-html/org/apache/juneau/http/ETag.html new file mode 100644 index 0000000..15d4ac4 --- /dev/null +++ b/content/site/apidocs/src-html/org/apache/juneau/http/ETag.html @@ -0,0 +1,130 @@ + + + +Source code + + + +
+
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;
+014
+015/**
+016 * Represents a parsed <l>ETag</l> HTTP response header.
+017 * <p>
+018 * An identifier for a specific version of a resource, often a message digest.
+019 *
+020 * <h6 class='figure'>Example</h6>
+021 * <p class='bcode'>
+022 *    ETag: "737060cd8c284d8af7ad3082f209582d"
+023 * </p>
+024 *
+025 * <h6 class='topic'>RFC2616 Specification</h6>
+026 *
+027 * The ETag response-header field provides the current value of the entity tag for the requested variant.
+028 * The headers used with entity tags are described in sections 14.24, 14.26 and 14.44.
+029 * The entity tag MAY be used for comparison with other entities from the same resource (see section 13.3.3).
+030 * <p class='bcode'>
+031 *    ETag = "ETag" ":" entity-tag
+032 * </p>
+033 * <p>
+034 * Examples:
+035 * <p class='bcode'>
+036 *    ETag: "xyzzy"
+037 *    ETag: W/"xyzzy"
+038 *    ETag: ""
+039 * </p>
+040 */
+041public final class ETag extends HeaderString {
+042
+043   /**
+044    * Returns a parsed <code>ETag</code> header.
+045    *
+046    * @param value The <code>ETag</code> header string.
+047    * @return The parsed <code>ETag</code> header, or <jk>null</jk> if the string was null.
+048    */
+049   public static ETag forString(String value) {
+050      if (value == null)
+051         return null;
+052      return new ETag(value);
+053   }
+054
+055   private ETag(String value) {
+056      super(value);
+057   }
+058}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/f1f17bc3/content/site/apidocs/src-html/org/apache/juneau/http/EntityValidator.html ---------------------------------------------------------------------- diff --git a/content/site/apidocs/src-html/org/apache/juneau/http/EntityValidator.html b/content/site/apidocs/src-html/org/apache/juneau/http/EntityValidator.html new file mode 100644 index 0000000..c566240 --- /dev/null +++ b/content/site/apidocs/src-html/org/apache/juneau/http/EntityValidator.html @@ -0,0 +1,144 @@ + + + +Source code + + + +
+
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;
+014
+015/**
+016 * Represents a validator value.
+017 * <p>
+018 * <h6 class='figure'>Example</h6>
+019 * <p class='bcode'>
+020 *    ETag: "123456789"    – A strong ETag validator
+021 *    ETag: W/"123456789"  – A weak ETag validator
+022 * </p>
+023 */
+024public class EntityValidator {
+025
+026   private final String value;
+027   private final boolean isWeak;
+028
+029   /**
+030    * Constructor.
+031    *
+032    * @param value The validator string value.
+033    */
+034   protected EntityValidator(String value) {
+035      value = value.trim();
+036      isWeak = value.startsWith("W/");
+037      if (isWeak)
+038         value = value.substring(2);
+039      if (value.length() > 1 && value.charAt(0) == '"' && value.charAt(value.length()-1) == '"')
+040         value = value.substring(1, value.length()-1);
+041      this.value = value;
+042   }
+043
+044   /**
+045    * Returns the validator value stripped of quotes and weak tag.
+046    * @return The validator value.
+047    */
+048   public String asString() {
+049      return value;
+050   }
+051
+052   /**
+053    * Returns <jk>true</jk> if the weak flag is present in the value.
+054    * @return <jk>true</jk> if the weak flag is present in the value.
+055    */
+056   public boolean isWeak() {
+057      return isWeak;
+058   }
+059
+060   /**
+061    * Returns <jk>true</jk> if the validator string value is <code>*</code>.
+062    * @return <jk>true</jk> if the validator string value is <code>*</code>.
+063    */
+064   public boolean isAny() {
+065      return "*".equals(value);
+066   }
+067
+068   @Override
+069   public String toString() {
+070      return (isWeak ? "W/" : "") + (isAny() ? "*" : ('"' + value + '"'));
+071   }
+072}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/f1f17bc3/content/site/apidocs/src-html/org/apache/juneau/http/Expect.html ---------------------------------------------------------------------- diff --git a/content/site/apidocs/src-html/org/apache/juneau/http/Expect.html b/content/site/apidocs/src-html/org/apache/juneau/http/Expect.html new file mode 100644 index 0000000..b5974e7 --- /dev/null +++ b/content/site/apidocs/src-html/org/apache/juneau/http/Expect.html @@ -0,0 +1,145 @@ + + + +Source code + + + +
+
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;
+014
+015/**
+016 * Represents a parsed <l>Expect</l> HTTP request header.
+017 * <p>
+018 * Indicates that particular server behaviors are required by the client.
+019 *
+020 * <h6 class='figure'>Example</h6>
+021 * <p class='bcode'>
+022 *    Expect: 100-continue
+023 * </p>
+024 *
+025 * <h6 class='topic'>RFC2616 Specification</h6>
+026 *
+027 * The Expect request-header field is used to indicate that particular server behaviors are required by the client.
+028 * <p class='bcode'>
+029 *    Expect       =  "Expect" ":" 1#expectation
+030 *    expectation  =  "100-continue" | expectation-extension
+031 *    expectation-extension =  token [ "=" ( token | quoted-string )
+032 *                             *expect-params ]
+033 *    expect-params =  ";" token [ "=" ( token | quoted-string ) ]
+034 * </p>
+035 * <p>
+036 * A server that does not understand or is unable to comply with any of the expectation values in the Expect field of a
+037 * request MUST respond with appropriate error status.
+038 * The server MUST respond with a 417 (Expectation Failed) status if any of the expectations cannot be met or, if there
+039 * are other problems with the request, some other 4xx status.
+040 * <p>
+041 * This header field is defined with extensible syntax to allow for future extensions.
+042 * If a server receives a request containing an Expect field that includes an expectation-extension that it does not
+043 * support, it MUST respond with a 417 (Expectation Failed) status.
+044 * <p>
+045 * Comparison of expectation values is case-insensitive for unquoted tokens (including the 100-continue token), and is
+046 * case-sensitive for quoted-string expectation-extensions.
+047 * <p>
+048 * The Expect mechanism is hop-by-hop: that is, an HTTP/1.1 proxy MUST return a 417 (Expectation Failed) status if it
+049 * receives a request with an expectation that it cannot meet.
+050 * However, the Expect request-header itself is end-to-end; it MUST be forwarded if the request is forwarded.
+051 * <p>
+052 * Many older HTTP/1.0 and HTTP/1.1 applications do not understand the Expect header.
+053 * <p>
+054 * See section 8.2.3 for the use of the 100 (continue) status.
+055 */
+056public final class Expect extends HeaderString {
+057
+058   /**
+059    * Returns a parsed <code>Expect</code> header.
+060    *
+061    * @param value The <code>Expect</code> header string.
+062    * @return The parsed <code>Expect</code> header, or <jk>null</jk> if the string was null.
+063    */
+064   public static Expect forString(String value) {
+065      if (value == null)
+066         return null;
+067      return new Expect(value);
+068   }
+069
+070   private Expect(String value) {
+071      super(value);
+072   }
+073}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/f1f17bc3/content/site/apidocs/src-html/org/apache/juneau/http/Expires.html ---------------------------------------------------------------------- diff --git a/content/site/apidocs/src-html/org/apache/juneau/http/Expires.html b/content/site/apidocs/src-html/org/apache/juneau/http/Expires.html new file mode 100644 index 0000000..9384909 --- /dev/null +++ b/content/site/apidocs/src-html/org/apache/juneau/http/Expires.html @@ -0,0 +1,152 @@ + + + +Source code + + + +
+
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;
+014
+015/**
+016 * Represents a parsed <l>Expires</l> HTTP response header.
+017 * <p>
+018 * Gives the date/time after which the response is considered stale (in "HTTP-date" format as defined by RFC 7231).
+019 *
+020 * <h6 class='figure'>Example</h6>
+021 * <p class='bcode'>
+022 *    Expires: Thu, 01 Dec 1994 16:00:00 GMT
+023 * </p>
+024 *
+025 * <h6 class='topic'>RFC2616 Specification</h6>
+026 * The Expires entity-header field gives the date/time after which the response is considered stale.
+027 * A stale cache entry may not normally be returned by a cache (either a proxy cache or a user agent cache) unless it is
+028 * first validated with the origin server
+029 * (or with an intermediate cache that has a fresh copy of the entity).
+030 * See section 13.2 for further discussion of the expiration model.
+031 * <p>
+032 * The presence of an Expires field does not imply that the original resource will change or cease to exist at, before,
+033 * or after that time.
+034 * <p>
+035 * The format is an absolute date and time as defined by HTTP-date in section 3.3.1; it MUST be in RFC 1123 date format:
+036 * <p class='bcode'>
+037 *    Expires = "Expires" ":" HTTP-date
+038 * </p>
+039 * <p>
+040 * An example of its use is...
+041 * <p class='bcode'>
+042 *    Expires: Thu, 01 Dec 1994 16:00:00 GMT
+043 * </p>
+044 * <p>
+045 * Note: if a response includes a Cache-Control field with the max-age directive (see section 14.9.3), that directive
+046 * overrides the Expires field.
+047 * <p>
+048 * HTTP/1.1 clients and caches MUST treat other invalid date formats, especially including the value "0", as in the past
+049 * (i.e., "already expired").
+050 * <p>
+051 * To mark a response as "already expired," an origin server sends an Expires date that is equal to the Date header
+052 * value.
+053 * (See the rules for expiration calculations in section 13.2.4.)
+054 * <p>
+055 * To mark a response as "never expires," an origin server sends an Expires date approximately one year from the time
+056 * the response is sent.
+057 * HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the future.
+058 * <p>
+059 * The presence of an Expires header field with a date value of some time in the future on a response that otherwise
+060 * would by default be non-cacheable indicates that the response is cacheable, unless indicated otherwise by a
+061 * Cache-Control header field (section 14.9).
+062 */
+063public final class Expires extends HeaderDate {
+064
+065   /**
+066    * Returns a parsed <code>Expires</code> header.
+067    *
+068    * @param value The <code>Expires</code> header string.
+069    * @return The parsed <code>Expires</code> header, or <jk>null</jk> if the string was null.
+070    */
+071   public static Expires forString(String value) {
+072      if (value == null)
+073         return null;
+074      return new Expires(value);
+075   }
+076
+077   private Expires(String value) {
+078      super(value);
+079   }
+080}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/f1f17bc3/content/site/apidocs/src-html/org/apache/juneau/http/From.html ---------------------------------------------------------------------- diff --git a/content/site/apidocs/src-html/org/apache/juneau/http/From.html b/content/site/apidocs/src-html/org/apache/juneau/http/From.html new file mode 100644 index 0000000..24cd86e --- /dev/null +++ b/content/site/apidocs/src-html/org/apache/juneau/http/From.html @@ -0,0 +1,144 @@ + + + +Source code + + + +
+
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;
+014
+015/**
+016 * Represents a parsed <l>From</l> HTTP request header.
+017 * <p>
+018 * The email address of the user making the request.
+019 *
+020 * <h6 class='figure'>Example</h6>
+021 * <p class='bcode'>
+022 *    From: user@example.com
+023 * </p>
+024 *
+025 * <h6 class='topic'>RFC2616 Specification</h6>
+026 *
+027 * The From request-header field, if given, SHOULD contain an Internet e-mail address for the human user who controls
+028 * the requesting user agent.
+029 * The address SHOULD be machine-usable, as defined by "mailbox" in RFC 822 [9] as updated by RFC 1123 [8]:
+030 * <p class='bcode'>
+031 *    From   = "From" ":" mailbox
+032 * </p>
+033 * <p>
+034 * An example is:
+035 * <p class='bcode'>
+036 *    From: webmaster@w3.org
+037 * </p>
+038 * <p>
+039 * This header field MAY be used for logging purposes and as a means for identifying the source of invalid or unwanted
+040 * requests.
+041 * It SHOULD NOT be used as an insecure form of access protection.
+042 * The interpretation of this field is that the request is being performed on behalf of the person given, who accepts
+043 * responsibility for the method performed.
+044 * In particular, robot agents SHOULD include this header so that the person responsible for running the robot can be
+045 * contacted if problems occur on the receiving end.
+046 * <p>
+047 * The Internet e-mail address in this field MAY be separate from the Internet host which issued the request.
+048 * For example, when a request is passed through a proxy the original issuer's address SHOULD be used.
+049 * <p>
+050 * The client SHOULD NOT send the From header field without the user's approval, as it might conflict with the user's
+051 * privacy interests or their site's security policy.
+052 * It is strongly recommended that the user be able to disable, enable, and modify the value of this field at any time
+053 * prior to a request.
+054 */
+055public final class From extends HeaderString {
+056
+057   /**
+058    * Returns a parsed <code>From</code> header.
+059    *
+060    * @param value The <code>From</code> header string.
+061    * @return The parsed <code>From</code> header, or <jk>null</jk> if the string was null.
+062    */
+063   public static From forString(String value) {
+064      if (value == null)
+065         return null;
+066      return new From(value);
+067   }
+068
+069   private From(String value) {
+070      super(value);
+071   }
+072}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +