/** * Gets the URL prefix of the hosting page, useful for prepending to relative * paths of resources which may be relative to the host page. Typically, you * should use {@link #getModuleBaseURL()} unless you have a specific reason to * load a resource relative to the host page. * * @return if non-empty, the base URL is guaranteed to end with a slash */ public static String getHostPageBaseURL() { return Impl.getHostPageBaseURL(); }
/** * Gets the URL prefix that should be prepended to URLs that * are intended to be module-relative, such as RPC entry points. * * <p>If the URL points to an output file of the GWT compiler (such as * a file in the public path), use {@link #getModuleBaseForStaticFiles()} * instead.</p> * * @return if non-empty, the base URL is guaranteed to end with a slash */ public static String getModuleBaseURL() { return Impl.getModuleBaseURL(); }
private static native void reportToBrowser(Object e) /*-{ $wnd.setTimeout(function () { throw e; }, 0); }-*/;
/** * Returns the permutation's strong name. This can be used to distinguish * between different permutations of the same module. In Development Mode, * this method will return {@value #HOSTED_MODE_PERMUTATION_STRONG_NAME}. */ public static String getPermutationStrongName() { if (GWT.isScript()) { return Impl.getPermutationStrongName(); } else { return HOSTED_MODE_PERMUTATION_STRONG_NAME; } }
/** * Gets the name of the running module. */ public static String getModuleName() { return Impl.getModuleName(); }
private static StackTraceElement[] dropInternalFrames(StackTraceElement[] stackTrace) { final String dropFrameUntilFnName = Impl.getNameOf("@com.google.gwt.core.client.impl.StackTraceCreator::captureStackTrace(*)"); final String dropFrameUntilFnName2 = Impl.getNameOf("@java.lang.Throwable::initializeBackingError(*)"); int numberOfFramesToSearch = Math.min(stackTrace.length, DROP_FRAME_LIMIT); for (int i = numberOfFramesToSearch - 1; i >= 0; i--) { if (stackTrace[i].getMethodName().equals(dropFrameUntilFnName) || stackTrace[i].getMethodName().equals(dropFrameUntilFnName2)) { splice(stackTrace, i + 1); break; } } return stackTrace; }
/** * Gets the URL prefix that should be prepended to URLs that point to * static files generated by the GWT compiler, such as files in the * module's public path. * * <p> * Normally this will be the same value as {@link #getModuleBaseURL}, but * may be different when a GWT app is configured to get its static resources * from a different server. * </p> * * @return if non-empty, the base URL is guaranteed to end with a slash */ public static String getModuleBaseForStaticFiles() { return Impl.getModuleBaseURLForStaticFiles(); }
private static void reportUncaughtException( Throwable e, boolean reportSwallowedExceptionToBrowser) { if (Impl.uncaughtExceptionHandlerForTest != null) { Impl.uncaughtExceptionHandlerForTest.onUncaughtException(e); } UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler(); if (handler != null) { if (handler == Impl.uncaughtExceptionHandlerForTest) { return; // Already reported so we're done. } // TODO(goktug): Handler might throw an exception but catching and reporting it to browser // here breaks assumptions of some existing hybrid apps that uses UCE for exception // conversion. We don't have an alternative functionality (yet) and it is too risky to include // the change in the release at last minute. handler.onUncaughtException(e); return; // Done. } // Make sure that the exception is not swallowed if (GWT.isClient() && reportSwallowedExceptionToBrowser) { reportToBrowser(e); } else { System.err.print("Uncaught exception "); e.printStackTrace(System.err); } }
/** * Returns the permutation's strong name. This can be used to distinguish * between different permutations of the same module. In Development Mode, * this method will return {@value #HOSTED_MODE_PERMUTATION_STRONG_NAME}. */ public static String getPermutationStrongName() { if (GWT.isScript()) { return Impl.getPermutationStrongName(); } else { return HOSTED_MODE_PERMUTATION_STRONG_NAME; } }
/** * Gets the name of the running module. */ public static String getModuleName() { return Impl.getModuleName(); }
private static StackTraceElement[] dropInternalFrames(StackTraceElement[] stackTrace) { final String dropFrameUntilFnName = Impl.getNameOf("@com.google.gwt.core.client.impl.StackTraceCreator::captureStackTrace(*)"); int numberOfFrameToSearch = Math.min(stackTrace.length, DROP_FRAME_LIMIT); for (int i = 0; i < numberOfFrameToSearch; i++) { if (stackTrace[i].getMethodName().equals(dropFrameUntilFnName)) { return splice(stackTrace, i + 1); } } return stackTrace; }
/** * Gets the URL prefix that should be prepended to URLs that point to * static files generated by the GWT compiler, such as files in the * module's public path. * * <p> * Normally this will be the same value as {@link #getModuleBaseURL}, but * may be different when a GWT app is configured to get its static resources * from a different server. * </p> * * @return if non-empty, the base URL is guaranteed to end with a slash */ public static String getModuleBaseForStaticFiles() { return Impl.getModuleBaseURLForStaticFiles(); }
private static native void reportToBrowser(Object e) /*-{ $wnd.setTimeout(function () { throw e; }, 0); }-*/;
/** * Returns the permutation's strong name. This can be used to distinguish * between different permutations of the same module. In Development Mode, * this method will return {@value #HOSTED_MODE_PERMUTATION_STRONG_NAME}. */ public static String getPermutationStrongName() { if (GWT.isScript()) { return Impl.getPermutationStrongName(); } else { return HOSTED_MODE_PERMUTATION_STRONG_NAME; } }
/** * Gets the URL prefix of the hosting page, useful for prepending to relative * paths of resources which may be relative to the host page. Typically, you * should use {@link #getModuleBaseURL()} unless you have a specific reason to * load a resource relative to the host page. * * @return if non-empty, the base URL is guaranteed to end with a slash */ public static String getHostPageBaseURL() { return Impl.getHostPageBaseURL(); }
/** * Gets the name of the running module. */ public static String getModuleName() { return Impl.getModuleName(); }
/** * Gets the URL prefix that should be prepended to URLs that * are intended to be module-relative, such as RPC entry points. * * <p>If the URL points to an output file of the GWT compiler (such as * a file in the public path), use {@link #getModuleBaseForStaticFiles()} * instead.</p> * * @return if non-empty, the base URL is guaranteed to end with a slash */ public static String getModuleBaseURL() { return Impl.getModuleBaseURL(); }
private static StackTraceElement[] dropInternalFrames(StackTraceElement[] stackTrace) { final String dropFrameUntilFnName = Impl.getNameOf("@com.google.gwt.core.client.impl.StackTraceCreator::captureStackTrace(*)"); int numberOfFrameToSearch = Math.min(stackTrace.length, DROP_FRAME_LIMIT); for (int i = 0; i < numberOfFrameToSearch; i++) { if (stackTrace[i].getMethodName().equals(dropFrameUntilFnName)) { return splice(stackTrace, i + 1); } } return stackTrace; }