Class GwtRpcUtil
java.lang.Object
org.pentaho.platform.web.gwt.rpc.impl.GwtRpcUtil
Contains internal utility code that supports the implementation of the classes in the
org.pentaho.platform.web.gwt.rpc
namespace.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
scrubWebAppRoot
(String path, String appContextPath) Returns a new string which is equal to that specified in thepath
argument, except the first occurrence ofWEBAPP_ROOT
is replaced with the value of theappContextPath
argument.static <T> T
withClassLoader
(ClassLoader classLoader, Supplier<T> supplier) Calls asupplier
having a given class loader,classLoader
, as the current class loader of the current thread.static <T,
E extends Throwable>
TwithClassLoaderThrowing
(ClassLoader classLoader, ThrowingSupplier<T, E> supplier) Calls a throwing supplier,supplier
, having a given class loader,classLoader
, as the current class loader of the current thread.
-
Field Details
-
WEBAPP_ROOT_TOKEN
- See Also:
-
-
Method Details
-
scrubWebAppRoot
Returns a new string which is equal to that specified in thepath
argument, except the first occurrence ofWEBAPP_ROOT
is replaced with the value of theappContextPath
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 asupplier
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 ECalls 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.
-