@Deprecated public static Result route(Application app, RequestBuilder requestBuilder, byte[] body, long timeout) { return wrapScalaResult(Scala.orNull(play.api.test.Helpers.jRoute(app.getWrappedApplication(), requestBuilder.build()._underlyingRequest(), body)), timeout); }
@SuppressWarnings("unchecked") public static Result route(Application app, RequestBuilder requestBuilder, long timeout) { final scala.Option<scala.concurrent.Future<play.api.mvc.Result>> opt = play.api.test.Helpers.jRoute( app.getWrappedApplication(), requestBuilder.build()._underlyingRequest(), requestBuilder.bodyAsAnyContent()); return wrapScalaResult(Scala.orNull(opt), timeout); }
/** * Route the request considering the given timeout. * * @param app The application used while routing and executing the request * @param requestBuilder the request builder * @param timeout the amount of time, in milliseconds, to wait for the body to be produced. * @return the result */ @SuppressWarnings("unchecked") public static Result route(Application app, RequestBuilder requestBuilder, long timeout) { final scala.Option<scala.concurrent.Future<play.api.mvc.Result>> opt = play.api.test.Helpers.jRoute( app.asScala(), requestBuilder.build().asScala(), requestBuilder.body() ); return wrapScalaResult(Scala.orNull(opt), timeout); }
/** * Route the request considering the given timeout. * * @param app The application used while routing and executing the request * @param requestBuilder the request builder * @param timeout the amount of time, in milliseconds, to wait for the body to be produced. * @return the result */ @SuppressWarnings("unchecked") public static Result route(Application app, RequestBuilder requestBuilder, long timeout) { final scala.Option<scala.concurrent.Future<play.api.mvc.Result>> opt = play.api.test.Helpers.jRoute( app.asScala(), requestBuilder.build().asScala(), requestBuilder.body() ); return wrapScalaResult(Scala.orNull(opt), timeout); }
/** * Retrieves a resource stream from the classpath. * * @param relativePath relative path of the resource to fetch * @return InputStream to the resource (may be null) */ public InputStream resourceAsStream(String relativePath) { return Scala.orNull(env.resourceAsStream(relativePath)); }
/** * Retrieves a configuration value as a <code>Milliseconds</code>. * * @param key configuration key (relative to configuration root key) * @return a configuration value or <code>null</code> */ public Long getMilliseconds(String key) { return (Long)Scala.orNull(conf.getMilliseconds(key)); }
/** * Retrieves a configuration value as a {@code List<Integer>}. * * @param key configuration key (relative to configuration root key) * @return a configuration value or <code>null</code> */ public List<Integer> getIntList(String key) { return (List<Integer>)Scala.orNull(conf.getIntList(key)); }
/** * Retrieves a resource stream from the classpath. * * @param relativePath relative path of the resource to fetch * @return InputStream to the resource (may be null) */ public InputStream resourceAsStream(String relativePath) { return Scala.orNull(env.resourceAsStream(relativePath)); }
/** * Retrieves a resource from the classpath. * * @param relativePath relative path of the resource to fetch * @return URL to the resource (may be null) */ public URL resource(String relativePath) { return Scala.orNull(env.resource(relativePath)); }
/** * Retrieves a configuration value as an <code>Double</code>. * * @param key configuration key (relative to configuration root key) * @return a configuration value or <code>null</code> */ public Double getDouble(String key) { return (Double)Scala.orNull(conf.getDouble(key)); }
/** * Retrieves a configuration value as a {@code List<Long>}. * * @param key configuration key (relative to configuration root key) * @return a configuration value or <code>null</code> */ public List<Long> getLongList(String key) { return (List<Long>)Scala.orNull(conf.getLongList(key)); }
/** * Retrieves a resource stream from the classpath. * * @param relativePath relative path of the resource to fetch * @return InputStream to the resource (may be null) */ public InputStream resourceAsStream(String relativePath) { return Scala.orNull(env.resourceAsStream(relativePath)); }
/** * Retrieves a resource from the classpath. * * @param relativePath relative path of the resource to fetch * @return URL to the resource (may be null) */ public URL resource(String relativePath) { return Scala.orNull(env.resource(relativePath)); }
/** * Retrieves a configuration value as a <code>Bytes</code>. * * @param key configuration key (relative to configuration root key) * @return a configuration value or <code>null</code> */ public Long getBytes(String key) { return (Long)Scala.orNull(conf.getBytes(key)); }
/** * Retrieves a configuration value as a <code>Boolean</code>. * * @param key configuration key (relative to configuration root key) * @return a configuration value or <code>null</code> */ public Boolean getBoolean(String key) { return (Boolean)Scala.orNull(conf.getBoolean(key)); }
/** * Retrieves a configuration value as a {@code List<Long>} representing Milliseconds. * * @param key configuration key (relative to configuration root key) * @return a configuration value or <code>null</code> */ public List<Long> getMillisecondsList(String key) { return (List<Long>)Scala.orNull(conf.getMillisecondsList(key)); }
protected HttpErrorHandler preferred(Http.RequestHeader request) { String preferredContentType = Scala.orNull(MediaRange.preferred( Scala.toSeq(request.acceptedTypes()), Scala.toSeq(errorHandlerMap.keySet().toArray(new String[]{})) )); if (preferredContentType == null) { return errorHandlerMap.values().iterator().next(); } else { return errorHandlerMap.get(preferredContentType); } }
/** * Retrieves a configuration value as a <code>String</code>. * * @param key configuration key (relative to configuration root key) * @return a configuration value or <code>null</code> */ public String getString(String key) { return Scala.orNull(conf.getString(key, scala.Option.<scala.collection.immutable.Set<java.lang.String>>empty())); }
/** * Get a resource from the classpath. * * @param relativePath relative path of the resource to fetch * @return URL to the resource (may be null) */ default URL resource(String relativePath) { return Scala.orNull(getWrappedApplication().resource(relativePath)); }
public Status(play.api.mvc.Results.Status status, File content, int chunkSize) { if(content == null) { throw new NullPointerException("null content"); } wrappedResult = status.chunked( play.core.j.JavaResults.chunked(content, chunkSize), play.core.j.JavaResults.writeBytes(Scala.orNull(play.api.libs.MimeTypes.forFileName(content.getName()))) ); }