Accesing the webservices using REST


Here i am trying to delete the blogsEntry. Here is the sample code for the REST based application


   String uri = "http://localhost:8080/api/secure/jsonws/blogsentry/delete-entry";
 
   String userName="test@liferay.com";
   String password = "test";
 
   Credentials credentials = new UsernamePasswordCredentials(userName, password);
 
   HttpClient client = new HttpClient();
   client.getState().setCredentials(AuthScope.ANY, credentials);
   client.getParams().setParameter("http.useragent", "Test Client");
   client.getParams().setAuthenticationPreemptive(true);
 
 
   PostMethod postMethod = new PostMethod(uri);
   postMethod.addParameter("entryId", "10101");
 
   int returnCode = 0;
   try {
    returnCode = client.executeMethod(postMethod);
} catch (IOException e) {
e.printStackTrace();
}


Comments

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate