1 17 package org.alfresco.repo.webservice.axis; 18 19 import javax.servlet.ServletContext ; 20 import javax.servlet.http.HttpServletRequest ; 21 22 import org.apache.axis.AxisFault; 23 import org.apache.axis.MessageContext; 24 import org.apache.axis.handlers.BasicHandler; 25 import org.apache.axis.transport.http.HTTPConstants; 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 import org.apache.ws.security.handler.WSHandlerConstants; 29 import org.springframework.web.context.WebApplicationContext; 30 import org.springframework.web.context.support.WebApplicationContextUtils; 31 32 42 public class TicketCallbackSpringHandler extends BasicHandler 43 { 44 private static final Log logger = LogFactory.getLog(TicketCallbackSpringHandler.class); 45 private static final String BEAN_NAME = "ticketCallbackHandler"; 46 private static final long serialVersionUID = -135125831180499667L; 47 48 51 public void invoke(MessageContext msgContext) throws AxisFault 52 { 53 HttpServletRequest req = (HttpServletRequest )msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST); 55 ServletContext servletCtx = req.getSession().getServletContext(); 56 WebApplicationContext webAppCtx = WebApplicationContextUtils.getRequiredWebApplicationContext(servletCtx); 57 TicketCallbackHandler callback = (TicketCallbackHandler)webAppCtx.getBean(BEAN_NAME); 58 59 msgContext.setProperty(WSHandlerConstants.PW_CALLBACK_REF, callback); 61 } 62 } 63 | Popular Tags |