LinkedDataFragments / Client.js

[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.
http://linkeddatafragments.org/
Other
92 stars 35 forks source link

Add WebJars support #8

Closed wikier closed 8 years ago

wikier commented 10 years ago

WebJars are client-side web libraries packaged into JAR (Java Archive) files.

This new feature would allow any JavaEE application (using Servlet API >= 3.0) to easily user the LDF Javascript client.

The background of this PR is the support we're including in Apache Marmotta. This, in combination with having the artifact available from Maven Central due ASF rules (I can also help on that), would make the integration quite easy for us.

RubenVerborgh commented 10 years ago

Thanks! Could you please explain how I can test this?

wikier commented 10 years ago

Easy @RubenVerborgh:

mvn clean package

That would generate a target/client-js-1.1.5-SNAPSHOT.jar file bundling the library.

The trick webjars uses is actually quite simple: with any Servlet 3 compatible container, the WebJars that are in the WEB-INF/lib directory are automatically made available as static resources. This works because anything in a META-INF/resources directory in a JAR in WEB-INF/lib is automatically exposed as a static resource. And then you can normally use it:

<link rel="stylesheet" href="webjars/org.linkeddatafragments.client-js/1.1.5-SNAPSHOT/triple-pattern-fragments/FragmentsClient.js" />

We can customize some of those paths, that quite easy to do in the pom.xml file.

RubenVerborgh commented 10 years ago

And how can I run the generated JAR? Because the original code is written for Node.js, so I'd want to see whether it works outside of Node.

wikier commented 10 years ago

In any maven-based webapp, just add the dependency:

<dependency>
    <groupId>org.linkeddatafragments</groupId>
    <artifactId>client-js</artifactId>
    <version>1.1.5-SNAPSHOT</version>
</dependency>
wikier commented 10 years ago

I have to admit I have not so much experience with Node.js, but we'll figure out how.

I still need to check if the js dependencies work in that style, because I'd prefer to add dependencies to the webjars instead on bundling all together.

RubenVerborgh commented 10 years ago

Okay. Thanks for the work—if you find how to run/test this JAR easily, I'll merge it.

wikier commented 10 years ago

Yes, keep it on hold until I'll test it well.

I early opened this PR more for triggering the discussion.

RubenVerborgh commented 10 years ago

:+1:

RubenVerborgh commented 8 years ago

Closing this for now, given the age of this discussion. Feel free to reopen if there's any news.