Struts plugin, uses the module config.
| Method from com.octo.captcha.module.struts.CaptchaServicePlugin Detail: |
public void destroy() {
if (service instanceof ManageableCaptchaService &&
captchaModuleConfig.getRegisterToMbean().booleanValue()) {
JMXRegistrationHelper.unregisterFromMBeanServer(
CaptchaModuleConfig.JMX_REGISTERING_NAME);
}
}
|
public String getIdKey() {
return captchaModuleConfig.getIdKey();
}
|
public String getIdType() {
return captchaModuleConfig.getIdType();
}
|
public static CaptchaServicePlugin getInstance() {
return instance;
}
|
public String getMessageKey() {
return captchaModuleConfig.getMessageKey();
}
|
public String getMessageType() {
return captchaModuleConfig.getMessageType();
}
|
public String getMessageValue() {
return captchaModuleConfig.getMessageValue();
}
|
public Boolean getRegisterToMbean() {
return captchaModuleConfig.getRegisterToMbean();
}
|
public String getResponseKey() {
return captchaModuleConfig.getResponseKey();
}
|
public CaptchaService getService() {
return service;
}
|
public String getServiceClass() {
return captchaModuleConfig.getServiceClass();
}
|
public void init(ActionServlet servlet,
ModuleConfig config) throws ServletException {
instance = this;
if (log.isDebugEnabled()) {
log.debug("Starting struts-captcha plugin initialization");
}
this.servlet = servlet;
//validate configuration
captchaModuleConfig.validate();
// create the CaptchaService
try {
service = (CaptchaService)
Class.forName(captchaModuleConfig.getServiceClass()).newInstance();
} catch (InstantiationException e) {
log.error("Error during Service Class initialization", e);
throw new CaptchaServiceException(e);
} catch (IllegalAccessException e) {
log.error("Error during Service Class initialization", e);
throw new CaptchaServiceException(e);
} catch (ClassNotFoundException e) {
log.error("Error during Service Class initialization", e);
throw new CaptchaServiceException(e);
}
// register the CaptchaService to an MBean server if specified
if (captchaModuleConfig.getRegisterToMbean().booleanValue()
&& service instanceof ManageableCaptchaService) {
ManageableCaptchaService manageable =
(ManageableCaptchaService) service;
JMXRegistrationHelper.registerToMBeanServer(manageable,
CaptchaModuleConfig.JMX_REGISTERING_NAME);
}
if (log.isDebugEnabled()) {
log.debug("struts-captcha plugin initialization successfull");
}
}
|
public void setIdKey(String idKey) {
captchaModuleConfig.setIdKey(idKey);
}
|
public void setIdType(String idType) {
captchaModuleConfig.setIdType(idType);
}
|
public void setMessageKey(String messageKey) {
captchaModuleConfig.setMessageKey(messageKey);
}
|
public void setMessageType(String messageType) {
captchaModuleConfig.setMessageType(messageType);
}
|
public void setMessageValue(String messageValue) {
captchaModuleConfig.setMessageValue(messageValue);
}
|
public void setRegisterToMbean(Boolean registerToMbean) {
captchaModuleConfig.setRegisterToMbean(registerToMbean);
}
|
public void setResponseKey(String responseKey) {
captchaModuleConfig.setResponseKey(responseKey);
}
|
public void setServiceClass(String serviceClass) {
captchaModuleConfig.setServiceClass(serviceClass);
}
|