Skip to content

Posted by admin - 2 septembre 2014 - no comments

This should be an inevitable check before deploying a JSF portlet in Liferay 6.2, but be careful that, when using PrimeFaces (or lot of other frameworks/third parties) you always MUST…

Posted by admin - 23 avril 2014 - no comments

I recommand 2 Java libraries for JSON: Gson: efficient for POJO bindings (mapping JSON to classes) Jackson: good for generic JSON trees

Posted by admin - 16 avril 2014 - no comments

There is an issue with Primefaces when using the Liferay 6.2 It is required to add the following parameter for each portlet in liferay-portlet.xml. false See : https://issues.liferay.com/browse/FACES-1751

Posted by admin - 12 mars 2014 - no comments

To internationalize your JSF (portlet or application), you need: 1. Your message.properties (and messages_en_US.properties, message_fr.properties, etc.) in one of your src package. Note that it is a list of lines…

Posted by admin - 28 janvier 2014 - no comments

To get the portlet id (or rather portlet instance id) from the Managed Bean, use the following code: LiferayFacesContext context = LiferayFacesContext.getInstance(); String portletId = context.getThemeDisplay().getPortletDisplay().getId();

Posted by admin - 23 janvier 2014 - no comments

There is no way of putting inputs inside a PrimeFaces (orderList is not a UIData component). Therefore, the solution to do it is through… dataTable ! Here is a meaningful…

Posted by admin - 22 janvier 2014 - no comments

In order to send some object data from a Managed Bean to a client-side javascript function, the following approach should be followed. Implement a listener/action method which return the data…

Posted by admin - 22 janvier 2014 - no comments

In order to send to a Managed Bean a JSON javascript variable (or any String variable), a remoteCommand method should be called using the following syntax, in XHTML: <!– javascript…

Posted by admin - 22 janvier 2014 - no comments

If you want to assign a big file containing XML tags to a javascript variable, the following works easily : var jsVariable= #{myBean.jsonString}; Note that the jsonString must be a…

Posted by admin - 20 janvier 2014 - no comments

In order to call a managed bean function with parameters sent from Javascript, here is a 3 steps short tutorial for PrimeFaces. 1. Call a javascript function (jsFunction1) with the…

  • Curl POST on Windows (with JSON request) 14 novembre 2018
    Most of curl versions fail on Windows to Post  JSON data, two simple workaround:1. If Git is installed, use the bash command to open a linux emulated bash. Then simply use the unix curl command. Very easy !2. Second solution: put the json in a file, and refer the file in the command line using […]
  • Tips on Postgres Installation 9 novembre 2018
    Some tips for installing Postgres 10:Install:sudo rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpmsudo yum install postgresql10-server postgresql10sudo /usr/pgsql-10/bin/postgresql-10-setup initdbsudo systemctl start postgresql-10.servicesudo systemctl enable postgresql-10.serviceStop/restart:service postgresql-10 restartEnable md5 authentication (password):1. vi /var/lib/pgsql/10/data/pg_hba.conf (adapt the path)2. set md5 for authentication methods3.restart postgresCreate new user:createuser -P -e gepadminCreate new DB: createdb -e -O gepadmin wpsTest new DB connection:psql -U gepadmin -W -d wps
  • Java get file mime type 9 novembre 2018
    In Java 7 you can now just use Files.probeContentType(path).
  • Glassfish 5.0 Bug Joda Time 9 novembre 2018
    There seems to have a bug of a missing dependency when starting a simple REST Web App (using JPA).It complains about Joda Time missing.
  • Monitor Traffic HTTP with TCPDump 23 octobre 2018
    1. To monitor HTTP traffic including request and response headers and message body: tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)2)) != 0)' 2. To monitor HTTP traffic including request and response headers and message body from a particular source: tcpdump -A -s 0 'src example.com and tcp port 80 and (((ip[2:2] […]
  • Swagger CodeGen Java - Share Model btw Client and Server 23 octobre 2018
    The OpenAPIs 3.0 Code Generator on https://app.swaggerhub.com is pretty much efficient (excepted that it does not handle correctly nesting of allOf/oneOf).A lack of the Java generator is that the generated Jersey server stub does not include a client, and the generated Java client is not based on Jersey but on Gson, so the Jackson annotation are […]
  • Swagger Codegen Jersey: exclude null JSON 5 octobre 2018
    By default, the generated Jersey model includes null values. In order to prevent this, you should edit the JacksonJsonProvider class and add the following line to the new ObjectMapper class:.setSerializationInclusion(JsonInclude.Include.NON_NULL)
  • Redirect 80 traffic to 8080 5 octobre 2018
    sudo iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-ports 8080(note that it only redirects external trafic but not the loopback)
  • XMLBeans String value from XMLObject 26 septembre 2018
    XmlObject implementations can be casted to SimpleValue if the XMLObject simply contains a string value.Example:((SimpleValue)obj).getStringValue();
  • XMLBeans - Assigned a restriced/specialized subElement 26 septembre 2018
    Depending on the options and means use to generate the XMLBeans bindings classes, and the options used to parse the document, you may face situation where "ParentBinding.addGenericChild().set(specializedBinding);" results in a genericElement mixed with the specializedElement instead of having a pure specializedElement being added to the parentElement.As a workaround in such situation, what can you write […]