Software Defined Networking
1753508 Members
4764 Online
108795 Solutions
New Discussion

REST API's display in RSdoc of Controller

 
VandewillySilva
Occasional Visitor

Re: REST API's display in RSdoc of Controller

Where is the javadoc? RSdoc takes the Javadoc to generate the REST API documentation.

/**
* Some important description here.
* <p/>
* Normal Response Code(s): ok (204)
* <p/>
* Error Response Codes: unauthorized (401), forbidden (403), badMethod
* (405), serviceUnavailable (503)
*
* @return Response the description for your method here
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response list() {
NetworkService service = get(NetworkService.class);
List<Router> routers = service.getal();

JsonService jsonService = get(JsonService.class);
String json = jsonService.toJsonList(routers, Router.class, true);

return ok(json).build();
}

Chethan_R
Occasional Advisor

Re: REST API's display in RSdoc of Controller

 

Hi,

 

Thanks for reply. I got my rest API working and the problem was with my curl command in which i missed my application name in command. The CMD is

 

  $ curl -sk -H "X-Auth-Token:577e4322e7a84d5f94f8a89696dd799a" https://x.x.x.x:8443/sdn/dr/v1.0/routers.

 

In above command i added my app name "dr" and it's working fine. Now My rest Api's are exposed and it is resolved.

 

But now i'm getting error  response from my REST API. Below is the error response  

 

CMD = $ curl -sk -H "X-Auth-Token:225bea05343847ba9e185ae8a88b26b7" https://x.x.x.x:8443/sdn/dr/v1.0/routers

 

Response = <html><head><title>Apache Tomcat/7.0.35 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException
com.mp.dr.rs.CurrentResources.List(CurrentResources.java:38)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
com.hp.util.rs.auth.AbstractTokenAuthFilter.doFilter(AbstractTokenAuthFilter.java:106)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.35 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.35</h3></body></html>

 

 

Please help me in resolving this issue.

 

Thankyou in advance