Package 

Class DefaultContext

  • All Implemented Interfaces:
    io.javalin.http.Context

    
    public final class DefaultContext
     implements Context
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Float executionTimeMs()
      final DefaultContext changeBaseRequest(HttpServletRequest req)
      final DefaultContext update(HandlerEntry handlerEntry, String requestUri)
      HttpServletRequest req() Servlet request
      HttpServletResponse res() Servlet response
      <T extends Any> T appAttribute(String key) Gets an attribute from the Javalin instance serving the request
      String endpointHandlerPath() Gets the endpoint path that was used to match request (null in before, available in endpoint/after)
      String characterEncoding() Try to obtain request encoding from Header.CONTENT_TYPE header
      CookieStore cookieStore() Gets cookie store used by this request
      HandlerType method() Gets the request method.
      HandlerType handlerType() Gets the handler type of the current handler
      String matchedPath()
      • Gets the path that was used to match request (also includes before/after paths)

      ByteArray bodyAsBytes() Gets the request body as a ByteArray.
      Map<String, List<String>> formParamMap() Gets a map with all the form param keys and values.
      Map<String, String> pathParamMap() Gets a map of all the pathParamAsClass keys and values.
      String pathParam(String key) Gets a path param by name (ex: pathParam("param").
      Map<String, List<String>> queryParamMap() Gets a map with all the query param keys and values.
      ServletOutputStream outputStream() Gets output-stream you can write to.
      InputStream resultStream() Extracts input stream from latest result if possible
      <T extends Any> Context future(CompletableFuture<T> future, Runnable launch, Consumer<T> callback) The main entrypoint for all async related functionalities exposed by Context.
      CompletableFuture<?> resultFuture() Gets the current context result as a CompletableFuture (if set).
      • Methods inherited from class io.javalin.http.Context

        async, async, async, attribute, attribute, attributeMap, basicAuthCredentials, body, bodyAsClass, bodyAsInputStream, bodyStreamAsClass, bodyValidator, cachedSessionAttribute, cachedSessionAttribute, cachedSessionAttributeOrCompute, consumeSessionAttribute, contentLength, contentType, contentType, contentType, contextPath, cookie, cookie, cookie, cookie, cookieMap, formParam, formParamAsClass, formParams, fullUrl, future, future, header, header, headerAsClass, headerMap, host, html, ip, isMultipart, isMultipartFormData, json, jsonStream, path, pathParamAsClass, port, protocol, queryParam, queryParamAsClass, queryParams, queryString, redirect, redirect, removeCookie, removeCookie, render, render, result, result, result, resultString, scheme, sessionAttribute, sessionAttribute, sessionAttributeMap, status, status, status, statusCode, uploadedFile, uploadedFiles, uploadedFiles, url, userAgent, writeSeekableStream, writeSeekableStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait