Announcement Announcement Module
Collapse
No announcement yet.
AOP with DWR Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP with DWR

    I am using RegexpMethodPointcutAdvisor to invoke a method. It works fine when i call the method in handleRequest or any other for that matter. However if I use DWR to call the method through client-side javascript, it does not seem to work. I have included some code below:

    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailS enderImpl">
    <property name="host"><value>${mail.host}</value></property>
    <property name="username"><value>${mail.username}</value></property>
    <property name="password"><value>${mail.password}</value></property>
    </bean>
    <bean id="emailAdvice" class="com.tvsa.timekeeper.logic.SendConfirmationE mail">
    <property name="mailSender"><ref local="mailSender"/></property>
    </bean>
    <bean id="emailAdvisor" class="org.springframework.aop.support.RegexpMetho dPointcutAdvisor">
    <constructor-arg><ref local="emailAdvice"/></constructor-arg>
    <property name="pattern">
    <list>
    <value>.*complete.*</value>
    </list>
    </property>
    </bean>
    <bean id="time" parent="baseTransactionProxy">
    <property name="target">
    <bean class="com.tvsa.timekeeper.logic.TimeKeeperImpl">
    <property name="adminDao"><ref bean="adminDao"/></property>
    <property name="employeeDao"><ref bean="employeeDao"/></property>

    </bean>
    </property>
    <!---->
    <property name="postInterceptors">
    <list>
    <ref local="emailAdvisor"/>
    </list>
    </property>

    </bean>



    public void afterReturning(Object returnValue, Method m, Object[] args, Object target) throws Throwable {

    logger.info("AOP after called, emp id:" + ((EmployeePayPeriod)args[0]).getEmployeeId());

    SimpleMailMessage mailMessage = new SimpleMailMessage();
    mailMessage.setTo("[email protected]"); //employee.getEmail()
    mailMessage.setFrom(this.mailFrom);
    mailMessage.setSubject(this.subject);
    mailMessage.setText(text.toString());
    try {
    this.mailSender.send(mailMessage);
    }
    catch (MailException ex) {
    // just log it and go on
    logger.warn("An exception occured when trying to send email", ex);
    }
    }



    Not sure what I am missing. Thanks for your help.
Working...
X