/** * Returns a {@link SafeUri} obtained by sanitizing the provided string. * * <p> * The input string is sanitized using {@link #sanitizeUri(String)}. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromString(String s) { return new SafeUriString(sanitizeUri(s)); }
/** * Returns a {@link SafeUri} constructed from an untrusted string but without * sanitizing it. * * <strong>Despite this method creating a SafeUri instance, no checks are * performed, so the returned SafeUri is absolutely NOT guaranteed to be * safe!</strong> * * @param s the input String * @return a SafeUri instance * @deprecated This method is intended only for use in APIs that use * {@link SafeUri} to represent URIs, but for backwards * compatibility have methods that accept URI parameters as plain * strings. */ @Deprecated @SuppressIsSafeUriCastCheck public static SafeUri unsafeCastFromUntrustedString(String s) { return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a trusted string, i.e., without * sanitizing the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the SafeUri contract. * * @param s the input String * @return a SafeUri instance */ @SuppressIsSafeUriCastCheck public static SafeUri fromTrustedString(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a value that is fully under * the control of the program, e.g., a constant. * * <p> * The string is not sanitized and no checks are performed. The assumption * that the resulting value adheres to the {@link SafeUri} type contract * is entirely based on the argument being fully under program control and * not being derived from a program input. * * <p> * <strong>Convention of use:</strong> This method must only be invoked on * values that are fully under the program's control, such as string literals. * * @param s the input String * @return a SafeUri instance */ @SuppressIsSafeUriCastCheck public static SafeUri fromSafeConstant(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from an untrusted string but without * sanitizing it. * * <strong>Despite this method creating a SafeUri instance, no checks are * performed, so the returned SafeUri is absolutely NOT guaranteed to be * safe!</strong> * * @param s the input String * @return a SafeUri instance * @deprecated This method is intended only for use in APIs that use * {@link SafeUri} to represent URIs, but for backwards * compatibility have methods that accept URI parameters as plain * strings. */ @Deprecated public static SafeUri unsafeCastFromUntrustedString(String s) { return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from an untrusted string but without * sanitizing it. * * <strong>Despite this method creating a SafeUri instance, no checks are * performed, so the returned SafeUri is absolutely NOT guaranteed to be * safe!</strong> * * @param s the input String * @return a SafeUri instance * @deprecated This method is intended only for use in APIs that use * {@link SafeUri} to represent URIs, but for backwards * compatibility have methods that accept URI parameters as plain * strings. */ @Deprecated public static SafeUri unsafeCastFromUntrustedString(String s) { return new SafeUriString(s); }
/** * Returns a {@link SafeUri} obtained by sanitizing the provided string. * * <p> * The input string is sanitized using {@link #sanitizeUri(String)}. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromString(String s) { return new SafeUriString(sanitizeUri(s)); }
/** * Returns a {@link SafeUri} constructed from a trusted string, i.e., without * sanitizing the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the SafeUri contract. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromTrustedString(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a trusted string, i.e., without * sanitizing the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the SafeUri contract. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromTrustedString(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} obtained by sanitizing the provided string. * * <p> * The input string is sanitized using {@link #sanitizeUri(String)}. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromString(String s) { return new SafeUriString(sanitizeUri(s)); }
/** * Returns a {@link SafeUri} constructed from a value that is fully under * the control of the program, e.g., a constant. * * <p> * The string is not sanitized and no checks are performed. The assumption * that the resulting value adheres to the {@link SafeUri} type contract * is entirely based on the argument being fully under program control and * not being derived from a program input. * * <p> * <strong>Convention of use:</strong> This method must only be invoked on * values that are fully under the program's control, such as string literals. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromSafeConstant(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }
/** * Returns a {@link SafeUri} constructed from a value that is fully under * the control of the program, e.g., a constant. * * <p> * The string is not sanitized and no checks are performed. The assumption * that the resulting value adheres to the {@link SafeUri} type contract * is entirely based on the argument being fully under program control and * not being derived from a program input. * * <p> * <strong>Convention of use:</strong> This method must only be invoked on * values that are fully under the program's control, such as string literals. * * @param s the input String * @return a SafeUri instance */ public static SafeUri fromSafeConstant(String s) { SafeUriHostedModeUtils.maybeCheckValidUri(s); return new SafeUriString(s); }