001
014
015 package com.liferay.portlet.login.action;
016
017 import com.liferay.portal.kernel.captcha.CaptchaUtil;
018 import com.liferay.portal.kernel.log.Log;
019 import com.liferay.portal.kernel.log.LogFactoryUtil;
020 import com.liferay.portal.kernel.portlet.bridges.mvc.MVCResourceCommand;
021 import com.liferay.portal.kernel.spring.osgi.OSGiBeanProperties;
022 import com.liferay.portal.util.PortletKeys;
023
024 import javax.portlet.ResourceRequest;
025 import javax.portlet.ResourceResponse;
026
027
030 @OSGiBeanProperties(
031 property = {
032 "javax.portlet.name=" + PortletKeys.LOGIN,
033 "mvc.command.name=/login/captcha"
034 },
035 service = MVCResourceCommand.class
036 )
037 public class CaptchaMVCResourceCommand implements MVCResourceCommand {
038
039 @Override
040 public boolean serveResource(
041 ResourceRequest resourceRequest, ResourceResponse resourceResponse) {
042
043 try {
044 CaptchaUtil.serveImage(resourceRequest, resourceResponse);
045
046 return false;
047 }
048 catch (Exception e) {
049 _log.error(e, e);
050
051 return true;
052 }
053 }
054
055 private static final Log _log = LogFactoryUtil.getLog(
056 CaptchaMVCResourceCommand.class);
057
058 }