/** * 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.mobile.device.rules.rule.group.action; import com.liferay.mobile.device.rules.action.ActionHandler; import com.liferay.mobile.device.rules.model.MDRAction; import com.liferay.portal.kernel.util.GetterUtil; import com.liferay.portal.kernel.util.UnicodeProperties; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.osgi.service.component.annotations.Component; /** * @author Edward Han */ @Component(immediate = true, service = ActionHandler.class) public class SimpleRedirectActionHandler extends BaseRedirectActionHandler { public static String getHandlerType() { return SimpleRedirectActionHandler.class.getName(); } @Override public Collection<String> getPropertyNames() { return _propertyNames; } @Override public String getType() { return getHandlerType(); } @Override protected String getURL( MDRAction mdrAction, HttpServletRequest request, HttpServletResponse response) { UnicodeProperties typeSettingsProperties = mdrAction.getTypeSettingsProperties(); return GetterUtil.getString(typeSettingsProperties.getProperty("url")); } private static final Collection<String> _propertyNames = Collections.unmodifiableCollection(Arrays.asList("url")); }