/** * 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); } }
/** * Initializes the web service and starts the main thread */ public void init(Object context) throws ServiceException { servletEndpointContext = (ServletEndpointContext) context; // ensure that entry and result directories exist AccessStructure.ensureExistence(); // create and start jplagCentral thread JPLAG_CENTRAL = JPlagCentral.getInstance(); JPLAG_CENTRAL.start(); }
/** * Initialize this JAX-RPC servlet endpoint. * Calls onInit after successful context initialization. * @param context ServletEndpointContext * @throws ServiceException if the context is not a ServletEndpointContext * @see #onInit */ public final void init(Object context) throws ServiceException { if (!(context instanceof ServletEndpointContext)) { throw new ServiceException("ServletEndpointSupport needs ServletEndpointContext, not [" + context + "]"); } this.servletEndpointContext = (ServletEndpointContext) context; ServletContext servletContext = this.servletEndpointContext.getServletContext(); this.webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); this.messageSourceAccessor = new MessageSourceAccessor(this.webApplicationContext); onInit(); }
/** * Return the current JAX-RPC ServletEndpointContext. */ protected final ServletEndpointContext getServletEndpointContext() { return this.servletEndpointContext; }
private static ServletEndpointContext getContext() { ServletEndpointContext context = endpointContext.get(); return context != null ? context : DEFAULT_CONTEXT; }