• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error : Cannot make a static reference to the non-static method getQuery() from the type Resource

 
Geetha Ganesh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my code inside the method:
@Post
public static String getDetails(Representation entity) throws Exception {

String customerId = getQuery().getValues("cus_id");

}

I use this code in Restlet Representation. I try to get the value from the Request API. But I am facing the problem as "Cannot make a static reference to the non-static method getQuery() from the type Resource". Please help me to solve this.
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is your method marked static?
public static String getDetails
 
Geetha Ganesh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya.. I got it. I made a silly mistake. The solution for my problem that I have found is
1. Make the method inside public static void main(){}
2. As usual, Create object for the class and call the function.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!