Class QJavalinUtils

java.lang.Object
com.kingsrook.qqq.backend.javalin.QJavalinUtils

public class QJavalinUtils extends Object
Utility methods shared by javalin implementations
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    handleException(org.eclipse.jetty.http.HttpStatus.Code statusCode, io.javalin.http.Context context, Exception e)
     
    static Integer
    integerFormParam(io.javalin.http.Context context, String name)
    Returns Integer if context has a valid int form parameter by the given name, Returns null if no param (or empty value).
    static Integer
    integerQueryParam(io.javalin.http.Context context, String name)
    Returns Integer if context has a valid int query parameter by the given name, Returns null if no param (or empty value).
    static boolean
    queryParamIsTrue(io.javalin.http.Context context, String name)
    Returns true iff context has a valid query parameter by the given name, with a value of "true".
    static void
    respondWithError(io.javalin.http.Context context, org.eclipse.jetty.http.HttpStatus.Code statusCode, String errorMessage)
     
    static String
    stringQueryParam(io.javalin.http.Context context, String name)
    Returns String if context has a valid query parameter by the given name, Returns null if no param (or empty value).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • QJavalinUtils

      public QJavalinUtils()
  • Method Details

    • integerQueryParam

      public static Integer integerQueryParam(io.javalin.http.Context context, String name) throws QValueException
      Returns Integer if context has a valid int query parameter by the given name, Returns null if no param (or empty value). Throws QValueException for malformed numbers.
      Throws:
      QValueException
    • queryParamIsTrue

      public static boolean queryParamIsTrue(io.javalin.http.Context context, String name) throws QValueException
      Returns true iff context has a valid query parameter by the given name, with a value of "true".
      Throws:
      QValueException
    • integerFormParam

      public static Integer integerFormParam(io.javalin.http.Context context, String name) throws QValueException
      Returns Integer if context has a valid int form parameter by the given name, Returns null if no param (or empty value). Throws QValueException for malformed numbers.
      Throws:
      QValueException
    • stringQueryParam

      public static String stringQueryParam(io.javalin.http.Context context, String name)
      Returns String if context has a valid query parameter by the given name, Returns null if no param (or empty value).
    • handleException

      public static void handleException(org.eclipse.jetty.http.HttpStatus.Code statusCode, io.javalin.http.Context context, Exception e)
    • respondWithError

      public static void respondWithError(io.javalin.http.Context context, org.eclipse.jetty.http.HttpStatus.Code statusCode, String errorMessage)