/** * 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.portal.captcha; import com.liferay.portal.kernel.captcha.CaptchaUtil; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.struts.PortletAction; import javax.portlet.PortletConfig; import javax.portlet.ResourceRequest; import javax.portlet.ResourceResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; /** * @author Brian Wing Shun Chan */ public class CaptchaPortletAction extends PortletAction { @Override public void serveResource( ActionMapping actionMapping, ActionForm actionForm, PortletConfig portletConfig, ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception { try { CaptchaUtil.serveImage(resourceRequest, resourceResponse); } catch (Exception e) { _log.error(e); } } @Override protected boolean isCheckMethodOnProcessAction() { return _CHECK_METHOD_ON_PROCESS_ACTION; } private static final boolean _CHECK_METHOD_ON_PROCESS_ACTION = false; private static final Log _log = LogFactoryUtil.getLog( CaptchaPortletAction.class); }