org.springframework.remoting.RemoteLookupFailureException Java Examples
The following examples show how to use
org.springframework.remoting.RemoteLookupFailureException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JndiRmiClientInterceptor.java From java-technology-stack with MIT License | 6 votes |
/** * Fetches the RMI stub on startup, if necessary. * @throws RemoteLookupFailureException if RMI stub creation failed * @see #setLookupStubOnStartup * @see #lookupStub */ public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { Object remoteObj = lookupStub(); if (logger.isDebugEnabled()) { if (remoteObj instanceof RmiInvocationHandler) { logger.debug("JNDI RMI object [" + getJndiName() + "] is an RMI invoker"); } else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + "] for JNDI RMI object [" + getJndiName() + "] - " + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { this.cachedStub = remoteObj; } } }
Example #2
Source File: JndiRmiClientInterceptor.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Fetches the RMI stub on startup, if necessary. * @throws RemoteLookupFailureException if RMI stub creation failed * @see #setLookupStubOnStartup * @see #lookupStub */ public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { Object remoteObj = lookupStub(); if (logger.isDebugEnabled()) { if (remoteObj instanceof RmiInvocationHandler) { logger.debug("JNDI RMI object [" + getJndiName() + "] is an RMI invoker"); } else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + "] for JNDI RMI object [" + getJndiName() + "] - " + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { this.cachedStub = remoteObj; } } }
Example #3
Source File: RmiClientInterceptor.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Fetches RMI stub on startup, if necessary. * @throws RemoteLookupFailureException if RMI stub creation failed * @see #setLookupStubOnStartup * @see #lookupStub */ public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { Remote remoteObj = lookupStub(); if (logger.isDebugEnabled()) { if (remoteObj instanceof RmiInvocationHandler) { logger.debug("RMI stub [" + getServiceUrl() + "] is an RMI invoker"); } else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + "] for RMI stub [" + getServiceUrl() + "] - " + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { this.cachedStub = remoteObj; } } }
Example #4
Source File: RmiClientInterceptor.java From spring-analysis-note with MIT License | 6 votes |
/** * Fetches RMI stub on startup, if necessary. * @throws RemoteLookupFailureException if RMI stub creation failed * @see #setLookupStubOnStartup * @see #lookupStub */ public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { Remote remoteObj = lookupStub(); if (logger.isDebugEnabled()) { if (remoteObj instanceof RmiInvocationHandler) { logger.debug("RMI stub [" + getServiceUrl() + "] is an RMI invoker"); } else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + "] for RMI stub [" + getServiceUrl() + "] - " + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { this.cachedStub = remoteObj; } } }
Example #5
Source File: RmiClientInterceptor.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Fetches RMI stub on startup, if necessary. * @throws RemoteLookupFailureException if RMI stub creation failed * @see #setLookupStubOnStartup * @see #lookupStub */ public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { Remote remoteObj = lookupStub(); if (logger.isDebugEnabled()) { if (remoteObj instanceof RmiInvocationHandler) { logger.debug("RMI stub [" + getServiceUrl() + "] is an RMI invoker"); } else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + "] for RMI stub [" + getServiceUrl() + "] - " + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { this.cachedStub = remoteObj; } } }
Example #6
Source File: JndiRmiClientInterceptor.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Fetches the RMI stub on startup, if necessary. * @throws RemoteLookupFailureException if RMI stub creation failed * @see #setLookupStubOnStartup * @see #lookupStub */ public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { Object remoteObj = lookupStub(); if (logger.isDebugEnabled()) { if (remoteObj instanceof RmiInvocationHandler) { logger.debug("JNDI RMI object [" + getJndiName() + "] is an RMI invoker"); } else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + "] for JNDI RMI object [" + getJndiName() + "] - " + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { this.cachedStub = remoteObj; } } }
Example #7
Source File: RmiClientInterceptor.java From java-technology-stack with MIT License | 6 votes |
/** * Fetches RMI stub on startup, if necessary. * @throws RemoteLookupFailureException if RMI stub creation failed * @see #setLookupStubOnStartup * @see #lookupStub */ public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { Remote remoteObj = lookupStub(); if (logger.isDebugEnabled()) { if (remoteObj instanceof RmiInvocationHandler) { logger.debug("RMI stub [" + getServiceUrl() + "] is an RMI invoker"); } else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + "] for RMI stub [" + getServiceUrl() + "] - " + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { this.cachedStub = remoteObj; } } }
Example #8
Source File: JndiRmiClientInterceptor.java From spring-analysis-note with MIT License | 6 votes |
/** * Fetches the RMI stub on startup, if necessary. * @throws RemoteLookupFailureException if RMI stub creation failed * @see #setLookupStubOnStartup * @see #lookupStub */ public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { Object remoteObj = lookupStub(); if (logger.isDebugEnabled()) { if (remoteObj instanceof RmiInvocationHandler) { logger.debug("JNDI RMI object [" + getJndiName() + "] is an RMI invoker"); } else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + "] for JNDI RMI object [" + getJndiName() + "] - " + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { this.cachedStub = remoteObj; } } }
Example #9
Source File: JndiRmiClientInterceptor.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Return the RMI stub to use. Called for each invocation. * <p>The default implementation returns the stub created on initialization, * if any. Else, it invokes {@link #lookupStub} to get a new stub for * each invocation. This can be overridden in subclasses, for example in * order to cache a stub for a given amount of time before recreating it, * or to test the stub whether it is still alive. * @return the RMI stub to use for an invocation * @throws NamingException if stub creation failed * @throws RemoteLookupFailureException if RMI stub creation failed */ protected Object getStub() throws NamingException, RemoteLookupFailureException { if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) { return (this.cachedStub != null ? this.cachedStub : lookupStub()); } else { synchronized (this.stubMonitor) { if (this.cachedStub == null) { this.cachedStub = lookupStub(); } return this.cachedStub; } } }
Example #10
Source File: AbstractRemoteSlsbInvokerInterceptor.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * This overridden lookup implementation performs a narrow operation * after the JNDI lookup, provided that a home interface is specified. * @see #setHomeInterface * @see javax.rmi.PortableRemoteObject#narrow */ @Override protected Object lookup() throws NamingException { Object homeObject = super.lookup(); if (this.homeInterface != null) { try { homeObject = PortableRemoteObject.narrow(homeObject, this.homeInterface); } catch (ClassCastException ex) { throw new RemoteLookupFailureException( "Could not narrow EJB home stub to home interface [" + this.homeInterface.getName() + "]", ex); } } return homeObject; }
Example #11
Source File: AbstractRemoteSlsbInvokerInterceptor.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Refresh the EJB home object and retry the given invocation. * Called by invoke on connect failure. * @param invocation the AOP method invocation * @return the invocation result, if any * @throws Throwable in case of invocation failure * @see #invoke */ protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable { try { refreshHome(); } catch (NamingException ex) { throw new RemoteLookupFailureException("Failed to locate remote EJB [" + getJndiName() + "]", ex); } return doInvoke(invocation); }
Example #12
Source File: BurlapClientInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Initialize the Burlap proxy for this interceptor. * @throws RemoteLookupFailureException if the service URL is invalid */ public void prepare() throws RemoteLookupFailureException { try { this.burlapProxy = createBurlapProxy(this.proxyFactory); } catch (MalformedURLException ex) { throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", ex); } }
Example #13
Source File: RmiClientInterceptor.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Return the RMI stub to use. Called for each invocation. * <p>The default implementation returns the stub created on initialization, * if any. Else, it invokes {@link #lookupStub} to get a new stub for * each invocation. This can be overridden in subclasses, for example in * order to cache a stub for a given amount of time before recreating it, * or to test the stub whether it is still alive. * @return the RMI stub to use for an invocation * @throws RemoteLookupFailureException if RMI stub creation failed * @see #lookupStub */ protected Remote getStub() throws RemoteLookupFailureException { if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) { return (this.cachedStub != null ? this.cachedStub : lookupStub()); } else { synchronized (this.stubMonitor) { if (this.cachedStub == null) { this.cachedStub = lookupStub(); } return this.cachedStub; } } }
Example #14
Source File: HessianClientInterceptor.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Initialize the Hessian proxy for this interceptor. * @throws RemoteLookupFailureException if the service URL is invalid */ public void prepare() throws RemoteLookupFailureException { try { this.hessianProxy = createHessianProxy(this.proxyFactory); } catch (MalformedURLException ex) { throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", ex); } }
Example #15
Source File: AbstractRemoteSlsbInvokerInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Refresh the EJB home object and retry the given invocation. * Called by invoke on connect failure. * @param invocation the AOP method invocation * @return the invocation result, if any * @throws Throwable in case of invocation failure * @see #invoke */ protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable { try { refreshHome(); } catch (NamingException ex) { throw new RemoteLookupFailureException("Failed to locate remote EJB [" + getJndiName() + "]", ex); } return doInvoke(invocation); }
Example #16
Source File: AbstractRemoteSlsbInvokerInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
/** * This overridden lookup implementation performs a narrow operation * after the JNDI lookup, provided that a home interface is specified. * @see #setHomeInterface * @see javax.rmi.PortableRemoteObject#narrow */ @Override protected Object lookup() throws NamingException { Object homeObject = super.lookup(); if (this.homeInterface != null) { try { homeObject = PortableRemoteObject.narrow(homeObject, this.homeInterface); } catch (ClassCastException ex) { throw new RemoteLookupFailureException( "Could not narrow EJB home stub to home interface [" + this.homeInterface.getName() + "]", ex); } } return homeObject; }
Example #17
Source File: JaxWsPortClientInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Prepare the given JAX-WS port stub, applying properties to it. * Called by {@link #prepare}. * @param stub the current JAX-WS port stub * @see #setUsername * @see #setPassword * @see #setEndpointAddress * @see #setMaintainSession * @see #setCustomProperties */ protected void preparePortStub(Object stub) { Map<String, Object> stubProperties = new HashMap<String, Object>(); String username = getUsername(); if (username != null) { stubProperties.put(BindingProvider.USERNAME_PROPERTY, username); } String password = getPassword(); if (password != null) { stubProperties.put(BindingProvider.PASSWORD_PROPERTY, password); } String endpointAddress = getEndpointAddress(); if (endpointAddress != null) { stubProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress); } if (isMaintainSession()) { stubProperties.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE); } if (isUseSoapAction()) { stubProperties.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE); } String soapActionUri = getSoapActionUri(); if (soapActionUri != null) { stubProperties.put(BindingProvider.SOAPACTION_URI_PROPERTY, soapActionUri); } stubProperties.putAll(getCustomProperties()); if (!stubProperties.isEmpty()) { if (!(stub instanceof BindingProvider)) { throw new RemoteLookupFailureException("Port stub of class [" + stub.getClass().getName() + "] is not a customizable JAX-WS stub: it does not implement interface [javax.xml.ws.BindingProvider]"); } ((BindingProvider) stub).getRequestContext().putAll(stubProperties); } }
Example #18
Source File: JndiRmiClientInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Return the RMI stub to use. Called for each invocation. * <p>The default implementation returns the stub created on initialization, * if any. Else, it invokes {@link #lookupStub} to get a new stub for * each invocation. This can be overridden in subclasses, for example in * order to cache a stub for a given amount of time before recreating it, * or to test the stub whether it is still alive. * @return the RMI stub to use for an invocation * @throws NamingException if stub creation failed * @throws RemoteLookupFailureException if RMI stub creation failed */ protected Object getStub() throws NamingException, RemoteLookupFailureException { if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) { return (this.cachedStub != null ? this.cachedStub : lookupStub()); } else { synchronized (this.stubMonitor) { if (this.cachedStub == null) { this.cachedStub = lookupStub(); } return this.cachedStub; } } }
Example #19
Source File: BurlapClientInterceptor.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Initialize the Burlap proxy for this interceptor. * @throws RemoteLookupFailureException if the service URL is invalid */ public void prepare() throws RemoteLookupFailureException { try { this.burlapProxy = createBurlapProxy(this.proxyFactory); } catch (MalformedURLException ex) { throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", ex); } }
Example #20
Source File: JaxWsPortClientInterceptor.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Prepare the given JAX-WS port stub, applying properties to it. * Called by {@link #prepare}. * @param stub the current JAX-WS port stub * @see #setUsername * @see #setPassword * @see #setEndpointAddress * @see #setMaintainSession * @see #setCustomProperties */ protected void preparePortStub(Object stub) { Map<String, Object> stubProperties = new HashMap<String, Object>(); String username = getUsername(); if (username != null) { stubProperties.put(BindingProvider.USERNAME_PROPERTY, username); } String password = getPassword(); if (password != null) { stubProperties.put(BindingProvider.PASSWORD_PROPERTY, password); } String endpointAddress = getEndpointAddress(); if (endpointAddress != null) { stubProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress); } if (isMaintainSession()) { stubProperties.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE); } if (isUseSoapAction()) { stubProperties.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE); } String soapActionUri = getSoapActionUri(); if (soapActionUri != null) { stubProperties.put(BindingProvider.SOAPACTION_URI_PROPERTY, soapActionUri); } stubProperties.putAll(getCustomProperties()); if (!stubProperties.isEmpty()) { if (!(stub instanceof BindingProvider)) { throw new RemoteLookupFailureException("Port stub of class [" + stub.getClass().getName() + "] is not a customizable JAX-WS stub: it does not implement interface [javax.xml.ws.BindingProvider]"); } ((BindingProvider) stub).getRequestContext().putAll(stubProperties); } }
Example #21
Source File: RmiClientInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Return the RMI stub to use. Called for each invocation. * <p>The default implementation returns the stub created on initialization, * if any. Else, it invokes {@link #lookupStub} to get a new stub for * each invocation. This can be overridden in subclasses, for example in * order to cache a stub for a given amount of time before recreating it, * or to test the stub whether it is still alive. * @return the RMI stub to use for an invocation * @throws RemoteLookupFailureException if RMI stub creation failed * @see #lookupStub */ protected Remote getStub() throws RemoteLookupFailureException { if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) { return (this.cachedStub != null ? this.cachedStub : lookupStub()); } else { synchronized (this.stubMonitor) { if (this.cachedStub == null) { this.cachedStub = lookupStub(); } return this.cachedStub; } } }
Example #22
Source File: HessianClientInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Initialize the Hessian proxy for this interceptor. * @throws RemoteLookupFailureException if the service URL is invalid */ public void prepare() throws RemoteLookupFailureException { try { this.hessianProxy = createHessianProxy(this.proxyFactory); } catch (MalformedURLException ex) { throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", ex); } }
Example #23
Source File: JaxWsPortClientInterceptor.java From java-technology-stack with MIT License | 5 votes |
/** * Prepare the given JAX-WS port stub, applying properties to it. * Called by {@link #prepare}. * @param stub the current JAX-WS port stub * @see #setUsername * @see #setPassword * @see #setEndpointAddress * @see #setMaintainSession * @see #setCustomProperties */ protected void preparePortStub(Object stub) { Map<String, Object> stubProperties = new HashMap<>(); String username = getUsername(); if (username != null) { stubProperties.put(BindingProvider.USERNAME_PROPERTY, username); } String password = getPassword(); if (password != null) { stubProperties.put(BindingProvider.PASSWORD_PROPERTY, password); } String endpointAddress = getEndpointAddress(); if (endpointAddress != null) { stubProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress); } if (isMaintainSession()) { stubProperties.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE); } if (isUseSoapAction()) { stubProperties.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE); } String soapActionUri = getSoapActionUri(); if (soapActionUri != null) { stubProperties.put(BindingProvider.SOAPACTION_URI_PROPERTY, soapActionUri); } stubProperties.putAll(getCustomProperties()); if (!stubProperties.isEmpty()) { if (!(stub instanceof BindingProvider)) { throw new RemoteLookupFailureException("Port stub of class [" + stub.getClass().getName() + "] is not a customizable JAX-WS stub: it does not implement interface [javax.xml.ws.BindingProvider]"); } ((BindingProvider) stub).getRequestContext().putAll(stubProperties); } }
Example #24
Source File: HessianClientInterceptor.java From java-technology-stack with MIT License | 5 votes |
/** * Initialize the Hessian proxy for this interceptor. * @throws RemoteLookupFailureException if the service URL is invalid */ public void prepare() throws RemoteLookupFailureException { try { this.hessianProxy = createHessianProxy(this.proxyFactory); } catch (MalformedURLException ex) { throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", ex); } }
Example #25
Source File: AbstractRemoteSlsbInvokerInterceptor.java From java-technology-stack with MIT License | 5 votes |
/** * Refresh the EJB home object and retry the given invocation. * Called by invoke on connect failure. * @param invocation the AOP method invocation * @return the invocation result, if any * @throws Throwable in case of invocation failure * @see #invoke */ @Nullable protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable { try { refreshHome(); } catch (NamingException ex) { throw new RemoteLookupFailureException("Failed to locate remote EJB [" + getJndiName() + "]", ex); } return doInvoke(invocation); }
Example #26
Source File: JndiRmiClientInterceptor.java From java-technology-stack with MIT License | 5 votes |
/** * Return the RMI stub to use. Called for each invocation. * <p>The default implementation returns the stub created on initialization, * if any. Else, it invokes {@link #lookupStub} to get a new stub for * each invocation. This can be overridden in subclasses, for example in * order to cache a stub for a given amount of time before recreating it, * or to test the stub whether it is still alive. * @return the RMI stub to use for an invocation * @throws NamingException if stub creation failed * @throws RemoteLookupFailureException if RMI stub creation failed */ protected Object getStub() throws NamingException, RemoteLookupFailureException { if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) { return (this.cachedStub != null ? this.cachedStub : lookupStub()); } else { synchronized (this.stubMonitor) { if (this.cachedStub == null) { this.cachedStub = lookupStub(); } return this.cachedStub; } } }
Example #27
Source File: RmiClientInterceptor.java From java-technology-stack with MIT License | 5 votes |
/** * Return the RMI stub to use. Called for each invocation. * <p>The default implementation returns the stub created on initialization, * if any. Else, it invokes {@link #lookupStub} to get a new stub for * each invocation. This can be overridden in subclasses, for example in * order to cache a stub for a given amount of time before recreating it, * or to test the stub whether it is still alive. * @return the RMI stub to use for an invocation * @throws RemoteLookupFailureException if RMI stub creation failed * @see #lookupStub */ protected Remote getStub() throws RemoteLookupFailureException { if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) { return (this.cachedStub != null ? this.cachedStub : lookupStub()); } else { synchronized (this.stubMonitor) { if (this.cachedStub == null) { this.cachedStub = lookupStub(); } return this.cachedStub; } } }
Example #28
Source File: JaxWsPortClientInterceptor.java From spring-analysis-note with MIT License | 5 votes |
/** * Prepare the given JAX-WS port stub, applying properties to it. * Called by {@link #prepare}. * @param stub the current JAX-WS port stub * @see #setUsername * @see #setPassword * @see #setEndpointAddress * @see #setMaintainSession * @see #setCustomProperties */ protected void preparePortStub(Object stub) { Map<String, Object> stubProperties = new HashMap<>(); String username = getUsername(); if (username != null) { stubProperties.put(BindingProvider.USERNAME_PROPERTY, username); } String password = getPassword(); if (password != null) { stubProperties.put(BindingProvider.PASSWORD_PROPERTY, password); } String endpointAddress = getEndpointAddress(); if (endpointAddress != null) { stubProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress); } if (isMaintainSession()) { stubProperties.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE); } if (isUseSoapAction()) { stubProperties.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE); } String soapActionUri = getSoapActionUri(); if (soapActionUri != null) { stubProperties.put(BindingProvider.SOAPACTION_URI_PROPERTY, soapActionUri); } stubProperties.putAll(getCustomProperties()); if (!stubProperties.isEmpty()) { if (!(stub instanceof BindingProvider)) { throw new RemoteLookupFailureException("Port stub of class [" + stub.getClass().getName() + "] is not a customizable JAX-WS stub: it does not implement interface [javax.xml.ws.BindingProvider]"); } ((BindingProvider) stub).getRequestContext().putAll(stubProperties); } }
Example #29
Source File: HessianClientInterceptor.java From spring-analysis-note with MIT License | 5 votes |
/** * Initialize the Hessian proxy for this interceptor. * @throws RemoteLookupFailureException if the service URL is invalid */ public void prepare() throws RemoteLookupFailureException { try { this.hessianProxy = createHessianProxy(this.proxyFactory); } catch (MalformedURLException ex) { throw new RemoteLookupFailureException("Service URL [" + getServiceUrl() + "] is invalid", ex); } }
Example #30
Source File: AbstractRemoteSlsbInvokerInterceptor.java From spring-analysis-note with MIT License | 5 votes |
/** * Refresh the EJB home object and retry the given invocation. * Called by invoke on connect failure. * @param invocation the AOP method invocation * @return the invocation result, if any * @throws Throwable in case of invocation failure * @see #invoke */ @Nullable protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable { try { refreshHome(); } catch (NamingException ex) { throw new RemoteLookupFailureException("Failed to locate remote EJB [" + getJndiName() + "]", ex); } return doInvoke(invocation); }