-
-
Save zaxebo1/97d6e6c171f3c9caad1d7e52b385bbe3 to your computer and use it in GitHub Desktop.
Play Framework Controller to read Liferay data using the LiferayHelper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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