org.springframework.remoting.httpinvoker

Class HttpInvokerClientInterceptor

    • Constructor Detail

      • HttpInvokerClientInterceptor

        public HttpInvokerClientInterceptor()
    • Method Detail

      • setCodebaseUrl

        public void setCodebaseUrl(@Nullable
                                   java.lang.String codebaseUrl)
        Set the codebase URL to download classes from if not found locally. Can consists of multiple URLs, separated by spaces.

        Follows RMI's codebase conventions for dynamic class download. In contrast to RMI, where the server determines the URL for class download (via the "java.rmi.server.codebase" system property), it's the client that determines the codebase URL here. The server will usually be the same as for the service URL, just pointing to a different path there.

        See Also:
        UrlBasedRemoteAccessor.setServiceUrl(java.lang.String), CodebaseAwareObjectInputStream, RMIClassLoader
      • getCodebaseUrl

        @Nullable
        public java.lang.String getCodebaseUrl()
        Return the codebase URL to download classes from if not found locally.
        Specified by:
        getCodebaseUrl in interface HttpInvokerClientConfiguration
        Returns:
        the codebase URL, or null if none
        See Also:
        RMIClassLoader
      • getHttpInvokerRequestExecutor

        public HttpInvokerRequestExecutor getHttpInvokerRequestExecutor()
        Return the HttpInvokerRequestExecutor used by this remote accessor.

        Creates a default SimpleHttpInvokerRequestExecutor if no executor has been initialized already.

      • invoke

        public java.lang.Object invoke(MethodInvocation methodInvocation)
                                throws java.lang.Throwable
        Description copied from interface: MethodInterceptor
        Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invoke Joinpoint.proceed().
        Specified by:
        invoke in interface MethodInterceptor
        Parameters:
        methodInvocation - the method invocation joinpoint
        Returns:
        the result of the call to Joinpoint.proceed(); might be intercepted by the interceptor
        Throws:
        java.lang.Throwable - if the interceptors or the target object throws an exception
      • executeRequest

        protected RemoteInvocationResult executeRequest(RemoteInvocation invocation,
                                                        MethodInvocation originalInvocation)
                                                 throws java.lang.Exception
        Execute the given remote invocation via the HttpInvokerRequestExecutor.

        This implementation delegates to executeRequest(RemoteInvocation). Can be overridden to react to the specific original MethodInvocation.

        Parameters:
        invocation - the RemoteInvocation to execute
        originalInvocation - the original MethodInvocation (can e.g. be cast to the ProxyMethodInvocation interface for accessing user attributes)
        Returns:
        the RemoteInvocationResult object
        Throws:
        java.lang.Exception - in case of errors
      • executeRequest

        protected RemoteInvocationResult executeRequest(RemoteInvocation invocation)
                                                 throws java.lang.Exception
        Execute the given remote invocation via the HttpInvokerRequestExecutor.

        Can be overridden in subclasses to pass a different configuration object to the executor. Alternatively, add further configuration properties in a subclass of this accessor: By default, the accessor passed itself as configuration object to the executor.

        Parameters:
        invocation - the RemoteInvocation to execute
        Returns:
        the RemoteInvocationResult object
        Throws:
        java.io.IOException - if thrown by I/O operations
        java.lang.ClassNotFoundException - if thrown during deserialization
        java.lang.Exception - in case of general errors
        See Also:
        getHttpInvokerRequestExecutor(), HttpInvokerClientConfiguration
      • convertHttpInvokerAccessException

        @Nullable
        protected RemoteAccessException convertHttpInvokerAccessException(java.lang.Throwable ex)
        Convert the given HTTP invoker access exception to an appropriate Spring RemoteAccessException.
        Parameters:
        ex - the exception to convert
        Returns:
        the RemoteAccessException to throw, or null to have the original exception propagated to the caller