1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.captcha;
16  
17  import com.liferay.portal.kernel.captcha.CaptchaUtil;
18  import com.liferay.portal.kernel.log.Log;
19  import com.liferay.portal.kernel.log.LogFactoryUtil;
20  import com.liferay.portal.struts.ActionConstants;
21  import com.liferay.portal.struts.PortletAction;
22  
23  import javax.portlet.ActionRequest;
24  import javax.portlet.ActionResponse;
25  import javax.portlet.PortletConfig;
26  
27  import org.apache.struts.action.ActionForm;
28  import org.apache.struts.action.ActionMapping;
29  
30  /**
31   * <a href="CaptchaPortletAction.java.html"><b><i>View Source</i></b></a>
32   *
33   * @author Brian Wing Shun Chan
34   */
35  public class CaptchaPortletAction extends PortletAction {
36  
37      public void processAction(
38              ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
39              ActionRequest actionRequest, ActionResponse actionResponse)
40          throws Exception {
41  
42          try {
43              CaptchaUtil.serveImage(actionRequest, actionResponse);
44  
45              setForward(actionRequest, ActionConstants.COMMON_NULL);
46          }
47          catch (Exception e) {
48              _log.error(e);
49          }
50      }
51  
52      protected boolean isCheckMethodOnProcessAction() {
53          return _CHECK_METHOD_ON_PROCESS_ACTION;
54      }
55  
56      private static final boolean _CHECK_METHOD_ON_PROCESS_ACTION = false;
57  
58      private static Log _log = LogFactoryUtil.getLog(CaptchaPortletAction.class);
59  
60  }