Annotation Type Get


  • @Target(METHOD)
    @Retention(RUNTIME)
    public @interface Get
    Marks a method as one which generates content for the given resource

    The method return type can be

    • void, in which case you must write content to the outputStream in the method call
    • a byte[] which is written to the output
    • an InputStream, which will be written to output, then closed (in a try/finally block)
    • a String, which is interpreted as a template name. The ViewResolver is used to locate a template with the given name, and it is invoked with a model object with name "resource"
    • a ModelAndView which is passed to the ViewResolver to execute the template
    Any other return type causes an exception

    The input parameters must be:

    • first must be the source object
    • then any of Request, Response, Range, contentType (String), parameters (Map), OutputStream
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String contentType
      If specified, will only match on requests with the given content type
      long maxAgeSecs
      Default is -1 which means use the system default.
      String[] params
      If present, only requests which contain all of the given parameters will be matched
    • Element Detail

      • contentType

        String contentType
        If specified, will only match on requests with the given content type
        Returns:
        Default:
        ""
      • params

        String[] params
        If present, only requests which contain all of the given parameters will be matched
        Returns:
        Default:
        {}
      • maxAgeSecs

        long maxAgeSecs
        Default is -1 which means use the system default. Returning 0 will explicitly disabled caching. Any other value is the number of seconds that the content may be cached by clients
        Returns:
        Default:
        -1L