playframework / play-java-rest-api-example Goto Github PK
View Code? Open in Web Editor NEWREST API using Play in Java
Home Page: https://developer.lightbend.com/start/?group=play
License: Creative Commons Zero v1.0 Universal
REST API using Play in Java
Home Page: https://developer.lightbend.com/start/?group=play
License: Creative Commons Zero v1.0 Universal
Separation on the basis of layers can possibly be more meaningful -
/Controller
/users
/posts
/Respository
/users
/posts
/Model
/posts
/users
If a tutorial for nosql would be provided that would be alot of help.
Since this is a learning project and the purpose of it is to get people to understand the process of a REST Api using the Play Framework, I can't understand why there isn't a single line if inline documentation explaining the basic principles of the code.
After cloning the repo, I cannot open it with IntelliJ IDEA. When I run Project->Open I get a "Resolve Error"
Full log:
[info] Loading global plugins from ~/.sbt/0.13/plugins
[info] Loading project definition from /..../play-java-rest-api-example/project
[info] Updating {file:/..../play-java-rest-api-example/project/}play-java-rest-api-example-build...
[info] Resolving org.scala-sbt#global-plugins;0.0 ...
[info] Resolving com.typesafe.play#sbt-plugin;2.6.7 ...
[info] Resolving com.typesafe.play#sbt-routes-compiler_2.10;2.6.7 ...
[info] Resolving org.scala-lang#scala-library;2.10.6 ...
[info] Resolving com.typesafe.play#twirl-api_2.10;1.3.12 ...
[info] Resolving commons-io#commons-io;2.5 ...
[info] Resolving com.typesafe.play#run-support_2.10;2.6.7 ...
[info] Resolving com.typesafe.play#build-link;2.6.7 ...
[info] Resolving com.typesafe.play#play-exceptions;2.6.7 ...
[info] Resolving com.lightbend.play#play-file-watch_2.10;1.0.0 ...
[info] Resolving com.lightbend.play#jnotify;0.94-play-2 ...
[info] Resolving com.github.pathikrit#better-files_2.10;2.14.0 ...
[info] Resolving com.typesafe#config;1.3.1 ...
[info] Resolving org.slf4j#slf4j-simple;1.7.25 ...
[info] Resolving org.slf4j#slf4j-api;1.7.25 ...
[info] Resolving com.typesafe.sbt#sbt-twirl;1.3.12 ...
[info] Resolving com.typesafe.play#twirl-compiler_2.10;1.3.12 ...
[info] Resolving org.scala-lang#scala-compiler;2.10.6 ...
[info] Resolving org.scala-lang#scala-reflect;2.10.6 ...
[info] Resolving com.typesafe.play#twirl-parser_2.10;1.3.12 ...
[info] Resolving com.typesafe.sbt#sbt-native-packager;1.3.1 ...
[info] Resolving org.apache.commons#commons-compress;1.14 ...
[info] Resolving org.apache.ant#ant;1.10.1 ...
[info] Resolving org.apache.ant#ant-launcher;1.10.1 ...
[info] Resolving com.lightbend.sbt#sbt-javaagent;0.1.4 ...
[info] Resolving com.typesafe.sbt#sbt-web;1.4.3 ...
[info] Resolving com.typesafe.akka#akka-actor_2.10;2.3.16 ...
[info] Resolving org.webjars#webjars-locator-core;0.33 ...
[info] Resolving org.apache.commons#commons-lang3;3.1 ...
[info] Resolving com.fasterxml.jackson.core#jackson-core;2.7.3 ...
[info] Resolving com.typesafe.sbt#sbt-js-engine;1.2.2 ...
[info] Resolving com.typesafe#jse_2.10;1.2.3 ...
[info] Resolving com.typesafe.akka#akka-contrib_2.10;2.3.16 ...
[info] Resolving com.typesafe.akka#akka-remote_2.10;2.3.16 ...
[info] Resolving io.netty#netty;3.8.0.Final ...
[info] Resolving com.google.protobuf#protobuf-java;2.5.0 ...
[info] Resolving org.uncommons.maths#uncommons-maths;1.2.2a ...
[info] Resolving com.typesafe.akka#akka-cluster_2.10;2.3.16 ...
[info] Resolving com.typesafe.akka#akka-persistence-experimental_2.10;2.3.16 ...
[info] Resolving org.iq80.leveldb#leveldb;0.5 ...
[info] Resolving org.iq80.leveldb#leveldb-api;0.5 ...
[info] Resolving com.google.guava#guava;12.0 ...
[info] Resolving com.google.code.findbugs#jsr305;1.3.9 ...
[info] Resolving org.fusesource.leveldbjni#leveldbjni-all;1.7 ...
[info] Resolving org.fusesource.leveldbjni#leveldbjni;1.7 ...
[info] Resolving org.fusesource.hawtjni#hawtjni-runtime;1.8 ...
[info] Resolving org.fusesource.leveldbjni#leveldbjni-osx;1.5 ...
[info] Resolving org.fusesource.leveldbjni#leveldbjni-linux32;1.5 ...
[info] Resolving org.fusesource.leveldbjni#leveldbjni-linux64;1.5 ...
[info] Resolving org.fusesource.leveldbjni#leveldbjni-win32;1.5 ...
[info] Resolving org.fusesource.leveldbjni#leveldbjni-win64;1.5 ...
[info] Resolving io.apigee.trireme#trireme-core;0.8.9 ...
[info] Resolving io.apigee.trireme#trireme-kernel;0.8.9 ...
[info] Resolving org.mozilla#rhino;1.7.7.1 ...
[info] Resolving io.apigee.trireme#trireme-node10src;0.8.9 ...
[info] Resolving io.spray#spray-json_2.10;1.3.3 ...
[info] Resolving com.typesafe#npm_2.10;1.2.1 ...
[info] Resolving org.webjars#npm;4.2.0 ...
[info] Resolving io.gatling#gatling-sbt;2.2.2 ...
[info] Resolving org.scala-sbt#sbt;0.13.15 ...
[info] Resolving org.scala-sbt#main;0.13.15 ...
[info] Resolving org.scala-sbt#actions;0.13.15 ...
[info] Resolving org.scala-sbt#classpath;0.13.15 ...
[info] Resolving org.scala-sbt#interface;0.13.15 ...
[info] Resolving org.scala-sbt#io;0.13.15 ...
[info] Resolving org.scala-sbt#control;0.13.15 ...
[info] Resolving org.scala-sbt#launcher-interface;1.0.1 ...
[info] Resolving org.scala-sbt#completion;0.13.15 ...
[info] Resolving org.scala-sbt#collections;0.13.15 ...
[info] Resolving jline#jline;2.14.3 ...
[info] Resolving org.scala-sbt#api;0.13.15 ...
[info] Resolving org.scala-sbt#classfile;0.13.15 ...
[info] Resolving org.scala-sbt#logging;0.13.15 ...
[info] Resolving org.scala-sbt#process;0.13.15 ...
[info] Resolving org.scala-sbt#compiler-integration;0.13.15 ...
[info] Resolving org.scala-sbt#incremental-compiler;0.13.15 ...
[info] Resolving org.scala-sbt#relation;0.13.15 ...
[info] Resolving org.scala-sbt#compile;0.13.15 ...
[info] Resolving org.scala-sbt#persist;0.13.15 ...
[info] Resolving org.scala-tools.sbinary#sbinary_2.10;0.4.2 ...
[info] Resolving org.scala-sbt#compiler-ivy-integration;0.13.15 ...
[info] Resolving org.scala-sbt#ivy;0.13.15 ...
[info] Resolving org.scala-sbt#cross;0.13.15 ...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-48dd0744422128446aee9ac31aa356ee203cc9f4 ...
[info] Resolving com.jcraft#jsch;0.1.50 ...
[info] Resolving org.scala-sbt#serialization_2.10;0.1.2 ...
[info] Resolving org.scala-lang.modules#scala-pickling_2.10;0.10.1 ...
[info] Resolving org.scalamacros#quasiquotes_2.10;2.0.1 ...
[info] Resolving org.json4s#json4s-core_2.10;3.2.10 ...
[info] Resolving org.json4s#json4s-ast_2.10;3.2.10 ...
[info] Resolving com.thoughtworks.paranamer#paranamer;2.6 ...
[info] Resolving org.spire-math#jawn-parser_2.10;0.6.0 ...
[info] Resolving org.spire-math#json4s-support_2.10;0.6.0 ...
[info] Resolving org.scala-sbt#run;0.13.15 ...
[info] Resolving org.scala-sbt#task-system;0.13.15 ...
[info] Resolving org.scala-sbt#tasks;0.13.15 ...
[info] Resolving org.scala-sbt#tracking;0.13.15 ...
[info] Resolving org.scala-sbt#cache;0.13.15 ...
[info] Resolving org.scala-sbt#testing;0.13.15 ...
[info] Resolving org.scala-sbt#test-agent;0.13.15 ...
[info] Resolving org.scala-sbt#test-interface;1.0 ...
[info] Resolving org.scala-sbt#main-settings;0.13.15 ...
[info] Resolving org.scala-sbt#apply-macro;0.13.15 ...
[info] Resolving org.scala-sbt#command;0.13.15 ...
[info] Resolving org.scala-sbt#template-resolver;0.1 ...
[info] Resolving org.scala-sbt#logic;0.13.15 ...
[info] Resolving org.scala-sbt#compiler-interface;0.13.15 ...
[info] Resolving org.scala-lang#jline;2.10.6 ...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
/..../play-java-rest-api-example/build.sbt:8: error: type mismatch;
found : Seq[sbt.ModuleID]
required: Set[sbt.ModuleID]
dependencyOverrides := Seq(
^
[error] Type error in expression
Invalid response.
I have sbt setup and the project starts so I get: sbt server started at 127.0.0.1:4280
But if I try to open localhost:4280
I get the console output:
Exception in thread "sbt-networkchannel-51982" [info] new client connected from: 52358
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.net.SocketInputStream.read(SocketInputStream.java:127)
at sbt.internal.server.NetworkChannel$$anon$1.run(NetworkChannel.scala:29)
[info] new client connected from: 52362
Got invalid chunk from client: Parse error: expected json value got G (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got H (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got C (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got U (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got U (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got A (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got D (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got A (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got A (line 1, column 1)
Got invalid chunk from client: Parse error: expected json value got C (line 1, column 1)
Got invalid chunk from client: Parse error: exhausted input
Shutting down client connection
I see in the conf/posts.routes
file that you are using a POST request to update the record. This is not a standard RESTful request. The request headers should be PUT or UPDATE.
Please update this example which is sort of abusing REST interpretability.
Refer. https://en.wikipedia.org/wiki/Representational_state_transfer
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.