/** * Calls {@link javax.xml.rpc.server.ServiceLifecycle#init(Object)} * method on target bean if this bean implements * {@link javax.xml.rpc.server.ServiceLifecycle} interface. * * @param invocation current invocation * @throws Exception if any error occurs */ @Override public void onBeforeInvocation(final Invocation invocation) throws Exception { final InvocationContext invocationContext = invocation.getInvocationContext(); final Object targetBean = invocationContext.getTargetBean(); final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle; if (isJaxrpcLifecycleBean) { final ServletEndpointContext sepContext = invocationContext.getAttachment(ServletEndpointContext.class); ((ServiceLifecycle) targetBean).init(sepContext); } }
/** * Calls {@link javax.xml.rpc.server.ServiceLifecycle#destroy()} * method on target bean if this bean implements * {@link javax.xml.rpc.server.ServiceLifecycle} interface. * * @param invocation current invocation * @throws Exception if any error occurs */ @Override public void onAfterInvocation(final Invocation invocation) throws Exception { final InvocationContext invocationContext = invocation.getInvocationContext(); final Object targetBean = invocationContext.getTargetBean(); final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle; if (isJaxrpcLifecycleBean) { ((ServiceLifecycle) targetBean).destroy(); } }
public void init(ServletConfig config) throws ServletException { this.config = config; // this is only used by JaxRPC pojo services pojo = createPojoInstance(); if (pojo instanceof ServiceLifecycle) { try { ((ServiceLifecycle) pojo).init(new InstanceContext(config.getServletContext())); } catch (ServiceException e) { throw new ServletException("Unable to initialize ServiceEndpoint", e); } } getService(); }
public void destroy() { if (pojo instanceof ServiceLifecycle) { ((ServiceLifecycle) pojo).destroy(); } }