org.appng.api

## Interface Webservice

- All Known Subinterfaces:
    AttachmentWebservice

      public interface Webservice

  A `Webservice` usually returns some text-based data like XML, JSON or even plain text, which can directly be displayed/processed by the client. The implementing class needs to be defined in the application's `beans.xml`.

  The resulting URI follows this schema:
  `<site-host>/service/<site-name>/<application-name>/webservice/<bean-id>?<get-params>`
  Example:
  `http://localhost:8080/service/appng/demoapplication/webservice/timeService?country=de`

  Usually, a link to the `Webservice` is provided by defining a `Link` in mode `Linkmode.WEBSERVICE`, where the target is the bean name, optionally with some additional GET-Parameters.

       <link mode="webservice" target="timeService?country=de" >
          <label id="time" />
          <icon>time</icon>
       </link>

  For providing files to download, see `AttachmentWebservice`.
  For 'real' SOAP-Webservices, use `SoapService` instead.
  Consider using a `RequestDataBinder` for binding `Request` parameters to a target object.
  Author:
    Matthias Müller
  See Also:
    `AttachmentWebservice`, `RequestDataBinder`, `SoapService`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getContentType()` Returns the content-type for the data returned by `processRequest(Site, Application, Environment, Request)` (optional)
    `default org.springframework.http.HttpHeaders` | `getHeaders()` Returns the response headers for this service
    `default int` | `getStatus()` Returns the HTTP status code for this service
    `byte[]` | `processRequest(Site site, Application application, Environment environment, Request request)` Processes the current `Request` and return some data.

- - ### Method Detail

    - #### processRequest

          byte[] processRequest(Site site,
                                Application application,
                                Environment environment,
                                Request request)
                         throws BusinessException

      Processes the current `Request` and return some data.
      Parameters:
        `site` - the current `Site`
        `application` - the current `Application`
        `environment` - the current `Environment`
        `request` - the current `Request`
      Returns:
        some bytes
      Throws:
        `BusinessException` - if an error occures during retrieving the data

    - #### getContentType

          String getContentType()

      Returns the content-type for the data returned by `processRequest(Site, Application, Environment, Request)` (optional)
      Returns:
        the content-type

    - #### getStatus

          default int getStatus()

      Returns the HTTP status code for this service
      Returns:
        the HTTP status code

    - #### getHeaders

          default org.springframework.http.HttpHeaders getHeaders()

      Returns the response headers for this service
      Returns:
        the response headers

Copyright © 2011–2023 aiticon GmbH. All rights reserved.