Class GwtRpcUtil

    • Method Detail

      • scrubWebAppRoot

        public static String scrubWebAppRoot​(String path,
                                             String appContextPath)
        Returns a new string which is equal to that specified in the path argument, except the first occurrence of WEBAPP_ROOT is replaced with the value of the appContextPath argument.
        Parameters:
        path - The path in which to replace the web app token.
        appContextPath - The value which replaces the web app token.
        Returns:
        A new string with the web app token replaced.
      • withClassLoader

        public static <T> T withClassLoader​(@NonNull
                                            ClassLoader classLoader,
                                            @NonNull
                                            Supplier<T> supplier)
        Calls a supplier having a given class loader, classLoader, as the current class loader of the current thread.

        After calling the given supplier, the original current class loader of the current thread is restored, even in case the supplier throws an exception.

        Parameters:
        classLoader - The class loader.
        supplier - The supplier to call.
        Returns:
        The value returned by the supplier.
      • withClassLoaderThrowing

        public static <T,​E extends Throwable> T withClassLoaderThrowing​(@NonNull
                                                                              ClassLoader classLoader,
                                                                              @NonNull
                                                                              ThrowingSupplier<T,​E> supplier)
                                                                       throws E extends Throwable
        Calls a throwing supplier, supplier, having a given class loader, classLoader, as the current class loader of the current thread.

        After calling the given supplier, the original current class loader of the current thread is restored, even in case the supplier throws an exception.

        Parameters:
        classLoader - The class loader.
        supplier - The supplier to call.
        Returns:
        The value returned by the supplier.
        Throws:
        E - The exception thrown by the supplier, when called.
        E extends Throwable