Annotation Interface JSONP


@Target(METHOD) @Retention(RUNTIME) @Documented public @interface JSONP
Annotation can be used to define the JavaScript callback function name if the valid JSONP format is requested as an acceptable media type of this request. At the moment only resource methods are supported to be annotated with this annotation.

The acceptable JavaScript media types for JSONP compatible with this annotation are:

  • application/x-javascript
  • application/javascript
  • application/ecmascript
  • text/javascript
  • text/x-javascript
  • text/ecmascript
  • text/jscript

Note: Determining the JavaScript callback function name from a query parameter (queryParam()) takes precedence over the callback() value.

Author:
Michal Gajdos
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Name of the JavaScript callback function to which the JSON result should be wrapped into.
    If set then the JavaScript callback function name is obtained from a query parameter with the given name.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Default JavaScript callback function name.
    static final String
    Default query parameter name to obtain the JavaScript callback function name from.
  • Field Details

    • DEFAULT_CALLBACK

      static final String DEFAULT_CALLBACK
      Default JavaScript callback function name.
      See Also:
    • DEFAULT_QUERY

      static final String DEFAULT_QUERY
      Default query parameter name to obtain the JavaScript callback function name from.
      See Also:
  • Element Details

    • callback

      String callback
      Name of the JavaScript callback function to which the JSON result should be wrapped into.
      Default:
      "callback"
    • queryParam

      String queryParam
      If set then the JavaScript callback function name is obtained from a query parameter with the given name. If this query parameter is not present in the request then the value of callback() property is used as the JavaScript callback function name.
      Default:
      ""