Java tutorial
/******************************************************************************* * QBiC Calendar provides an infrastructure for defining calendars for specific purposes like * booking devices or planning resources for services and integration of relevant data into the * common portal infrastructure. Copyright (C) 2016 Aydn Can Polatkan & David Wojnar * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program. If * not, see http://www.gnu.org/licenses/. *******************************************************************************/ package facs.ui; import java.io.IOException; import javax.portlet.PortletException; import com.vaadin.server.DeploymentConfiguration; import com.vaadin.server.ServiceException; import com.vaadin.server.VaadinPortlet; import com.vaadin.server.VaadinPortletService; import com.vaadin.server.VaadinRequest; /** * * copied from: * https://github.com/jamesfalkner/vaadin-liferay-beacon-demo/blob/master/src/main/java/ * com/liferay/mavenizedbeacons/CustomVaadinPortlet.java This custom Vaadin portlet allows for * serving Vaadin resources like theme or widgetset from its web context (instead of from ROOT). * Usually it doesn't need any changes. * */ public class CustomVaadinPortlet extends VaadinPortlet { private static final long serialVersionUID = -13615405654173335L; private class CustomVaadinPortletService extends VaadinPortletService { /** * */ private static final long serialVersionUID = -6282242585931296999L; public CustomVaadinPortletService(final VaadinPortlet portlet, final DeploymentConfiguration config) throws ServiceException { super(portlet, config); } protected boolean allowServePrecompressedResource(javax.servlet.http.HttpServletRequest request, java.lang.String url) { return false; } /** * This method is used to determine the uri for Vaadin resources like theme or widgetset. It's * overriden to point to this web application context, instead of ROOT context */ @Override public String getStaticFileLocation(final VaadinRequest request) { // return super.getStaticFileLocation(request); // self contained approach: return request.getContextPath(); } } @Override protected void doDispatch(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws javax.portlet.PortletException, java.io.IOException { super.doDispatch(request, response); } @Override public void serveResource(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response) throws PortletException, IOException { super.serveResource(request, response); } @Override protected VaadinPortletService createPortletService(final DeploymentConfiguration deploymentConfiguration) throws ServiceException { final CustomVaadinPortletService customVaadinPortletService = new CustomVaadinPortletService(this, deploymentConfiguration); customVaadinPortletService.init(); return customVaadinPortletService; } }