Merge "Topology Manager to avoid redundant edge updates"
[controller.git] / opendaylight / northbound / archetype-app-northbound / src / main / resources / archetype-resources / src / main / java / Northbound.java
1 #set( $symbol_pound = '#' )
2 #set( $symbol_dollar = '$' )
3 #set( $symbol_escape = '\' )
4 package ${package};
5
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;
12
13 import org.codehaus.enunciate.jaxrs.StatusCodes;
14 import org.codehaus.enunciate.jaxrs.TypeHint;
15
16 /**
17  * Northbound REST API
18  *
19  * <br>
20  * <br>
21  * Authentication scheme : <b>HTTP Basic</b><br>
22  * Authentication realm : <b>opendaylight</b><br>
23  * Transport : <b>HTTP and HTTPS</b><br>
24  * <br>
25  * HTTPS Authentication is disabled by default.
26  */
27
28 @Path("/")
29 public class Northbound {
30
31     private String username;
32
33     @Context
34     public void setSecurityContext(SecurityContext context) {
35         if (context != null && context.getUserPrincipal() != null) {
36             username = context.getUserPrincipal().getName();
37         }
38     }
39
40     /**
41      *
42      * Sample REST API call
43      *
44      * @return A response string
45      *
46      *         <pre>
47      * Example:
48      *
49      * Request URL:
50      * http://localhost:8080/northbound/${artifactId}/api
51      *
52      * Response body in XML:
53      * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
54      * Sample Northbound API
55      *
56      * Response body in JSON:
57      * Sample Northbound API
58      * </pre>
59      */
60     @Path("/api")
61     @GET
62     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
63     @TypeHint(String.class)
64     @StatusCodes()
65     public String getWidget() {
66         String result = "Sample Northbound API - ${artifactId}";
67         return result;
68     }
69
70 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.