Entries with tag java times .

In this article we will see in a trivial example a simple way to reduce code duplication while going through the concept of behavior parameterization. In summary, behavior parameterization is characterized as passing pieces of code as parameters to define the behavior of an execution flow. OK, it sounds nice, but let's see it in action to visualize how this powerful concept can help us produce code closer to the problem statement while... Read More AboutBehavior Parameterization  »

It was a beautiful raining morning, when I took advantage of the long weekend to poke around and check how Liferay is using its new taglib Clay, in Liferay 7.1 and 7.2. As beautiful as the morning was, the experience was not that great. As I loved their website and was looking forward to start using Clay, I started browsing... Especially due to this note from their website: Note: AUI taglibs are deprecated as of Liferay Portal CE... Read More About Double Curly Braces Anti Pattern »

We know Liferay is not the most EL friendly piece of software out there, but lots of people do like to be able to user EL. In this post I will show you a simple way to access your portlet namespace using EL, and better yet, get rid of the numerous <portlet:namespace/> that are usually scattered around. The ideal is simple: just put it in a variable using <c:set>. Let's see this in action via this extremely simple snippet.... Read More AboutAccessing your portlet's namespace in EL »

This post will show how easy it is to transform an image into a Base64 String using Java. We will not get into details of why one would need to do it, we are assuming that you considered that this will increase your image size and that you probably have a good idea that you need to transmit your image using Base64 besides the time to convert and the size increase. The idea is simple, get your image as a byte array and encode it into ... Read More AboutImage to Base64 »

Zipping in Java small image

Building Zip files was always easy in Java, but it was always also kind of awkward, and this is because one had to normally go through 3 steps, create the zip output stream, insert an entry and add the bytes for each entry. This is the kind of a weird sequence that leads several to feel that it is easy but it could be better. Liferay for instance uses an ancient library to build files in a easier process, which also works in a... Read More AboutZipping in Java »

Validating a Brazilian CPF number in Java small image

CPFs are in Brazil what SSNs are in US, so you know how important it is to validate them before using in your systems. This is an example of how to validate those numbers, which are represented by Strings in most systems. /******************************************************************************* * Copyright © 2016 Victor Soares (www.e-systems.tech) All rights reserved. * * Redistribution and use in source and binary forms,... Read More AboutValidating a Brazilian CPF number in Java »

login.events.post Dependencies some are just in case you need it.. import javax.servlet.http.HttpSession; import org.osgi.service.component.annotations.Component; import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.LifecycleAction; import com.liferay.portal.kernel.events.LifecycleEvent; Component @Component( immediate = true, property = { "key=login.events.post" }, ... Read More AboutSession events »

Dependencies some are just in case you need it.. import javax.servlet.http.HttpSession; import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; Component @Component(immediate = true, service = MyService.class) or service={} Code @Component(immediate = true, service = MyService.class) public class TrueNTHSessionManagerImpl implements... Read More AboutAction on Module Deactivation »

Dependencies some are just in case you need it.. import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import... Read More AboutAction on Module Activation »

Dependencies import org.osgi.service.component.annotations.Component; import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.LifecycleAction; import com.liferay.portal.kernel.events.SimpleAction; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; Component @Component( immediate = true, property = { "key=application.startup.events" }, ... Read More AboutActions on Startup »

Dependencies import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.osgi.service.component.annotations.Component; import com.liferay.portal.kernel.servlet.BaseFilter; Component @Component( immediate = true, property = { ... Read More AboutFilters in Liferay 7 »

Dependencies some are just in case you need it.. import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import com.liferay.portal.kernel.exception.NoSuchUserException; import com.liferay.portal.kernel.exception.PortalException; import... Read More AboutAutoLogin in Liferay 7 »

Dependencies import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import com.liferay.portal.kernel.struts.BaseStrutsAction; import com.liferay.portal.kernel.struts.StrutsAction; Component @Component( immediate = true, property = { "path=" + AuthPublicPath.CONSTANT_URL , "service.ranking:Integer=" + Integer.MAX_VALUE }, service = StrutsAction.class... Read More AboutStrutsAction in Liferay 7 »

Dependencies import javax.servlet.http.HttpSession; import org.osgi.service.component.annotations.Component; import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.LifecycleAction; import com.liferay.portal.kernel.events.LifecycleEvent; Component @Component( immediate = true, property = { "key=login.events.post" }, service = LifecycleAction.class ) Code @Component( ... Read More AboutCustom Post Login Action "Hook" in Liferay 7 »

Liferay 7 came with several changes that need some getting used to. A major modification in the way we see the platform and develop plugins was brought about by the developers, who enhanced the stack and enriched it with amazing features; among them, the most exiting one is definitely the OSGi support. Although it is still possible to code using the old methodologies and tools, we are thrilled to build with OSGi. And that is why we... Read More AboutLiferay 7, how to get a session object after login? »

— 20 Items per Page
Showing 15 results.