1 #set( $symbol_pound = '#' )
2 #set( $symbol_dollar = '$' )
3 #set( $symbol_escape = '\' )
6 import javax.ws.rs.GET;
7 import javax.ws.rs.Path;
8 import javax.ws.rs.Produces;
9 import javax.ws.rs.core.Context;
10 import javax.ws.rs.core.MediaType;
11 import javax.ws.rs.core.SecurityContext;
13 import org.codehaus.enunciate.jaxrs.StatusCodes;
14 import org.codehaus.enunciate.jaxrs.TypeHint;
21 * Authentication scheme : <b>HTTP Basic</b><br>
22 * Authentication realm : <b>opendaylight</b><br>
23 * Transport : <b>HTTP and HTTPS</b><br>
25 * HTTPS Authentication is disabled by default.
29 public class Northbound {
31 private String username;
34 public void setSecurityContext(SecurityContext context) {
35 if (context != null && context.getUserPrincipal() != null) {
36 username = context.getUserPrincipal().getName();
42 * Sample REST API call
44 * @return A response string
50 * http://localhost:8080/northbound/${artifactId}/api
52 * Response body in XML:
53 * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
54 * Sample Northbound API
56 * Response body in JSON:
57 * Sample Northbound API
62 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
63 @TypeHint(String.class)
65 public String getWidget() {
66 String result = "Sample Northbound API - ${artifactId}";