Menu
  • HOME
  • TAGS

Spring-Boot @RequestMapping and @PathVariable with regular expression matching

regex,spring,spring-mvc,spring-boot,webjars

The original code in the docs wasn't prepared for the extra slashes, sorry for that! Please try this code instead: @ResponseBody @RequestMapping(value="/webjarslocator/{webjar}/**", method=RequestMethod.GET) public ResponseEntity<Resource> locateWebjarAsset(@PathVariable String webjar, HttpServletRequest request) { try { String mvcPrefix = "/webjarslocator/" + webjar + "/"; String mvcPath = (String) request.getAttribute( HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); String fullPath =...

Error running tests in Play Framework after migrating to 2.4.x (Java)

java,playframework,guice,webjars,playframework-2.4

This was a problem in sbt-web. They've increased the limit: https://github.com/sbt/sbt-web/issues/104

angular.js loaded instead of angular.min.js with requirejs

javascript,angularjs,requirejs,webjars

I looked into the sources of requirejs. Here's what I found: requirejs splits each path, you defined in the config object, into its components (i.e. the directories, the filename and the extension). For some reason (node module naming conventions) the last extension is dropped. They do not check if that's...

Play Framework jquery webjar integration not working

jquery,scala,playframework,webjars

The WebJar locator is finding multiple files in the classpath that match the jquery.min.js search path. You should check your classpath to see what else contains a file that would match that query and the remove whatever is causing the duplicate file.

How to use RequireJS optimizer in Play framework?

requirejs,webjars,requirejs-optimizer,playframework-2.4

It turns out that RequireJS optimization support does not apply to all Webjars, but rather limited to Classic Webjars. Even then, a webjar build file has to be included with the regular module in order for rjs to work. If you look at the jQuery classic webjar, for example, you...

Use JQuery from Webjars using RequireJS

jquery,maven,requirejs,webjars

The only solution I found (which is a workaround) is playing woth "enforceDefine" value: requirejs.config({ enforceDefine : false, map : { 'libs/jquery' : { 'jquery' : "webjars/jquery/${jquery.version}/jquery" }, '*': { 'jquery' : 'libs/jquery', }, }, baseUrl : './', deps : [ 'MyMainPanel' ], }); I don't know why it works,...

How can I tell the contents of a webjar?

playframework,playframework-2.3,webjars

The easiest way to see the contents of WebJars is on http://www.webjars.org You can see that there are in fact two instances of react.js in the WebJar. So if you want to use the locator you need to be more specific about the path. But in this case I'd recommend...

How do I add webjars resources to lib-noir's app-handler?

clojure,ring,compojure,webjars,lib-noir

This seems to do it: (defroutes app-routes (route/resources "/") (route/resources "/" {:root "META-INF/resources/"}) (route/not-found "Not Found")) ...

Play 2.3 Webjars - default requirejs support - How to write define or require

requirejs,playframework-2.3,webjars

The WebJars Play2 Activator Template has all of this stuff working in it. So you should compare what you have with what is in there. I think that data-main="@routes.Assets.versioned("js/koapp/js_init")" needs to include the .js extension, like: data-main="@routes.Assets.versioned("js/koapp/js_init.js")". Also, the /vassets route should be: GET /vassets/*file controllers.Assets.versioned(path="/public", file: Asset) Notice the...

How to resolve multiple RequireJS config files from Webjars

javascript,spring,requirejs,webjars

The webjars-requirejs.js files are legacy artifacts. The newer RequireJS metadata is in the WebJar's pom.xml file. The webjars-locator library has some RequireJS utilities that make it easy to work with this metadata. The WebJar Docs include some details on how to use this.

PlayFramework with Scala, WebJars, ReactJS and RequireJS?

scala,playframework,requirejs,reactjs,webjars

This is not the easiest thing to do, but I was able to pull it off. I will give you some tips here. I also uploaded my own project to github. This is a very simple snake game built using React and RequireJs. It based on Webjars and Play Framework....

Why can't I access the file react.js from the react-0.12.2 webjar?

playframework,reactjs,playframework-2.3,webjars

There are in fact two instances of react.js in the WebJar. So if you want to use the locator you need to be more specific about the path. Before webjars-play version 2.3.0-3 there isn't an single method call way to do this so you can do one of the following:...

Webjars-play 2.3.x - Why do we need WebJarAssets.locate and routes.WebJarAssets.at when the path assets/lib/css/filename works

playframework,playframework-2.3,webjars

Versioned assets allow you to add some optimizations to your static asset loading - e.g. 304 Not Modified and far-future expires. For more info check out my Optimizing Static Asset Loading with Play Framework blog.