playframework-2.3

Play framework WS url spaces

夙愿已清 提交于 2019-12-10 21:48:07
问题 I have a problem calling WS.url() in play framework 2.3.3 with url containing spaces. All other characters all url encoded automatically but not spaces. When i try to change all spaces to "%20", WS convert it to "%2520" because of "%" character. With spaces i've got java.net.URISyntaxException: Illegal character in query. How can i handle this ? part of the URL's query String: &input=/mnt/mp3/music/folder/01 - 23.mp3 The code looks like this: Promise<JsonNode> jsonPromise = WS.url(url)

The system cannot find the file activatorconfig.txt

放肆的年华 提交于 2019-12-10 14:15:13
问题 I'm using play framework 2.3. I follow the instructions on page https://www.playframework.com/documentation/2.3.x/Installing to install activator. It looks like activator is successfully installed. When I input activator commands, it gives me right output except two lines on top: The system cannot find the file C:\Users\myname\.activator\1.2.12\activatorconfig.txt. The system cannot find the file C:\Users\myname\.activator\activatorconfig.txt. Can anybody tell me how to fix this issue. Thanks

Activator vs sbt

筅森魡賤 提交于 2019-12-10 13:36:40
问题 I upgraded from Play 2.1.1 to Play 2.3.2. Now Typesafe has "Activator", which combines the several offerings of their platform. I installed the "minimal" form of it, which is supposed to download features only as needed. Then I thought, "Hey, isn't that the point of a build and dependency management tools like, I don't know, SBT?" I found that I could just go to my Play project and run sbt Does this do something significantly different than running activator (If I could just use SBT, I'd

Custom regex validation in Play Framework - Scala

▼魔方 西西 提交于 2019-12-10 12:19:13
问题 I am new to Play 2.3.x and Scala and trying to implement a form input validation. Let us say I have an example form. val userForm = Form( "firstName" -> nonEmptyText ) I want to implement something like this for the first name field: If a regex for first name (say firstName.regex = “regex for first name” ) is defined then { Validate first name against specific regex }else{ Validate against the global regex ( say global.regex = “global regex white list some regex valid for across the

How to exclude files under conf folder for distribution?

被刻印的时光 ゝ 提交于 2019-12-09 17:41:31
问题 I have a application.dev.conf and application.test.conf under my conf folder in my Play 2.3 application but I do not want it to be packaged as part of my distribution? What is the right excludeFilter for it? 回答1: You could use mappings to exclude both files. mappings in Universal := { val origMappings = (mappings in Universal).value origMappings.filterNot { case (_, file) => file.endsWith("application.dev.conf") || file.endsWith("application.test.conf") } } 回答2: Actually lpiepiora's answer

Simple CRUD tutorial about Play Framework and MySQL using Ebean?

ぐ巨炮叔叔 提交于 2019-12-09 17:27:51
问题 I am new to Play Framework. I have started learning it and so far I am enjoying it. I have started to learn Play Java. I have my controller and model set up as follow: Controller: package controllers; import play.mvc.Controller; import play.mvc.Result; //Import Product model import models.Product; public class Products extends Controller{ /** * List all Products */ public static Result list(){ Object allProducts = Product.findAll(); return ok((Content) allProducts); //return all products } }

How to use Play WS with SSL?

旧街凉风 提交于 2019-12-09 07:03:22
问题 My Java client application needs to do REST calls. I was instructed to use Play's WS implementation. Currently, I have this: AsyncHttpClientConfig.Builder builder = new com.ning.http.client.AsyncHttpClientConfig.Builder(); NingWSClient wsc = new play.libs.ws.ning.NingWSClient(builder.build()); WSRequestHolder holder = wsc.url("http://www.simpleweb.org/"); This works. However, my application needs to access a secure web service that uses SSL. I have a PKCS12 cert for my client. How can I get

Test HTTP response with PlayFramework/JUnit

旧巷老猫 提交于 2019-12-09 02:15:34
I've been looking for hours to find a way to test if a route is correct with play. I mean, for exemple Is the GET request to localhost:9000/test actually return 200 OK ? I was not able to find any working example. I use Play's WS (Web Services) library to achieve this. For Example: package endpoints; import com.fasterxml.jackson.databind.JsonNode; import models.Meh; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import play.libs.Json; import play.libs.ws.WS; import play.libs.ws.WSResponse; import play.test.TestServer; import static org.fest.assertions

flash not found in Products.scala

霸气de小男生 提交于 2019-12-08 18:03:21
问题 I am currently reading 'Play for Scala' by Peter Hilton. I have just got the the end of the first example Play app where you build a paperclip directory. However upon compiling I get a compilation error telling me that the value 'flash' has not been found. Usually this is a simple mistake I have made but given that I am just following the guide in the book I can't identify a fix. The error is in lines 52 and 53 in the 'NewProduct' function Here is the code: package controllers import play.api

Disabling lazy load in Play application

徘徊边缘 提交于 2019-12-08 17:33:53
问题 By default your Play application will be fully started (compiled, Global 's onStart called, etc.) only after you do http request to it. Is there a way to disable this lazy load and make Play app compile code and do startup once application process is run? PS: I am using Play 2.3. UPDATE: As Ryan pointed out lazy load happens only in dev. mode. Nevertheless I still need to disable it, despite this is relevant only to apps running in dev. mode. 回答1: Lazy loading only applies in dev mode ( play