GithubHelp home page GithubHelp logo

playframework / play-java-websocket-example Goto Github PK

View Code? Open in Web Editor NEW
88.0 31.0 53.0 308 KB

Example Play Java application showing Websocket usage with Akka actors

Home Page: https://developer.lightbend.com/start/?group=play

License: Creative Commons Zero v1.0 Universal

Java 76.84% CoffeeScript 10.07% Scala 2.59% CSS 5.57% HTML 3.31% Shell 1.62%
playframework example example-project sample sample-app jvm webapp

play-java-websocket-example's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

play-java-websocket-example's Issues

Unfamiliar Syntax

Sorry for my ignorance, but could someone explain how the syntax on line 38 of StocksActor.java works?

.<Iterable<ActorRef>>map(Collections::singletonList)

How can there be a Generic Type <Iterable<ActorRef>> after the dot operator and before the map call?

Running this play project from intellij fails in compile error

[info] Compiling 3 Scala sources and 10 Java sources to /Users/arul/github/reactive-stocks-java8/target/scala-2.11/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.11.2. Compiling...
[info] LESS compiling on 1 source(s)
[info] CoffeeScript compiling on 1 source(s)
[info]   Compilation completed in 10.158 s
[error] javac: invalid source release: 1.8
[error] Usage: javac <options> <source files>
[error] use -help for a list of possible options
[error] (compile:compile) javac returned nonzero exit code
[error] application - 

! @6jliijm36 - Internal server error, for (GET) [/] ->

play.PlayExceptions$UnexpectedException: Unexpected exception[The compilation failed without reporting any problem!]
    at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1$$anonfun$apply$20.apply(PlayReloader.scala:235) ~[na:na]
    at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1$$anonfun$apply$20.apply(PlayReloader.scala:235) ~[na:na]
    at scala.Option.getOrElse(Option.scala:120) ~[scala-library-2.11.2.jar:na]
    at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:235) ~[na:na]
    at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:229) ~[na:na]
Caused by: sbt.compiler.CompileFailed: null
    at sbt.compiler.JavaCompiler$JavaTool0.compile(JavaCompiler.scala:77) ~[na:na]
    at sbt.compiler.JavaTool$class.apply(JavaCompiler.scala:35) ~[na:na]
    at sbt.compiler.JavaCompiler$JavaTool0.apply(JavaCompiler.scala:63) ~[na:na]
    at sbt.compiler.JavaCompiler$class.compile(JavaCompiler.scala:21) ~[na:na]
    at sbt.compiler.JavaCompiler$JavaTool0.compile(JavaCompiler.scala:63) ~[na:na]
[warn] play - No application found at invoker init

I just could not run any of the sample java 8 project from intellij. any idea?

Security issue with sameOriginCheck

Hi,

On line 106 of file HomeController : https://github.com/playframework/play-java-websocket-example/blob/2.6.x/app/controllers/HomeController.java#L106, you are checking origin like that:

return origin.contains("localhost:9000") || origin.contains("localhost:19001");

If someone sends an Origin header with the value localhost:90000 it will be valid even if this is not the same origin. I understand that the port 90000 doesn't exist at all, but imagine someone uses the following code (by simply modifying the code you provide):

return origin.contains("mydomain.com");

It is still possible to do Cross-Site WebSocket Hijacking by using (buying) the domain amydomain.com.

I think it would be preferable to use the equals or equalsIgnoreCase method.

too complicated

It is too complicated, Not suitable for learning websocket.

Does not compile due to unresolvable dependencies

I get the error below when trying to compile the project.
Also, resolving and downloading is extremely sloooooow (see total time below).
Is something wrong with the repositories?

[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.play#sbt-link;2.3-2014-03-25-58325fd-SNAPSHOT: not found
[warn] :: com.typesafe.play#play-exceptions;2.3-2014-03-25-58325fd-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
error sbt.ResolveException: unresolved dependency: com.typesafe.play#sbt-link;2.3-2014-03-25-58325fd-SNAPSHOT: not found
[error] unresolved dependency: com.typesafe.play#play-exceptions;2.3-2014-03-25-58325fd-SNAPSHOT: not found
[error] Total time: 2247 s, completed 09.04.2014 15:19:38

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.