playframework

My Play! Application doesn't have an application.log

大城市里の小女人 提交于 2020-01-04 05:58:30
问题 I got an error message saying: This exception has been logged with id 1mhqg4onc But I don't see this exception in the logs. I only have myapp.DEBUG , myapp.ERROR , myapp.FATAL , myapp.INFO , myapp.TRACE and myapp.WARN in my myapp/logs directory. I thought application.log was just supposed to be there by default. It's in my local machine but not when I deploy to production and that's where this exception is happening. I tried adding a file at conf/application-logger.xml with the default

How do I invoke non-GET/POST HTTP methods in Play?

≯℡__Kan透↙ 提交于 2020-01-04 05:51:32
问题 I have a RESTful Play 2.0 application, and I'd like to call DELETE /sessions from a link in the browser. How do I do this? Rails has a convention of using a _method query parameter for non-GET/POST requests, but Play's documents don't mention this. Also, do I have to create a separate form or XMLHttpRequest in order to invoke the method from a link's href or is there something like Rails's data-method attribute? 回答1: You will not do that with common link. Cite from similar topic on Google

Play Framework submitting boolean values with checkbox?

痴心易碎 提交于 2020-01-04 05:05:15
问题 Using Play 2.3.x I am trying to understand how checkboxes are handled in forms. This question seems like an outdated solution for an older version of Play. I understand that checkbox info will only be posted if checked, but I've created a small sample app and no info is posted even if I check the boxes. Here is my sample "Hello World" application Model public static class Hello { @Required public String name; @Required @Min(1) @Max(100) public Integer repeat; public String color; public

Play framework Route case insensitive

你说的曾经没有我的故事 提交于 2020-01-04 04:58:06
问题 We are currently working on Play 2.5.x We wanted to achive case insensitive routing to be done. Say for example GET /via/v1/organizations http.organizationApi() In the URL we wanted to achive http://localhost:9000/abc/v1/organizations http://localhost:9000/ABC/V1/OrganIZations Is the a way to achive this bu using regular expression? Can some one point to or provide me an example? 回答1: You can define a request handler to make the URL case insensitive. In this case, the following handler will

play framework H2 db evolutions compatible with sqlite / mysql?

这一生的挚爱 提交于 2020-01-04 04:06:35
问题 So far, I have been using play framework's default SQL generation with H2 in memory db. Is there any other DB with which these SQL scripts are fully compatible? I like the auto generation of SQL as I am still in the developing phase, but I would like to use a persistent db along with it. What are my options? I briefly tried with sqlite, but there are some incompatibilities such as AUTOINCREMENT, constraints etc. 回答1: There are two good options and choice belongs to you: Preferably for

play framework H2 db evolutions compatible with sqlite / mysql?

扶醉桌前 提交于 2020-01-04 04:06:27
问题 So far, I have been using play framework's default SQL generation with H2 in memory db. Is there any other DB with which these SQL scripts are fully compatible? I like the auto generation of SQL as I am still in the developing phase, but I would like to use a persistent db along with it. What are my options? I briefly tried with sqlite, but there are some incompatibilities such as AUTOINCREMENT, constraints etc. 回答1: There are two good options and choice belongs to you: Preferably for

Invalid JSON in Playframework 2.1 Test POST Request

微笑、不失礼 提交于 2020-01-04 02:56:07
问题 I am trying to test a POST route (on Playframework 2.1/ Java) and keep getting Bad Request - Invalid JSON response. Please let me know what I am doing wrong. My Test code is below. running(fakeApplication(), new Runnable() { public void run() { Map map = new HashMap(); map.put("key1", "val1"); map.put("key2", 2); map.put("key3", true); JsonNode df= Json.toJson(map); Result result = route (fakeRequest(POST, "/item").withHeader("Content-Type", "application/json").withSession(AccountTest.USER

How to generate CSRF token in Reactjs and send to Play Framework?

六眼飞鱼酱① 提交于 2020-01-04 02:52:33
问题 I was trying to send a post request from react form to play framework. It is throwing the following error: Caused by: java.lang.RuntimeException: No CSRF token was generated for this request! Is the CSRF filter installed? While using Play templates, CSRF token is handled from the template itself. Since I'm trying to use React for front end, I cannot use Play templates. Can anyone guide me on generating CSRF token in React and passing it to Play? Thanks in advance 回答1: It looks like you can

Creating a very secure login with cookies and java

倾然丶 夕夏残阳落幕 提交于 2020-01-04 02:20:07
问题 I'm designing a very secure login mechanism using play framework2. Since Play does not have a notion of sessions and keep things in the cookies (which I like) I was wondering what are the security measures I need to think about. We obviously going to use SSL to communicate the login credentials and also the cookie is going to be encrypted value of some of user's information like their email or userid. Is it possible that someone can sniff that cookie or get a hold of it from another user's

Play framework: merge action only works in the Controller that triggered it

一笑奈何 提交于 2020-01-04 01:37:06
问题 I have a simple Play applicaiton for test. I have 2 controllers, one is a "ListController" that displays a list of entries. Each entry has an "edit" link which goes to the "EditController". The "EditController" diplays the html form with the existing data for the entry, and the submit button posts that data towards another method in the "EditController", which saves the data to db and redisplays the newly modify data in the form. All this works ok. However once I modify an entry (which is