playframework-2.0

Java Play 2 - Deployment

╄→尐↘猪︶ㄣ 提交于 2019-12-21 06:44:18
问题 Updated 08.18.2012 I am using Play 2.0.2 and I want to deploy my app to Amazon Webservices. I think the easiest way to do this is via Elasticbeanstalk. I used Play2war to package my app https://github.com/dlecan/play2-war-plugin/ I was able to package it with play war According to the usage guide of play2war, I renamed my file to ROOT.war because i used Linux 32bit Tomcat7. I also used the servlet 3.0 as described in the tutorial on play2war. (tomcat 7 -> servlet 3.0). The file size is 31mb.

Java Play 2 - Deployment

℡╲_俬逩灬. 提交于 2019-12-21 06:44:01
问题 Updated 08.18.2012 I am using Play 2.0.2 and I want to deploy my app to Amazon Webservices. I think the easiest way to do this is via Elasticbeanstalk. I used Play2war to package my app https://github.com/dlecan/play2-war-plugin/ I was able to package it with play war According to the usage guide of play2war, I renamed my file to ROOT.war because i used Linux 32bit Tomcat7. I also used the servlet 3.0 as described in the tutorial on play2war. (tomcat 7 -> servlet 3.0). The file size is 31mb.

How to verify Instagram real-time API x-hub-signature in Java?

天大地大妈咪最大 提交于 2019-12-21 06:39:37
问题 I'm using Play framework to develop consumer for Instagram real-time API. But still could not perform x-hub-signature verification properly. So, how can we perform Instagram x-hub-signature verification using Java and Play framework? Here is my current code: From the Play framework, I obtain the JSON payload using this method: public static Result receiveInstaData(){ JsonNode json = request().body().asJson(); //obtain the x-hub-signature from the header //obtain the corresponding client

How to debug Play 2 unit test for server side

大憨熊 提交于 2019-12-21 06:36:10
问题 I have an unit test like this: @Test public void callRegisterByForm() { // AnyContentAsJson anyContentAsJson = null; running(fakeApplication(), new Runnable() { @Override public void run() { Map<String, String> map = new HashMap<String, String>(); map.put("phoneNumber", "+5103978860"); map.put("countryCode", "us"); Result result = routeAndCall(fakeRequest("POST", "/register").withFormUrlEncodedBody(map)); assertThat(status(result)).isEqualTo(OK); assertThat(contentType(result)).isEqualTo(

Play! Framework - creating simple html links

时光怂恿深爱的人放手 提交于 2019-12-21 05:36:20
问题 I have a website that I have made using several HTML files and one CSS file. I am currently attempting to switch over to the Play! Scala Framework. For some reason I am having a really hard time figuring out how to link one html page to another. Right now all my html files are saved in the 'views' folder with names such as "index.scala.html", "aboutpage.scala.html" and so on. In simple HTML, to create a button link to a new page it looks something like this: <form action="index.html" method=

How to implement pluralize & other extensions using Playframework 2.0

旧时模样 提交于 2019-12-21 04:53:30
问题 In playframework 1.x there used to be some bundled java extensions for the templating engine: http://www.playframework.org/documentation/1.2.3/javaextensions I'm looking for the same functionality in playframework 2.0. For example how would I do this? colour${['red', 'green', 'blue'].pluralize()} I am doing this malually now: We have @colours.size colour@if(colours.size > 0){s} the must be a cleaner more reusable way to do this? 回答1: You can leverage the pimp my lib Scala pattern to implement

Setting a custom root URL in Play 2.0

筅森魡賤 提交于 2019-12-21 04:50:51
问题 I have a play appliaction that works if It is the root of the web host however I want to load it as a sub-url of my host That is http://example.com/ <- This works fine and i want to move to it http://example.com/AwesomePlayApplication/ <- This want me to rewrite all the routes Is there a way to just set a custom root URL that will translate all my configured routes? 回答1: Add the following configuration key in your conf/application.conf file: application.context="/AwesomePlayApplication" 回答2:

How to rewrite synchronous controller to be asynchronous in Play?

*爱你&永不变心* 提交于 2019-12-21 04:08:56
问题 I'm using Play framework 2.2 for one of my upcoming web application. I have implemented my controllers in synchronous pattern, with several blocking calls (mainly, database). For example, Synchronous version: public static Result index(){ User user = db.getUser(email); // blocking User anotherUser = db.getUser(emailTwo); // blocking ... user.sendEmail(); // call to a webservice, blocking. return ok(); } So, while optimising the code, decided to make use of Asynchronous programming support of

Attaching sources in IntelliJ IDEA for scala project

社会主义新天地 提交于 2019-12-21 04:05:02
问题 I have Playframework 2 project with Scala (very small one). It uses Scala Anorm library. I have the code like this: package models .. import anorm.SqlParser._ ... val rowParser = scalar[Long] So, I would like to see source of scalar method. Trying to attache the sources I have in my plaframework source folder, but IDEA just swallows my request and does nothing back. I use last version of IDEA and Scala plugin. Is it bug, probably? 回答1: Aha.. fixed. So: I used to use 'attach source' in the top

Play! framework: customize which tests are run

这一生的挚爱 提交于 2019-12-21 03:38:18
问题 I have a Play! 2 for Scala application, and I am using Specs2 for tests. I can run all tests with the test command, or a particular specification with test-only MyParticularSpec . What I would like to do is mark some particular specifications, or even single methods inside a specification, in order to do things like: running all tests that are not integration (that is, that do not access external resources) running all tests that do not access external resources in write mode (but still