Java tutorial
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library 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 Lesser General Public License for more * details. */ package com.liferay.map.openstreetmap.internal; import com.liferay.frontend.js.loader.modules.extender.npm.NPMResolver; import com.liferay.map.BaseJSPMapProvider; import com.liferay.map.MapProvider; import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.util.ResourceBundleUtil; import java.util.Locale; import java.util.ResourceBundle; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; /** * @author Jrgen Kappler */ @Component(immediate = true, service = MapProvider.class) public class OpenStreetMapMapProvider extends BaseJSPMapProvider { @Override public String getConfigurationJspPath() { return null; } @Override public String getHelpMessage() { return null; } @Override public String getJspPath() { return "/view.jsp"; } @Override public String getKey() { return "OpenStreetMap"; } @Override public String getLabel(Locale locale) { ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language", locale, getClass()); return LanguageUtil.get(resourceBundle, "openstreetmap"); } @Override @Reference(target = "(osgi.web.symbolicname=com.liferay.map.openstreetmap)", unbind = "-") public void setServletContext(ServletContext servletContext) { super.setServletContext(servletContext); } @Override protected void prepareRequest(HttpServletRequest request) { String resolvedModuleName = _npmResolver.resolveModuleName("map-openstreetmap/js/MapOpenStreetMap.es"); request.setAttribute("liferay-map:map:bootstrapRequire", resolvedModuleName + " as MapOpenStreetMap"); } @Reference private NPMResolver _npmResolver; }