com.aliyun.oss.model

## 类 Callback

- java.lang.Object
- - com.aliyun.oss.model.Callback

-     public class Callback
      extends Object

  When an upload succeeds, OSS provides the mechanism to send a post message to a callbackurl to trigger some action defined by that callbackurl. The message's method must be Post and the body is the callbackBody's content and it must match the callbackurl's expectation. APIs that support callback include PutObject, PstObject, CompleteMultipartUpload.

- - ### 嵌套类概要

    嵌套类
    限定符和类型 | 类和说明
    --- | ---
    `static class` | `Callback.CalbackBodyType`

  - ### 构造器概要

    构造器
    构造器和说明
    `Callback()`

  - ### 方法概要

    方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `addCallbackVar(String key, String value)` Adds a new custom parameter.
    `Callback.CalbackBodyType` | `getCalbackBodyType()`
    `String` | `getCallbackBody()`
    `String` | `getCallbackHost()`
    `String` | `getCallbackUrl()`
    `Map<String,String>` | `getCallbackVar()`
    `boolean` | `hasCallbackVar()`
    `void` | `setCalbackBodyType(Callback.CalbackBodyType calbackBodyType)` The content-type header in OSS's callback request.
    `void` | `setCallbackBody(String callbackBody)` Sets the callback body.For example: key=$(key) & etag=$(etag) & my_var=$(x:my_var).
    `void` | `setCallbackHost(String callbackHost)` Sets the callback host, only valid when callbackUrl is set.
    `void` | `setCallbackUrl(String callbackUrl)` Sets the callback url---the callbackUrl parameter must be Url encoded.
    `void` | `setCallbackVar(Map<String,String> callbackVar)` Sets user customized parameter(s).

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### Callback

          public Callback()

  - ### 方法详细资料

    - #### getCallbackUrl

          public String getCallbackUrl()

    - #### setCallbackUrl

          public void setCallbackUrl(String callbackUrl)

      Sets the callback url---the callbackUrl parameter must be Url encoded. It supports multiple callback urls (separated by ';'). When multiple callback urls are specified, OSS will send callback request one by one until the first successful response. After the callback request is sent, OSS expects to get "200 OK" response with a JSON body. The body size should be no more than 3MB.
      参数:
        `callbackUrl` - The callback url(s) in url encoding.

    - #### getCallbackHost

          public String getCallbackHost()

    - #### setCallbackHost

          public void setCallbackHost(String callbackHost)

      Sets the callback host, only valid when callbackUrl is set. If this is not set, the host will be extracted from the callbackUrl.
      参数:
        `callbackHost` - The host of OSS callback.

    - #### getCallbackBody

          public String getCallbackBody()

    - #### setCallbackBody

          public void setCallbackBody(String callbackBody)

      Sets the callback body.For example: key=$(key) & etag=$(etag) & my_var=$(x:my_var). It supports the OSS system variable, custom defined variable or constant and custom defined variable's callbackVar.
      参数:
        `callbackBody` - OSS callback body.

    - #### getCalbackBodyType

          public Callback.CalbackBodyType getCalbackBodyType()

    - #### setCalbackBodyType

          public void setCalbackBodyType(Callback.CalbackBodyType calbackBodyType)

      The content-type header in OSS's callback request. It supports application/x-www-form-urlencoded(url) and application/json(json). The default is the former, which means the variable in callback body will be url encoded. If it's latter, the variable in callback body will be formatted (by the SDK) as json's variable.
      参数:
        `calbackBodyType` - The content-type header in OSS callback request.

    - #### getCallbackVar

          public Map<String,String> getCallbackVar()

    - #### setCallbackVar

          public void setCallbackVar(Map<String,String> callbackVar)

      Sets user customized parameter(s). Customized parameter is a Map<key,value> instance. In the callback request, OSS would put these parameters into the post body. The keys must start with "x:", such as x:my_var.
      参数:
        `callbackVar` - A `Map` instance that stores the <key, value> pairs.

    - #### addCallbackVar

          public void addCallbackVar(String key,
                            String value)

      Adds a new custom parameter.
      参数:
        `key` - Custom key starting with "x:".
        `value` - The value for the custom key.

    - #### hasCallbackVar

          public boolean hasCallbackVar()

Copyright © 2020. All Rights Reserved.