Skip to content

Instantly share code, notes, and snippets.

View tmoreira2020's full-sized avatar

Thiago Leão Moreira tmoreira2020

View GitHub Profile
@tmoreira2020
tmoreira2020 / gist:9bc5dd872136a627717c222a44025f28
Created October 6, 2021 15:08
UnsupportedOperationException: Requires 3.0 opt-in
liferay_1 | 2021-10-06 15:05:09.650 ERROR [http-nio-8080-exec-10][BaseJSPPanelCategory:101] Unable to include /content/content.jsp
liferay_1 | org.apache.jasper.JasperException: java.lang.UnsupportedOperationException: Requires 3.0 opt-in
liferay_1 | at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:440)
liferay_1 | at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
liferay_1 | at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
liferay_1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
liferay_1 | at com.liferay.portal.osgi.web.servlet.jsp.compiler.internal.JspServlet.service(JspServlet.java:368)
liferay_1 | at com.liferay.portal.osgi.web.servlet.jsp.compiler.internal.JspServlet.service(JspServlet.java:380)
liferay_1 | at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153)
liferay_1 | at org.eclipse.equinox.http.servlet.int
@tmoreira2020
tmoreira2020 / setup-regions-for-brazil.groovy
Created February 21, 2020 19:49
Populate Regions for Brazil
// ### Groovy Sample ###
countryId=48;
com.liferay.portal.kernel.service.RegionServiceUtil.addRegion(countryId, "AL", "Alagoas", true);
com.liferay.portal.kernel.service.RegionServiceUtil.addRegion(countryId, "AM", "Amazonas", true);
com.liferay.portal.kernel.service.RegionServiceUtil.addRegion(countryId, "AP", "Amapá", true);
com.liferay.portal.kernel.service.RegionServiceUtil.addRegion(countryId, "BA", "Bahia", true);
com.liferay.portal.kernel.service.RegionServiceUtil.addRegion(countryId, "CE", "Ceará", true);
com.liferay.portal.kernel.service.RegionServiceUtil.addRegion(countryId, "DF",
"Distrito Federal", true);
@tmoreira2020
tmoreira2020 / MainConverter.java
Created February 11, 2020 11:37
Utility class to check and convert a database with lowercase table names to camelcase
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.Statement;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
public class MainConverter {
x20-Feb-2019 00:12:48.590 SEVERE [http-nio2-8080-exec-4] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet [Main Servlet] threw exception
java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-1.8.0-amazon-corretto/jre/lib/amd64/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:61)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32)
@Component(immediate = true, property = {
"type=" + TemplateContextContributor.TYPE_GLOBAL }, service = TemplateContextContributor.class)
public class SabespTemplateContextContributor implements TemplateContextContributor {
protected WheatherService wheatherService;
@Override
public void prepare(Map<String, Object> contextObjects, HttpServletRequest request) {
contextObjects.put("wheaterService", wheatherService);
contextObjects.put("stringService", "teste");
// ### Groovy Sample ###
list = com.liferay.portal.kernel.service.PortletPreferencesLocalServiceUtil.getPortletPreferencesByPlid(20146);
for (preferences in list) {
out.println(preferences)
}
<#assign time1 = .now?time?long>
<#assign perf_count = 0>
<#assign service = serviceLocator.findService("com.liferay.journal.util.JournalContent") >
<#assign model = objectUtil("com.liferay.portal.kernel.portlet.PortletRequestModel", renderRequest, renderResponse)>
<#if entries?has_content>
<#list entries as curEntry>
<#assign renderer = curEntry.getAssetRenderer()>
<#assign article = renderer.getArticle()>
This file has been truncated, but you can view the full file.
18:33:04,921 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.6.Final-redhat-1
18:33:05,669 INFO [org.jboss.msc] (main) JBoss MSC version 1.1.5.Final-redhat-1
18:33:05,743 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) starting
18:33:05,749 DEBUG [org.jboss.as.config] (MSC service thread 1-6) Configured system properties:
[Standalone] =
awt.toolkit = sun.lwawt.macosx.LWCToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
ftp.nonProxyHosts = local|*.local|169.254/16|*.169.254/16
==> default: Running provisioner: shell...
==> default: Machine State ID: active
==> default: IP Address: 45.79.188.40
default: Running: inline script
==> default: c
==> default: u
==> default: r
==> default: l
==> default: :
==> default:
@Test
public void test() {
RestTemplate restTemplate = restTemplate();
Link next = new Link("http://localhost:8080/v1/city?size=250&sort=name&name.dir=asc");
do {
System.out.println(next.getHref());
ResponseEntity<PagedResources<City>> responseEntity = restTemplate.exchange(next.getHref(), HttpMethod.GET, null,
new ParameterizedTypeReference<PagedResources<City>>() {