congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
EssentialAction
Code IndexAdd Tabnine to your IDE (free)

How to use
EssentialAction
in
play.mvc

Best Java code snippets using play.mvc.EssentialAction (Showing top 8 results out of 315)

origin: com.typesafe.play/play_2.11

@Override
public play.api.libs.streams.Accumulator<ByteString, play.api.mvc.Result> apply(play.api.mvc.RequestHeader rh) {
  return apply(rh.asJava())
    .map(Result::asScala, Execution.trampoline())
    .asScala();
}
origin: lagom/lagom-recipes

private EssentialAction localizedEssentialAction(Function<Messages, EssentialAction> localizedEssentialAction) {
  return EssentialAction.of(requestHeader -> {
    Messages messages = messagesApi.preferred(requestHeader);
    return localizedEssentialAction.apply(messages).apply(requestHeader);
  });
}
origin: com.typesafe.play/play_2.12

@Override
public play.api.libs.streams.Accumulator<ByteString, play.api.mvc.Result> apply(play.api.mvc.RequestHeader rh) {
  return apply(rh.asJava())
    .map(Result::asScala, Execution.trampoline())
    .asScala();
}
origin: com.typesafe.play/play

@Override
public play.api.libs.streams.Accumulator<ByteString, play.api.mvc.Result> apply(play.api.mvc.RequestHeader rh) {
  return apply(rh.asJava())
    .map(Result::asScala, Execution.trampoline())
    .asScala();
}
origin: stackoverflow.com

 public EssentialAction apply(final EssentialAction next) {
  return EssentialAction.of(request -> {
    final Accumulator<ByteString, Result> accumulator;
    final String routeComment = request.tags().get(Router.Tags.ROUTE_COMMENTS);
    if ("NOCSRF".equals(routeComment)) {
      accumulator = next.apply(request);
    } else {
      accumulator = csrfFilter.apply(next).apply(request);
    }
    return accumulator;
  });
}
origin: stackoverflow.com

  accumulator = csrfFilter.apply(next).apply(request);
} else {
  accumulator = next.apply(request);
origin: stackoverflow.com

return next.apply();
final long startTime = System.currentTimeMillis();
return next.apply(rh).map(new AbstractFunction1<SimpleResult, SimpleResult>() {
origin: com.github.rmannibucau/playx-servlet

  @Override
  public Accumulator<ByteString, Result> apply(final Http.RequestHeader requestHeader) {
    return state.getServletContext().findMatchingServlet(requestHeader).map(servlet -> {
      final long length = requestHeader.getHeaders().get("Content-Length").map(Long::parseLong)
          .orElse(Long.MAX_VALUE);
      final BodyParser.Bytes slurper = new BodyParser.Bytes(length, state.getHttpErrorHandler());
      return slurper.apply(requestHeader).mapFuture(
          resultOrBytes -> resultOrBytes.left.map(CompletableFuture::completedFuture).orElseGet(() -> {
            return state.getServletContext()
                .executeInvoke(servlet, requestHeader,
                    resultOrBytes.right.get().iterator().asInputStream(), servlet.getServletPath())
                .toCompletableFuture();
          }), state.getServletContext().getDefaultExecutor());
    }).orElseGet(() -> next.apply(requestHeader));
  }
};
play.mvcEssentialAction

Javadoc

Given a `RequestHeader`, an `EssentialAction` consumes the request body (a `ByteString`) and returns a `Result`. An `EssentialAction` is a `Handler`, which means it is one of the objects that Play uses to handle requests. You can use this to create your action inside a filter, for example. Unlike traditional method-based Java actions, EssentialAction does not use a context.

Most used methods

  • apply
  • of

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • scheduleAtFixedRate (Timer)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • JLabel (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now