Questions tagged [playframework]

Play Framework is a modern open-source web framework for Java and Scala.

Filter by
Sorted by
Tagged with
345 votes
7 answers
158k views

Understanding implicit in Scala

I was making my way through the Scala playframework tutorial and I came across this snippet of code which had me puzzled: def newTask = Action { implicit request => taskForm.bindFromRequest.fold( ...
Clive's user avatar
  • 3,991
221 votes
24 answers
154k views

How do I change the default port (9000) that Play uses when I execute the "run" command?

How can I change the default port used by the play framework in development mode when issueing the "run" command on the play console. This is for playframework 2.0 beta. Using the http.port ...
Boris Terzic's user avatar
  • 10.9k
120 votes
18 answers
215k views

Error: Argument is not a function, got undefined

Using AngularJS with Scala Play, I'm getting this error. Error: Argument 'MainCtrl' is not a function, got undefined I'm trying to create a table consisting of the days of the week. Please take a ...
Kevin Meredith's user avatar
117 votes
6 answers
69k views

RESTful on Play! framework

We are planning a project primarily serving content to mobile apps, but need to have a website. My question is whether is makes sense to use Jersey or Restlet to develop REST APIs for our mobile apps,...
Gary's user avatar
  • 1,179
93 votes
1 answer
17k views

Advice deploying war files vs executable jar with embedded container

There seems to be a current trend in java space to move away from deploying java web applications to a java servlet container (or application server) in the form of a war file (or ear file) and ...
Brice Roncace's user avatar
90 votes
10 answers
79k views

Steps needed to use MySQL database with Play framework 2.0

I'm new to Play framework. I'm trying to configure MySQL database as a datasource to be used with Play Ebeans. Could you some one please explain the steps that are needed to configure MySQL with ...
Veera's user avatar
  • 32.9k
85 votes
3 answers
59k views

Creating a composite Unique constraints on multiple columns

This is my model: class User {...} class Book { User author; int number; } Every book number starts at 1 per author and increments upwards. So we'll have Books 1,2,3 by John Grisham, Book 1..5 ...
ripper234's user avatar
  • 226k
75 votes
14 answers
15k views

Play! framework uses a <lot> of statics

Waaah, the Play! framework has so many static methods. Where I go to school, we were told never ever to use any statics, yet Play! uses it like there's no tomorrow. Is that somehow okay? If so, why? ...
rcannood's user avatar
  • 1,056
75 votes
6 answers
60k views

How to handle optional query parameters in Play framework

Lets say I have an already functioning Play 2.0 framework based application in Scala that serves a URL such as: http://localhost:9000/birthdays which responds with a listing of all known birthdays ...
magicduncan's user avatar
  • 1,396
73 votes
1 answer
2k views

Optimizing JS from WebJars using sbt-rjs in a Play 2.3.x app

Is it possible to have a Play 2.3 app concat/optimize JS (using sbt-rjs) that's included in my app via WebJars? To give a concrete example: I'm trying to create a core.js module which contains all my ...
Dylan Hughes's user avatar
71 votes
2 answers
36k views

How to find out which Play version I'm using?

Kinda silly question, but I used Activator to get started with the play framework, and now need to see what version I'm using. 2.3 came out with support for docker, but when I put dockerExposedPorts ...
joslinm's user avatar
  • 8,005
70 votes
1 answer
3k views

What are the problems with an ADT encoding that associates types with data constructors? (Such as Scala.)

In Scala, algebraic data types are encoded as sealed one-level type hierarchies. Example: -- Haskell data Positioning a = Append | AppendIf (a -> Bool) | ...
missingfaktor's user avatar
68 votes
9 answers
25k views

SBT compilation for play framework 2.x disabled by default

I created a new Play Framework project using the activator, activator new my-project-name and then I selected the play-java template and the project is created with no errors. Then I import the ...
dazito's user avatar
  • 7,900
65 votes
5 answers
18k views

Experiences on free and low-cost hosting for play framework applications? [closed]

I'd like to know your experience finding a host for play applications on free or low-cost servers So far now I found the following options: Playapps (discontinued) A cloud hosting solution by ...
opensas's user avatar
  • 61.8k
62 votes
13 answers
56k views

Accessing the application.conf properties from java class with Play! 2.0

I want to add an object to the Global scope, and in order to construct it I need to pass it a path to a file. I don't want to hard code the file path in the source, and so I want to get that path from ...
Nitzan Tomer's user avatar
62 votes
9 answers
10k views

any experience with "Play" java web development framework? [closed]

I've just stumbled upon the following new java web framework: Play http://www.playframework.org/ http://www.playframework.org/documentation/1.0/home with such a stunning list of features, I'm ...
opensas's user avatar
  • 61.8k
61 votes
1 answer
18k views

How is Akka used in Play?

Play's home page says: Built on Akka, Play provides predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications. I'd like to know exactly how and where ...
OlivierBlanvillain's user avatar
61 votes
5 answers
4k views

Jenkins + Play 1.2.4 : problems with cobertura lock files / report

We have a Play 1.2.4 application and we got Jenkins (on Ubuntu) for the application. We're having problems with Cobertura. After running the tests (succesfully), every now and then, we get the ...
Touko's user avatar
  • 11.6k
60 votes
3 answers
21k views

Play framework hangs on startup at: "Loading project definition from"

I am just getting started with Play Framework. I have downloaded and installed play and created a sample java application. When I try to start the play console in the application directory it hangs at ...
Peter Moberg's user avatar
  • 3,098
59 votes
9 answers
45k views

Declare variable in a Play2 scala template

How do you declare and initialize a variable to be used locally in a Play2 Scala template? I have this: @var title : String = "Home" declared at the top of the template, but it gives me this error: ...
travega's user avatar
  • 8,332
59 votes
3 answers
36k views

What is the difference between 'CompletionStage' and 'CompletableFuture'

I have seen an example in each of them, but I need to know exactly what is the difference in deep because I think I can use both of them to get the same result, So I want to know then I can choose the ...
Ebraheem Alrabeea's user avatar
57 votes
5 answers
14k views

How can colored terminal output be disabled for sbt/play?

I would like to disable the color escape codes logged from sbt/play. Is this possible? And if it is, is there a way to do it without making changes to the config - i.e. via a command line switch or ...
Mark Hibberd's user avatar
  • 2,070
54 votes
2 answers
23k views

NodeJS vs Play Framework for large project

I am really torn between two different stacks with which to build a large application. One the one hand there is this option: Node.js express coffee script coffeekup mongoose/mongodb or ...
Jason Miesionczek's user avatar
53 votes
5 answers
4k views

-Ywarn-unused-import triggering on play routes file

I want to be able to use -Xfatal-warnings and -Ywarn-unused-import, the problem is that the compiler is triggering an error on the file which contains the play routes for my application: [error] /...
Ende Neu's user avatar
  • 15.7k
52 votes
6 answers
14k views

What are the major differences between Play Framework 1.0 and 2.0?

With the recent release of Play Framework 2.0, I would like to know if anyone could summarize ,from a high level standpoint, the major differences between Play Framework 1 & 2. I already compiled ...
Olivier Refalo's user avatar
51 votes
1 answer
11k views

How to declare a variable named 'type' in Play/Scala?

I want to declare a variable with name 'type' in a Play/Scala application, since my data has this field name and I'm using JSON transforms. It just makes more sense. Fortunately I could just rename ...
jmend's user avatar
  • 1,220
50 votes
1 answer
35k views

Web Frameworks: How is Play different from Spring MVC? [closed]

The Play Framework offers the following quick overview, but with the exception of the Groovy template engine (which you can get in Spring MVC if you want), Spring seems to offer all the same features ...
Play vs. Spring's user avatar
49 votes
2 answers
19k views

Play Framework 2.1 - Cannot find an implicit ExecutionContext

I am calling a webservice like this: WS .url(url) .get .map { response => // error occurs on this line response.status match { case 200 => Right(response.json) case status ...
EECOLOR's user avatar
  • 11.2k
49 votes
6 answers
26k views

Where do I put startup code in Play Framework?

I want to run some code on startup to pre-cache some stuff, and would also like to start a Timer to re-cache some things outside the critical path of a web request. Is this possible with Play ...
sanity's user avatar
  • 35.6k
48 votes
4 answers
16k views

Noise free JSON format for sealed traits with Play 2.2 library

I need to get a simple JSON serialization solution with minimum ceremony. So I was quite happy finding this forthcoming Play 2.2 library. This works perfectly with plain case classes, e.g. import ...
0__'s user avatar
  • 67.1k
48 votes
6 answers
9k views

Why does java wait so long to run the garbage collector?

I am building a Java web app, using the Play! Framework. I'm hosting it on playapps.net. I have been puzzling for a while over the provided graphs of memory consumption. Here is a sample: The ...
goggin13's user avatar
  • 7,916
47 votes
4 answers
52k views

how to remove key value from map in scala

Map(data -> "sumi", rel -> 2, privacy -> 0, status -> 1,name->"govind singh") how to remove data from this map , if privacy is 0. Map(rel -> 2, privacy -> 0, status -> 1,name-...
Govind Singh's user avatar
  • 15.4k
46 votes
5 answers
25k views

Adding Play JSON Library to sbt

How can I add the Play JSON library (play.api.libs.json) to my sbt project? When I added the following to my plugins.sbt file: addSbtPlugin("play" % "sbt-plugin" % "2.1.0") I faced this error: [...
Kevin Meredith's user avatar
46 votes
5 answers
54k views

GSON JsonObject "Unsupported Operation Exception: null" getAsString

Running a Play! app with Scala. I'm doing a request where the response is expected to be a JSON string. When checking the debugger, the JsonElement returns OK with all information as expected. However,...
crockpotveggies's user avatar
45 votes
3 answers
22k views

Play 2.4: Form: could not find implicit value for parameter messages: play.api.i18n.Messages

I am new to Play framework and tried to mimic the helloworld sample in my local machine but I encountered an error: routes: # Home page GET / controllers.Application.index ...
arjayads's user avatar
  • 573
44 votes
2 answers
41k views

ProcessBuilder gives a "No such file or directory" while Runtime().exec() works fine

I have an application, running on the Playframework, which needs to encode some video files. I used Process pr = Runtime.getRuntime().exec(execCode) for this (and it works perfectly), but as I need ...
Luuk D. Jansen's user avatar
42 votes
2 answers
25k views

What is a Boxed Error in Scala?

When I run my application, the browser shows [ExecutionException: Boxed Error] It doesn't say anything about the line number, etc. In the console, I have the following ! @6elaah0c8 - Internal ...
yzernik's user avatar
  • 1,191
42 votes
3 answers
23k views

Play Framework - add a field to JSON object

I have a problem with adding a field to Json object in Play Framework using Scala: I have a case class containing data. For example: case class ClassA(a:Int,b:Int) and I am able to create a Json ...
Paweł Kozikowski's user avatar
42 votes
5 answers
44k views

Separate back-end and front-end apps on same domain?

We are building a fully RESTful back-end with the Play Framework. We are also building a separate web front-end with a different technology stack that will call the RESTful API. How do we deploy both ...
Erich's user avatar
  • 2,509
42 votes
7 answers
21k views

Securing REST API on Play framework and OAuth2

I am developing an application with Play 2.0 and Scala that exposes some REST API. These APIs will be used by different applications, web, mobile or desktop, so the OAuth protocol (OAuth2) seems the ...
Marco's user avatar
  • 1,642
42 votes
3 answers
7k views

Discovery of Akka actors in cluster

I’ve been trying to wrap my head around the concepts of Akka and actor-based systems recently. While I have a pretty good understanding of the Akka fundamentals by now I’m still struggling with a few ...
Lunikon's user avatar
  • 3,781
40 votes
7 answers
25k views

Does Playframework 2.0.x support <else if> in templates

I wonder if play 2.0.3 and higher supports else if in views? I only read that one have to code that way: if {...}else{if{...}else{...}} cannot believe that.
Sven Malvik's user avatar
39 votes
2 answers
19k views

Choosing a Scala web framework [closed]

I am about to start a project for a web application that should run on a Tomcat server. I have decided to go for Scala - the other alternative where I work being Groovy - essentially for type safety. ...
Andrea's user avatar
  • 20.4k
38 votes
7 answers
36k views

Debug Playframework in Eclipse

I just moved from Netbeans to Eclipse. In Netbeans, I can debug Playframework applications out of the box. However, in Eclipse, it seems hard to configure this in order to debug a web app (a ...
Thang Nguyen's user avatar
  • 1,151
38 votes
6 answers
60k views

“Convert” Option[x] to x

I working with play for Scala (2.1) and I need to convert an Option[Long] value to Long. I know how to do the opposite, I mean: def toOption[Long](value: Long): Option[Long] = if (value == null) None ...
mahoosh's user avatar
  • 553
38 votes
5 answers
21k views

Spray, Akka-http and Play, Which is the best bet for a new HTTP/REST project

I'm going to develop new HTTP/REST services using Scala and Akka Actors. I have experience working with Play, but I don't really need a complete web Framework. From what I read, I think Spray is a ...
Fede's user avatar
  • 854
37 votes
1 answer
18k views

Play Framework @routes.Assets.at Compilation Error

I'm using Play 2.4.0 and I've been trying to follow the tutorial from the main page: https://playframework.com/ which is for Play 2.3 and after solving a couple of issues regarding changes in the ...
Daniel Romero's user avatar
35 votes
3 answers
10k views

Play's execution contexts vs scala global

How does the execution context from import scala.concurrent.ExecutionContext.Implicits.global differ from Play's execution contexts: import play.core.Execution.Implicits.{internalContext, ...
bjfletcher's user avatar
  • 11.3k
34 votes
6 answers
14k views

How to detect application mode in Play 2.x

From within a Play 2.1 application, how would I programmatically determine which mode the application is running in (i.e., Development vs. Production)? For example, it would be useful to be able to ...
kes's user avatar
  • 6,043
34 votes
4 answers
8k views

Frameworks comparation: Lift, Play and Wicket

What are the advantages and dis­advantages of frameworks Lift, Play and Wicket? What characteristics are best or only supported by each? Thanks
adelarsq's user avatar
  • 3,718

1
2 3 4 5
346