Skip to content

Instantly share code, notes, and snippets.

@zaxebo1
Forked from farandal/Api.java
Created August 22, 2018 08:39
Show Gist options
  • Save zaxebo1/97d6e6c171f3c9caad1d7e52b385bbe3 to your computer and use it in GitHub Desktop.
Save zaxebo1/97d6e6c171f3c9caad1d7e52b385bbe3 to your computer and use it in GitHub Desktop.
Play Framework Controller to read Liferay data using the LiferayHelper
package controllers;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import play.*;
import play.api.libs.json.JsValue;
import play.api.libs.json.Json;
import play.api.templates.*;
import play.mvc.*;
import java.lang.String;
import java.lang.reflect.Type;
import java.util.Map;
import views.html.*;
public class Api extends Controller {
public static Result index() {
return ok("");
}
public static Result search(String tags) {
String busqueda = "";
try {
busqueda = LiferayHelper.search(tags);
} catch(Exception e) {
System.out.println(e.getMessage());
}
String text = busqueda.trim();
return ok(text);
}
public static Result get(String id) {
String busqueda = "";
try {
busqueda = LiferayHelper.get(id);
} catch(Exception e) {
System.out.println(e.getMessage());
}
String text = busqueda.trim();
return ok(text);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment