Wednesday, March 29, 2017

How to convert DBCursor to JsonNode in Play

The code below only applicable when using mongoDB and Play framework together.

com.mongodb.util.JSON json =new JSON();
String serializedCursor = json.serialize(cursor);

com.fasterxml.jackson.databind.JsonNode jsonData = play.libs.Json.parse(serializedCursor);


Monday, March 20, 2017

New line in Oracle Report

to pass a new line as a parameter from java to Oracle report,
we need the follow syxtax instead of "\n".



Sunday, March 19, 2017

How to configure Liferay Language portlet as Select Box

 Image above shown the default Liferay Language portlet.

to change the default display option, please follow the steps below.
1. Login to Liferay as Administrator

2. navigate to the portlet setting to open the Language configuration.

Friday, March 17, 2017

How to post json to Liferay OSGI restful service

To post a json to a Liferay OSGI restful service,
the service method itself must be able to accept String as the input parameter.
the service method is then parse the json string to a json object
follow by the required function process
and lastly return the response to the service consumer

public Response addPerson(final String personJsonString) {

    ObjectMapper mapper = new ObjectMapper();
    JsonNode personJson = mapper.readTree(personJsonString);

     * Process person json 
    return Response.status(Response.Status.OK).build();



Related Posts Plugin for WordPress, Blogger...