This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 7706bf8 JUNEAU-199
7706bf8 is described below
commit 7706bf8038f92052a5405cdc88deaecd4893fa35
Author: JamesBognar <[email protected]>
AuthorDate: Fri Mar 6 18:03:06 2020 -0500
JUNEAU-199
New ContentDisposition header bean.
---
.../main/java/org/apache/juneau/http/Allow.java | 2 +-
...ngArrayHeader.java => BasicCsvArrayHeader.java} | 6 +-
.../http/{Allow.java => ContentDisposition.java} | 74 +++++++---------------
.../org/apache/juneau/http/ContentLanguage.java | 2 +-
.../main/java/org/apache/juneau/http/Upgrade.java | 2 +-
.../src/main/java/org/apache/juneau/http/Via.java | 2 +-
6 files changed, 29 insertions(+), 59 deletions(-)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
index 744863d..fa25aa9 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
@@ -66,7 +66,7 @@ import org.apache.juneau.http.annotation.*;
* </ul>
*/
@Header("Allow")
-public final class Allow extends BasicStringArrayHeader {
+public final class Allow extends BasicCsvArrayHeader {
/**
* Constructor.
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/BasicStringArrayHeader.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/BasicCsvArrayHeader.java
similarity index 94%
rename from
juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/BasicStringArrayHeader.java
rename to
juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/BasicCsvArrayHeader.java
index 419bd15..9d72630 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/BasicStringArrayHeader.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/BasicCsvArrayHeader.java
@@ -30,7 +30,7 @@ import org.apache.juneau.jsonschema.annotation.Items;
* </ul>
*/
@Header(type="array",collectionFormat="csv",items=@Items(type="string"))
-public class BasicStringArrayHeader extends BasicHeader {
+public class BasicCsvArrayHeader extends BasicHeader {
private final String[] value;
@@ -40,7 +40,7 @@ public class BasicStringArrayHeader extends BasicHeader {
* @param name The HTTP header name.
* @param value The raw header value.
*/
- protected BasicStringArrayHeader(String name, String[] value) {
+ protected BasicCsvArrayHeader(String name, String[] value) {
super(name, StringUtils.joine(value, ','));
this.value = value;
}
@@ -51,7 +51,7 @@ public class BasicStringArrayHeader extends BasicHeader {
* @param name The HTTP header name.
* @param value The raw header value.
*/
- protected BasicStringArrayHeader(String name, String value) {
+ protected BasicCsvArrayHeader(String name, String value) {
super(name, value);
this.value = split(value);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentDisposition.java
similarity index 51%
copy from
juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
copy to
juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentDisposition.java
index 744863d..b5a9c14 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentDisposition.java
@@ -15,78 +15,48 @@ package org.apache.juneau.http;
import org.apache.juneau.http.annotation.*;
/**
- * Represents a parsed <l>Allow</l> HTTP response header.
+ * Represents a parsed <l>Content-Disposition</l> HTTP request header.
*
* <p>
- * Valid methods for a specified resource. To be used for a 405 Method not
allowed.
+ * In a regular HTTP response, the Content-Disposition response header is a
header indicating if the content is expected
+ * to be displayed inline in the browser, that is, as a Web page or as part of
a Web page, or as an attachment, that is
+ * downloaded and saved locally.
*
* <h5 class='figure'>Example</h5>
* <p class='bcode w800'>
- * Allow: GET, HEAD
+ * Content-Disposition: form-data; name="fieldName";
filename="filename.jpg"
* </p>
*
* <h5 class='topic'>RFC2616 Specification</h5>
*
- * The Allow entity-header field lists the set of methods supported by the
resource identified by the Request-URI.
- * The purpose of this field is strictly to inform the recipient of valid
methods associated with the resource.
- * An Allow header field MUST be present in a 405 (Method Not Allowed)
response.
- *
- * <p class='bcode w800'>
- * Allow = "Allow" ":" #Method
- * </p>
- *
- * <p>
- * Example of use:
+ * The Expect request-header field is used to indicate that particular server
behaviors are required by the client.
* <p class='bcode w800'>
- * Allow: GET, HEAD, PUT
+ * content-disposition = "Content-Disposition" ":"
+ * disposition-type *( ";" disposition-parm )
+ * disposition-type = "attachment" | disp-extension-token
+ * disposition-parm = filename-parm | disp-extension-parm
+ * filename-parm = "filename" "=" quoted-string
+ * disp-extension-token = token
+ * disp-extension-parm = token "=" ( token | quoted-string )
* </p>
*
- * <p>
- * This field cannot prevent a client from trying other methods.
- * However, the indications given by the Allow header field value SHOULD be
followed.
- *
- * <p>
- * The actual set of allowed methods is defined by the origin server at the
time of each request.
- *
- * <p>
- * The Allow header field MAY be provided with a PUT request to recommend the
methods to be supported by the new or
- * modified resource.
- *
- * <p>
- * The server is not required to support these methods and SHOULD include an
Allow header in the response giving the
- * actual supported methods.
- *
- * <p>
- * A proxy MUST NOT modify the Allow header field even if it does not
understand all the methods specified, since the
- * user agent might
- * have other means of communicating with the origin server.
- *
* <ul class='seealso'>
* <li class='extlink'>{@doc RFC2616}
* </ul>
*/
-@Header("Allow")
-public final class Allow extends BasicStringArrayHeader {
-
- /**
- * Constructor.
- *
- * @param value The value for this header.
- */
- public Allow(String[] value) {
- super("Allow", value);
- }
+@Header("Content-Disposition")
+public final class ContentDisposition extends BasicStringHeader {
/**
- * Returns a parsed <c>Allow</c> header.
+ * Returns a parsed <c>Content-Disposition</c> header.
*
- * @param value The <c>Allow</c> header string.
- * @return The parsed <c>Allow</c> header, or <jk>null</jk> if the
string was null.
+ * @param value The <c>Content-Disposition</c> header string.
+ * @return The parsed <c>Content-Disposition</c> header, or
<jk>null</jk> if the string was null.
*/
- public static Allow forString(String value) {
+ public static ContentDisposition forString(String value) {
if (value == null)
return null;
- return new Allow(value);
+ return new ContentDisposition(value);
}
/**
@@ -94,7 +64,7 @@ public final class Allow extends BasicStringArrayHeader {
*
* @param value The value for this header.
*/
- public Allow(String value) {
- super("Allow", value);
+ public ContentDisposition(String value) {
+ super("Expect", value);
}
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLanguage.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLanguage.java
index 9b3b2a8..037627c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLanguage.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLanguage.java
@@ -71,7 +71,7 @@ import org.apache.juneau.http.annotation.*;
* </ul>
*/
@Header("Content-Language")
-public final class ContentLanguage extends BasicStringArrayHeader {
+public final class ContentLanguage extends BasicCsvArrayHeader {
/**
* Constructor.
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Upgrade.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Upgrade.java
index aff5706..0438a79 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Upgrade.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Upgrade.java
@@ -80,7 +80,7 @@ import org.apache.juneau.http.annotation.*;
* </ul>
*/
@Header("Upgrade")
-public final class Upgrade extends BasicStringArrayHeader {
+public final class Upgrade extends BasicCsvArrayHeader {
/**
* Constructor.
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Via.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Via.java
index 38cdfa4..d33f09c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Via.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Via.java
@@ -116,7 +116,7 @@ import org.apache.juneau.http.annotation.*;
* </ul>
*/
@Header("Via")
-public final class Via extends BasicStringArrayHeader {
+public final class Via extends BasicCsvArrayHeader {
/**
* Constructor.