Package play.mvc.Http

Examples of play.mvc.Http.Request


      renderDocuments(args);
    }

    private void renderDocuments(Map<String, Object> args) {
      for(PDFDocument doc : docs.documents){
        Request request = Http.Request.current();
          String templateName = PDF.resolveTemplateName(doc.template, request, request.format);
            Template template = TemplateLoader.load(templateName);
            doc.args.putAll(args);
        doc.content = template.render(new HashMap<String, Object>(doc.args));
        loadHeaderAndFooter(doc, doc.args);
View Full Code Here


      public Promise<SimpleResult> call(Context ctx) {
        try {
          beforeActionInvocation(ctx, actionMethod);

          SimpleResult result = null;
          Request req = ctx.request();
          String method = req.method();
          int duration = 0;
          String key = null;
          Cached cachAnno = actionMethod.getAnnotation(Cached.class);
          // Check the cache (only for GET or HEAD)
          if ((method.equals("GET") || method.equals("HEAD")) && cachAnno != null) {
            key = cachAnno.key();
            if ("".equals(key) || key == null) {
              key = "urlcache:" + req.uri() + ":" + req.queryString();
            }
            duration = cachAnno.duration();
            result = (SimpleResult) Cache.get(key);
          }
          if (result == null) {
View Full Code Here

    // request processing
    RenderResultCache.setIgnoreCacheInCurrentAndNextReq(false);
  }

  public static void beforeActionInvocation(Context ctx, Method actionMethod) {
    Request request = ctx.request();
    play.mvc.Http.Flash flash = ctx.flash();
    Map<String, String[]> headers = request.headers();

    String property = dumpRequest;
    if (property != null && property.length() > 0) {
      if (!"false".equals(property) && !"no".equals(property)) {
        if ("yes".equals(property) || "true".equals(property)) {
          JapidFlags.log("action ->: " + actionMethod.toString());
        } else {
          if (request.uri().matches(property)) {
            JapidFlags.log("action ->: " + actionMethod.toString());
          }
        }
      }
    }
View Full Code Here

   * can be used to generate a key based on the query
   *
   * @return
   */
  public static String genCacheKey() {
    Request request = Implicit.request();
    return "japidcache:" + request.uri(); // play2 is this unique enough?
  }
View Full Code Here

class AccessLoggingAction extends Action.Simple {
 
  private ALogger accessLogger = Logger.of("access");
 
  public F.Promise<Result> call(Http.Context ctx) throws Throwable {
    final Request request = ctx.request();
    accessLogger.info("method=" + request.method() + " uri=" + request.uri() + " remote-address=" + request.remoteAddress());
   
    return delegate.call(ctx);
  }
View Full Code Here

TOP

Related Classes of play.mvc.Http.Request

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.