For 7.0, this can be an example:
<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext()>
<#assign themeDisplay = serviceContext.getThemeDisplay() />
In order for the above snippet to work, the import of com.liferay.portal.kernel.service
package shall be declared. This can be done in two ways:
a) At Portal level, through the module.framework.web.generator.default.servlet.packages portal property: https://docs.liferay.com/dxp/digital-enterprise/7.0-latest/propertiesdoc/portal.properties.html#Module%20Framework%20Web%20Application%20Bundles
module.framework.web.generator.default.servlet.packages=\
com.liferay.portal.kernel.service,\
com.liferay.portal.model,\
com.liferay.portal.security.access.control,\
com.liferay.portal.security.auth,\
com.liferay.portal.security.permission,\
com.liferay.portal.service,\
com.liferay.portal.servlet,\
com.liferay.portal.servlet.filters.aggregate,\
com.liferay.portal.servlet.filters.dynamiccss,\
com.liferay.portal.osgi.web.servlet.jsp.compiler,\
com.liferay.portal.spring.context,\
com.liferay.portal.theme,\
com.liferay.portal.util,\
com.liferay.portlet,\
com.sun.el,\
com.sun.el.lang,\
com.sun.el.parser,\
com.sun.el.stream,\
com.sun.el.util,\
org.apache.commons.chain.generic,\
org.apache.naming.java,\
\
#
# WebSocketSupport
#
\
com.ibm.websphere.wsoc,\
io.undertow.websockets.jsr,\
javax.websocket,\
javax.websocket.server,\
org.apache.tomcat.websocket.server,\
org.eclipse.jetty.websocket.server,\
org.glassfish.tyrus.servlet,\
weblogic.websocket.tyrus
2) At WAR level, by adding:
Import-Package: com.liferay.portal.kernel.service;resolution:=optional
in the war's WEB-INF\liferay-plugin-package.properties file.