All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.intellisrc.web.service.Serviciable.groovy Maven / Gradle / Ivy

Go to download

Create restful HTTP (GET, POST, PUT, DELETE, etc) or SSE / WebSocket application services. Manage JSON data from and to the server easily. It is build on top of Jetty library, so it is very powerful but designed to be elegant and easy to use.

The newest version!
package com.intellisrc.web.service

import groovy.transform.CompileStatic

import static com.intellisrc.web.service.Service.*

/**
 * This is the common interface to define Services.
 * By itself is useless. Please extend it and implement
 * its usage inside WebService
 *
 * All paths can include: (@see: http://sparkjava.com/documentation#routes)
 * 
 * /                                : root directory
 * /foo                             : will work with "/foo", but not "/foo/"
 * /foo/bar                         : subdirectory
 * /foo/:var                        : You can read directory using: request.params(":var")
 * /foo/*_/some/*_/bar              : Array can be get with: request.splat()  (*_ = *)
 * 
 *
 * You can read GET parameters like: request.queryParams("name")
 *
 * @since 17/04/03.
 */
@CompileStatic
trait Serviciable {
    String getPath() { return "" }
    String getAllowOrigin() { return null }
    String getAcceptType() { return "" }
    String getAcceptCharset() { return "" }
    Allow getAllow() { return null }

    BeforeRequest getBeforeRequest() { return null }
    BeforeResponse getBeforeResponse() { return null }
    ServiceError getOnError() { return null }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy