类 HttpHeaders

java.lang.Object
cn.taketoday.http.HttpHeaders
所有已实现的接口:
cn.taketoday.util.MultiValueMap<String,String>, Serializable, Map<String,List<String>>
直接已知子类:
DefaultHttpHeaders

public abstract class HttpHeaders extends Object implements cn.taketoday.util.MultiValueMap<String,String>, Serializable
A data structure representing HTTP request or response headers, mapping String header names to a list of String values, also offering accessors for common application-level data types.

In addition to the regular methods defined by Map, this class offers many common convenience methods, for example:

Note that HttpHeaders generally treats header names in a case-insensitive manner.

从以下版本开始:
3.0 2020-01-28 17:15
作者:
Arjen Poutsma, Sebastien Deleuze, Brian Clozel, Juergen Hoeller, Josh Long, Sam Brannen, Harry Yang
另请参阅:
  • 字段详细资料

  • 构造器详细资料

    • HttpHeaders

      public HttpHeaders()
  • 方法详细资料

    • getOrEmpty

      public List<String> getOrEmpty(String headerName)
      Get the list of header values for the given header name, if any.
      参数:
      headerName - the header name
      返回:
      the list of header values, or an empty list
    • setAccept

      public void setAccept(Collection<MediaType> acceptableMediaTypes)
      Set the list of acceptable media types, as specified by the Accept header.
    • getAccept

      public List<MediaType> getAccept()
      Return the list of acceptable media types, as specified by the Accept header.

      Returns an empty list when the acceptable media types are unspecified.

    • setAcceptLanguage

      public void setAcceptLanguage(Collection<Locale.LanguageRange> languages)
      Set the acceptable language ranges, as specified by the Accept-Language header.
    • getAcceptLanguage

      public List<Locale.LanguageRange> getAcceptLanguage()
      Return the language ranges from the "Accept-Language" header.

      If you only need sorted, preferred locales only use getAcceptLanguageAsLocales() or if you need to filter based on a list of supported locales you can pass the returned list to Locale.filter(List, Collection).

      抛出:
      IllegalArgumentException - if the value cannot be converted to a language range
    • setAcceptLanguageAsLocales

      public void setAcceptLanguageAsLocales(Collection<Locale> locales)
    • getAcceptLanguageAsLocales

      public List<Locale> getAcceptLanguageAsLocales()
      A variant of getAcceptLanguage() that converts each Locale.LanguageRange to a Locale.
      返回:
      the locales or an empty list
      抛出:
      IllegalArgumentException - if the value cannot be converted to a locale
    • setAcceptPatch

      public void setAcceptPatch(Collection<MediaType> mediaTypes)
      Set the list of acceptable media types for PATCH methods, as specified by the Accept-Patch header.
      从以下版本开始:
      4.0
    • getAcceptPatch

      public List<MediaType> getAcceptPatch()
      Return the list of acceptable media types for PATCH methods, as specified by the Accept-Patch header.

      Returns an empty list when the acceptable media types are unspecified.

      从以下版本开始:
      4.0
    • setAccessControlAllowCredentials

      public void setAccessControlAllowCredentials(boolean allowCredentials)
      Set the (new) value of the Access-Control-Allow-Credentials response header.
    • getAccessControlAllowCredentials

      public boolean getAccessControlAllowCredentials()
      Return the value of the Access-Control-Allow-Credentials response header.
    • setAccessControlAllowHeaders

      public void setAccessControlAllowHeaders(Collection<String> allowedHeaders)
      Set the (new) value of the Access-Control-Allow-Headers response header.
    • getAccessControlAllowHeaders

      public List<String> getAccessControlAllowHeaders()
      Return the value of the Access-Control-Allow-Headers response header.
    • setAccessControlAllowMethods

      public void setAccessControlAllowMethods(Collection<?> allowedMethods)
      Set the (new) value of the Access-Control-Allow-Methods response header.
    • getAccessControlAllowMethods

      public List<HttpMethod> getAccessControlAllowMethods()
      Return the value of the Access-Control-Allow-Methods response header.
    • setAccessControlAllowOrigin

      public void setAccessControlAllowOrigin(String allowedOrigin)
      Set the (new) value of the Access-Control-Allow-Origin response header.
    • getAccessControlAllowOrigin

      public String getAccessControlAllowOrigin()
      Return the value of the Access-Control-Allow-Origin response header.
    • setAccessControlExposeHeaders

      public void setAccessControlExposeHeaders(Collection<String> exposedHeaders)
      Set the (new) value of the Access-Control-Expose-Headers response header.
    • getAccessControlExposeHeaders

      public List<String> getAccessControlExposeHeaders()
      Return the value of the Access-Control-Expose-Headers response header.
    • setAccessControlMaxAge

      public void setAccessControlMaxAge(Duration maxAge)
      Set the (new) value of the Access-Control-Max-Age response header.
    • setAccessControlMaxAge

      public void setAccessControlMaxAge(long maxAge)
      Set the (new) value of the Access-Control-Max-Age response header.
    • getAccessControlMaxAge

      public long getAccessControlMaxAge()
      Return the value of the Access-Control-Max-Age response header.

      Returns -1 when the max age is unknown.

    • setAccessControlRequestHeaders

      public void setAccessControlRequestHeaders(Collection<String> requestHeaders)
      Set the (new) value of the Access-Control-Request-Headers request header.
    • getAccessControlRequestHeaders

      public List<String> getAccessControlRequestHeaders()
      Return the value of the Access-Control-Request-Headers request header.
    • setAccessControlRequestMethod

      public void setAccessControlRequestMethod(@Nullable HttpMethod requestMethod)
      Set the (new) value of the Access-Control-Request-Method request header.
    • getAccessControlRequestMethod

      @Nullable public HttpMethod getAccessControlRequestMethod()
      Return the value of the Access-Control-Request-Method request header.
    • setAcceptCharset

      public void setAcceptCharset(Collection<Charset> acceptableCharsets)
      Set the list of acceptable charsets, as specified by the Accept-Charset header.
    • getAcceptCharset

      public List<Charset> getAcceptCharset()
      Return the list of acceptable charsets, as specified by the Accept-Charset header.
    • setAllow

      public void setAllow(Collection<HttpMethod> allowedMethods)
      Set the set of allowed HTTP methods, as specified by the Allow header.
    • setAllow

      public void setAllow(HttpMethod... allowedMethods)
      Set the set of allowed HTTP methods, as specified by the Allow header.
    • setAllow

      public void setAllow(String... allowedMethods)
      Set the set of allowed HTTP methods, as specified by the Allow header.
    • getAllow

      public Set<HttpMethod> getAllow()
      Return the set of allowed HTTP methods, as specified by the Allow header.

      Returns an empty set when the allowed methods are unspecified.

    • setBasicAuth

      public void setBasicAuth(String encodedCredentials)
      Set the value of the Authorization header to Basic Authentication
      参数:
      encodedCredentials - the encoded credentials
      抛出:
      IllegalArgumentException - if supplied credentials string is null or blank
      另请参阅:
    • setBasicAuth

      public void setBasicAuth(String username, String password)
      Set the value of the Authorization header to Basic Authentication based on the given username and password.

      Note that this method only supports characters in the ISO-8859-1 character set.

      参数:
      username - the username
      password - the password
      抛出:
      IllegalArgumentException - if either user or password contain characters that cannot be encoded to ISO-8859-1
      另请参阅:
    • setBasicAuth

      public void setBasicAuth(String username, String password, @Nullable Charset charset)
      Set the value of the Authorization header to Basic Authentication based on the given username and password.
      参数:
      username - the username
      password - the password
      charset - the charset to use to convert the credentials into an octet sequence. Defaults to ISO-8859-1.
      抛出:
      IllegalArgumentException - if username or password contains characters that cannot be encoded to the given charset
      另请参阅:
    • setBearerAuth

      public void setBearerAuth(String token)
      Set the value of the Authorization header to the given Bearer token.
      参数:
      token - the Base64 encoded token
      另请参阅:
    • setCacheControl

      public void setCacheControl(CacheControl cacheControl)
      Set a configured CacheControl instance as the new value of the Cache-Control header.
    • setCacheControl

      public void setCacheControl(@Nullable String cacheControl)
      Set the (new) value of the Cache-Control header.
    • getCacheControl

      public String getCacheControl()
      Return the value of the Cache-Control header.
    • setConnection

      public void setConnection(String connection)
      Set the (new) value of the Connection header.
    • setConnection

      public void setConnection(Collection<String> connection)
      Set the (new) value of the Connection header.
    • getConnection

      public List<String> getConnection()
      Return the value of the Connection header.
    • setContentDispositionFormData

      public void setContentDispositionFormData(String name, String filename)
      Set the Content-Disposition header when creating a "multipart/form-data" request.

      Applications typically would not set this header directly but rather prepare a MultiValueMap<String, Object>, containing an Object or a Resource for each part, and then pass that to the RestTemplate or WebClient.

      参数:
      name - the control name
      filename - the filename (may be null)
      另请参阅:
    • setContentDisposition

      public void setContentDisposition(ContentDisposition contentDisposition)
      Set the Content-Disposition header.

      This could be used on a response to indicate if the content is expected to be displayed inline in the browser or as an attachment to be saved locally.

      It can also be used for a "multipart/form-data" request. For more details see notes on setContentDispositionFormData(java.lang.String, java.lang.String).

      另请参阅:
    • setContentDisposition

      public void setContentDisposition(String contentDisposition)
    • getContentDisposition

      public ContentDisposition getContentDisposition()
      Return a parsed representation of the Content-Disposition header.
      另请参阅:
    • setContentLanguage

      public void setContentLanguage(@Nullable Locale locale)
      Set the Locale of the content language, as specified by the Content-Language header.

      Use put(CONTENT_LANGUAGE, list) if you need to set multiple content languages.

    • getContentLanguage

      @Nullable public Locale getContentLanguage()
      Return the first Locale of the content languages, as specified by the Content-Language header.

      Returns null when the content language is unknown.

      Use getValuesAsList(CONTENT_LANGUAGE) if you need to get multiple content languages.

    • setContentLength

      public void setContentLength(long contentLength)
      Set the length of the body in bytes, as specified by the Content-Length header.
    • getContentLength

      public long getContentLength()
      Return the length of the body in bytes, as specified by the Content-Length header.

      Returns -1 when the content-length is unknown.

    • setContentType

      public void setContentType(MediaType mediaType)
      Set the media type of the body, as specified by the Content-Type header.
    • getContentType

      @Nullable public MediaType getContentType()
      Return the media type of the body, as specified by the Content-Type header.

      Returns null when the Content-Type header is not set.

      抛出:
      InvalidMediaTypeException - if the media type value cannot be parsed
    • setDate

      public void setDate(ZonedDateTime date)
      Set the date and time at which the message was created, as specified by the Date header.
    • setDate

      public void setDate(Instant date)
      Set the date and time at which the message was created, as specified by the Date header.
    • setDate

      public void setDate(long date)
      Set the date and time at which the message was created, as specified by the Date header.

      The date should be specified as the number of milliseconds since January 1, 1970 GMT.

    • getDate

      public long getDate()
      Return the date and time at which the message was created, as specified by the Date header.

      The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.

      抛出:
      IllegalArgumentException - if the value cannot be converted to a date
    • setETag

      public void setETag(@Nullable String etag)
      Set the (new) entity tag of the body, as specified by the ETag header.
    • getETag

      @Nullable public String getETag()
      Return the entity tag of the body, as specified by the ETag header.
    • setExpires

      public void setExpires(ZonedDateTime expires)
      Set the duration after which the message is no longer valid, as specified by the Expires header.
    • setExpires

      public void setExpires(Instant expires)
      Set the date and time at which the message is no longer valid, as specified by the Expires header.
    • setExpires

      public void setExpires(long expires)
      Set the date and time at which the message is no longer valid, as specified by the Expires header.

      The date should be specified as the number of milliseconds since January 1, 1970 GMT.

    • getExpires

      public long getExpires()
      Return the date and time at which the message is no longer valid, as specified by the Expires header.

      The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.

      另请参阅:
    • setHost

      public void setHost(@Nullable InetSocketAddress host)
      Set the (new) value of the Host header.

      If the given port is 0, the host header will only contain the host name.

    • getHost

      @Nullable public InetSocketAddress getHost()
      Return the value of the Host header, if available.

      If the header value does not contain a port, the port in the returned address will be 0.

    • setIfMatch

      public void setIfMatch(String ifMatch)
      Set the (new) value of the If-Match header.
    • setIfMatch

      public void setIfMatch(Collection<String> ifMatchList)
      Set the (new) value of the If-Match header.
    • getIfMatch

      public List<String> getIfMatch()
      Return the value of the If-Match header.
    • setIfModifiedSince

      public void setIfModifiedSince(ZonedDateTime ifModifiedSince)
      Set the time the resource was last changed, as specified by the Last-Modified header.
    • setIfModifiedSince

      public void setIfModifiedSince(Instant ifModifiedSince)
      Set the time the resource was last changed, as specified by the Last-Modified header.
    • setIfModifiedSince

      public void setIfModifiedSince(long ifModifiedSince)
      Set the (new) value of the If-Modified-Since header.

      The date should be specified as the number of milliseconds since January 1, 1970 GMT.

    • getIfModifiedSince

      public long getIfModifiedSince()
      Return the value of the If-Modified-Since header.

      The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.

      另请参阅:
    • setIfNoneMatch

      public void setIfNoneMatch(String ifNoneMatch)
      Set the (new) value of the If-None-Match header.
    • setIfNoneMatch

      public void setIfNoneMatch(Collection<String> ifNoneMatchList)
      Set the (new) values of the If-None-Match header.
    • getIfNoneMatch

      public List<String> getIfNoneMatch()
      Return the value of the If-None-Match header.
    • setIfUnmodifiedSince

      public void setIfUnmodifiedSince(ZonedDateTime ifUnmodifiedSince)
      Set the time the resource was last changed, as specified by the Last-Modified header.
    • setIfUnmodifiedSince

      public void setIfUnmodifiedSince(Instant ifUnmodifiedSince)
      Set the time the resource was last changed, as specified by the Last-Modified header.
    • setIfUnmodifiedSince

      public void setIfUnmodifiedSince(long ifUnmodifiedSince)
      Set the (new) value of the If-Unmodified-Since header.

      The date should be specified as the number of milliseconds since January 1, 1970 GMT.

    • getIfUnmodifiedSince

      public long getIfUnmodifiedSince()
      Return the value of the If-Unmodified-Since header.

      The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.

      另请参阅:
    • setLastModified

      public void setLastModified(ZonedDateTime lastModified)
      Set the time the resource was last changed, as specified by the Last-Modified header.
    • setLastModified

      public void setLastModified(Instant lastModified)
      Set the time the resource was last changed, as specified by the Last-Modified header.
    • setLastModified

      public void setLastModified(long lastModified)
      Set the time the resource was last changed, as specified by the Last-Modified header.

      The date should be specified as the number of milliseconds since January 1, 1970 GMT.

    • getLastModified

      public long getLastModified()
      Return the time the resource was last changed, as specified by the Last-Modified header.

      The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.

      另请参阅:
    • setLocation

      public void setLocation(@Nullable URI location)
      Set the (new) location of a resource, as specified by the Location header.
    • setLocation

      public void setLocation(@Nullable String location)
      Set the (new) location of a resource, as specified by the Location header.
      从以下版本开始:
      4.0
    • getLocation

      @Nullable public URI getLocation()
      Return the (new) location of a resource as specified by the Location header.

      Returns null when the location is unknown.

    • setOrigin

      public void setOrigin(String origin)
      Set the (new) value of the Origin header.
    • getOrigin

      @Nullable public String getOrigin()
      Return the value of the Origin header.
    • setPragma

      public void setPragma(String pragma)
      Set the (new) value of the Pragma header.
    • getPragma

      @Nullable public String getPragma()
      Return the value of the Pragma header.
    • setRange

      public void setRange(Collection<HttpRange> ranges)
      Sets the (new) value of the Range header.
    • getRange

      public List<HttpRange> getRange()
      Return the value of the Range header.

      Returns an empty list when the range is unknown.

    • setUpgrade

      public void setUpgrade(String upgrade)
      Set the (new) value of the Upgrade header.
    • getUpgrade

      @Nullable public String getUpgrade()
      Return the value of the Upgrade header.
    • setVary

      public void setVary(Collection<String> requestHeaders)
      Set the request header names (e.g. "Accept-Language") for which the response is subject to content negotiation and variances based on the value of those request headers.
      参数:
      requestHeaders - the request header names
    • setVary

      public void setVary(String... requestHeaders)
      Set the request header names (e.g. "Accept-Language") for which the response is subject to content negotiation and variances based on the value of those request headers.
      参数:
      requestHeaders - the request header names
    • getVary

      public List<String> getVary()
      Return the request header names subject to content negotiation.
    • setZonedDateTime

      public void setZonedDateTime(String headerName, ZonedDateTime date)
      Set the given date under the given header name after formatting it as a string using the RFC-1123 date-time formatter. The equivalent of set(String, String) but for date headers.
    • setInstant

      public void setInstant(String headerName, Instant date)
      Set the given date under the given header name after formatting it as a string using the RFC-1123 date-time formatter. The equivalent of set(String, String) but for date headers.
    • setDate

      public void setDate(String headerName, long date)
      Set the given date under the given header name after formatting it as a string using the RFC-1123 date-time formatter. The equivalent of set(String, String) but for date headers.
      另请参阅:
    • getFirstDate

      public long getFirstDate(String headerName)
      Parse the first header value for the given header name as a date, return -1 if there is no value, or raise IllegalArgumentException if the value cannot be parsed as a date.
      参数:
      headerName - the header name
      返回:
      the parsed date header, or -1 if none
      另请参阅:
    • getFirstDate

      public long getFirstDate(String headerName, boolean rejectInvalid)
      Parse the first header value for the given header name as a date, return -1 if there is no value or also in case of an invalid value (if rejectInvalid=false), or raise IllegalArgumentException if the value cannot be parsed as a date.
      参数:
      headerName - the header name
      rejectInvalid - whether to reject invalid values with an IllegalArgumentException (true) or rather return -1 in that case (false)
      返回:
      the parsed date header, or -1 if none (or invalid)
      另请参阅:
    • getFirstZonedDateTime

      @Nullable public ZonedDateTime getFirstZonedDateTime(String headerName)
      Parse the first header value for the given header name as a date, return null if there is no value, or raise IllegalArgumentException if the value cannot be parsed as a date.
      参数:
      headerName - the header name
      返回:
      the parsed date header, or null if none
    • getFirstZonedDateTime

      @Nullable public ZonedDateTime getFirstZonedDateTime(String headerName, boolean rejectInvalid)
      Parse the first header value for the given header name as a date, return null if there is no value or also in case of an invalid value (if rejectInvalid=false), or raise IllegalArgumentException if the value cannot be parsed as a date.
      参数:
      headerName - the header name
      rejectInvalid - whether to reject invalid values with an IllegalArgumentException (true) or rather return null in that case (false)
      返回:
      the parsed date header, or null if none (or invalid)
    • getValuesAsList

      public List<String> getValuesAsList(String headerName)
      Return all values of a given header name, even if this header is set multiple times.
      参数:
      headerName - the header name
      返回:
      all associated values
    • tokenizeQuoted

      private static List<String> tokenizeQuoted(String str)
    • addToken

      private static void addToken(StringBuilder builder, List<String> tokens, boolean trim)
    • clearContentHeaders

      public void clearContentHeaders()
      Remove the well-known "Content-*" HTTP headers.

      Such headers should be cleared from the response if the intended body can't be written due to errors.

    • getETagValuesAsList

      public List<String> getETagValuesAsList(String headerName)
      Retrieve a combined result from the field values of the ETag header.
      参数:
      headerName - the header name
      返回:
      the combined result
    • getFieldValues

      @Nullable public String getFieldValues(String headerName)
      Retrieve a combined result from the field values of multi-valued headers.
      参数:
      headerName - the header name
      返回:
      the combined result
    • toCommaDelimitedString

      protected String toCommaDelimitedString(Collection<?> headerValues)
      Turn the given list of header values into a comma-delimited result.
      参数:
      headerValues - the list of header values
      返回:
      a combined result with comma delimitation
    • setOrRemove

      public void setOrRemove(String headerName, @Nullable String headerValue)
      Set the given header value, or remove the header if null.
      参数:
      headerName - the header name
      headerValue - the header value, or null for none
    • getFirst

      @Nullable public abstract String getFirst(String headerName)
      Return the first header value for the given header name, if any.
      指定者:
      getFirst 在接口中 cn.taketoday.util.MultiValueMap<String,String>
      参数:
      headerName - the header name
      返回:
      the first header value, or null if none
    • add

      public abstract void add(String headerName, @Nullable String headerValue)
      Add the given, single header value under the given name.
      指定者:
      add 在接口中 cn.taketoday.util.MultiValueMap<String,String>
      参数:
      headerName - the header name
      headerValue - the header value
      抛出:
      UnsupportedOperationException - if adding headers is not supported
      另请参阅:
    • set

      public abstract void set(String headerName, @Nullable String headerValue)
      指定者:
      set 在接口中 cn.taketoday.util.MultiValueMap<String,String>
    • get

      @Nullable public abstract List<String> get(Object headerName)
      指定者:
      get 在接口中 Map<String,List<String>>
    • remove

      @Nullable public abstract List<String> remove(Object headerName)
      指定者:
      remove 在接口中 Map<String,List<String>>
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • formatHeaders

      public static String formatHeaders(cn.taketoday.util.MultiValueMap<String,String> headers)
      Helps to format HTTP header values, as HTTP header values themselves can contain comma-separated values, can become confusing with regular Map formatting that also uses commas between entries.
      参数:
      headers - the headers to format
      返回:
      the headers to a String
    • encodeBasicAuth

      public static String encodeBasicAuth(String username, String password, @Nullable Charset charset)
      Encode the given username and password into Basic Authentication credentials.

      The encoded credentials returned by this method can be supplied to setBasicAuth(String) to set the Basic Authentication header.

      参数:
      username - the username
      password - the password
      charset - the charset to use to convert the credentials into an octet sequence. Defaults to ISO-8859-1.
      抛出:
      IllegalArgumentException - if username or password contains characters that cannot be encoded to the given charset
      另请参阅:
    • empty

      public static HttpHeaders empty()
      返回:
      returns empty http-headers
      从以下版本开始:
      4.0
    • create

      public static DefaultHttpHeaders create()
      返回:
      returns a new DefaultHttpHeaders
      从以下版本开始:
      4.0
    • from

      public static DefaultHttpHeaders from(cn.taketoday.util.MultiValueMap<String,String> headers)
      Construct a new HttpHeaders instance backed by an existing map.

      This constructor is available as an optimization for adapting to existing headers map structures, primarily for internal use within the framework.

      参数:
      headers - the original map
      返回:
      the adapted multi-value map (wrapping the original map)
      从以下版本开始:
      4.0
    • readOnlyHttpHeaders

      public static HttpHeaders readOnlyHttpHeaders(cn.taketoday.util.MultiValueMap<String,String> headers)
      Apply a read-only HttpHeaders wrapper around the given headers, if necessary.

      Also caches the parsed representations of the "Accept" and "Content-Type" headers.

      参数:
      headers - the headers to expose
      返回:
      a read-only variant of the headers, or the original headers as-is (in case it happens to be a read-only HttpHeaders instance already)
      从以下版本开始:
      4.0
    • readOnlyHttpHeaders

      public static HttpHeaders readOnlyHttpHeaders(HttpHeaders headers)
      Apply a read-only HttpHeaders wrapper around the given headers, if necessary.

      Also caches the parsed representations of the "Accept" and "Content-Type" headers.

      参数:
      headers - the headers to expose
      返回:
      a read-only variant of the headers, or the original headers as-is
      从以下版本开始:
      4.0
    • writableHttpHeaders

      public static HttpHeaders writableHttpHeaders(HttpHeaders headers)
      Remove any read-only wrapper that may have been previously applied around the given headers via readOnlyHttpHeaders(HttpHeaders).
      参数:
      headers - the headers to expose
      返回:
      a writable variant of the headers, or the original headers as-is
      从以下版本开始:
      4.0
    • copyOf

      public static HttpHeaders copyOf(@Nullable Map<String,List<String>> targetMap)
      copy targetMap’s all entries to a new HttpHeaders
      参数:
      targetMap - can be null
      返回:
      returns empty() if targetMap is null
      从以下版本开始:
      4.0
    • formatDate

      static String formatDate(long date)