com.google.sitebricks.headless
Annotation Type Service


@Target(value=TYPE)
@Retention(value=RUNTIME)
public @interface Service

Analogous to @Show but representing a headless (page-less) web service. Sometimes called a Restful web service. This kind of web page has no corresponding template file and the page class returns a response directly.

By default, the service annotation will execute for any valid method bound at the specified URL (with the @At annotation or at() module method).

However, it is possible to selectively dispatch services by specifying a value:


  @At("/doc")@Service("fetch")
   public class FetchDoc { .. }
 
In this scenario, all requests to "/doc" will be tested for the special request parameter "r". If "r" contains "fetch", then FetchDoc will execute, otherwise it will be ignored.

The special request parameter "r" is a comma-separated list of service endpoints that a browser-client wishes to dispatch. This enables several convenient programming models:

The special request parameter "r" can be customized via your SitebricksModule to be anything you like. If no endpoints match the request (i.e. "r=" is empty or corrupt), then a 405 (Method Not Allowed) error is returned.


Optional Element Summary
 String value
           
 

value

public abstract String value
Default:
""


Copyright © 2014. All rights reserved.