Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does spray find resources - e.g. javascript

Tags:

spray

It was simple to build my first servlet with spray-io.

But the recources referenced in the header are never found.

< head> ... < script src="javascript/jquery/jquery-1.9.1.js"/> ... < / head>

In which directory does one have to put those recsources, or how can spray be directed to look up there?

Simple question, but I could not figure out.

Many thankx

Girgl

like image 932
Jörg Avatar asked Nov 15 '13 20:11

Jörg


1 Answers

With Spray routing, I use these directives -

pathPrefix("css") { get { getFromResourceDirectory("css") } } ~
pathPrefix("js") { get { getFromResourceDirectory("js") } } ~ 

"css" and "js" have to be in src/main/resources directory

like image 64
Bharadwaj Avatar answered Sep 20 '22 23:09

Bharadwaj