Velocity 2.0: Unreadable Engine-Core-2.0 JAR - velocity

I downloaded Velocity 2.0 (Engine-Core-2.0 JAR) from the Apache Velocity website, http://velocity.apache.org/download.cgi#engine , and am unable to use it:
The JAR is unreadable in ZIP Viewers like PeaZip, is there something special about this JAR?
velocity-engine-core-2.0.jar Archive is not readable.
Also in Eclipse,
Archive for required library: velocity-engine-core-2.0.jar' in project '..' cannot be read or is not a valid ZIP file
Also, another question: Velocity used to be packaged as a single JAR, like velocity-1.6.jar or velocity-1.7.jar. Why is 2.0 different?

The download links don't take into account the selected mirror (the fix is underway). Meanwhile, replace "http://velocity.apache.org" in the jars URLs with the mirror URL.
EDIT: the fix went through, the links should now work.

Related

Hyphenation doesn´t work with dita-ot 2.5.1 and Apache FOP

I use dita-ot to render to pdf.
Recently, I upgraded from dita-ot 1.8.M2 to 2.5.1
Updating my pdf plugins was quite a bit of work, but the only thing that I don´t get to work properly is hyphenation.
I did it all as described on the Apache website.
The relevant instruction in detail:
"Download the precompiled JAR from OFFO and place it either in the
{fop-dir}/lib directory, or in a directory of your choice (and append
the full path to the JAR to the environment variable
FOP_HYPHENATION_PATH)."
That is how it worked with dita-ot 1.8.M2, where the {fop-dir} was placed in the "org.dita.pdf2" plugin.
Now, {fop-dir} is in the "org.dita.pdf2.fop" plugin. Maybe this is the reason, why "fop-hyph.jar" is obviously not found by the process? But what about the environment variable?
Has anybody a solution?
I found the solution by myself: I just added the attribute <xsl:attribute name="hyphenate">true</xsl:attribute> to the attribute set common.block inside of the attribute file commons-attr.xsl.
I found out that not FOP or the jar file is the cause, when I compared a FO file generated with the old dita-ot (with hyphenation) to a FO file of the new dita-ot. What was missing was the hyphenate=true attribute in each block.
Thanks for your patience!

HTML5 RNC- datatype library "http://whattf.org/datatype-draft" not recognized

I tried to validate my HTML5 document against the Nu RNC set available in github.com/validator/validator/tree/master/schema/html using jing, I ended up with "datatype library "http://whattf.org/datatype-draft not recognized" error. I am not sure what is the error all about. Is it not possible to validate the HTML5 using this RNC set in jing?
Maintainer of the https://github.com/validator/validator/tree/master/schema/html5 schema here.
That schema’s not really meant for use outside the context of the Nu Html Checker. Among other things, it relies on a datatype library—set of Java classes—we don’t package/distribute separately.
The lack of it in your classpath causes the “Datatype library… not recognized” error you cite. For it to work, in your classpath you need to have a jar file with those classes and a special manifest.
We do distribute a jar file that contains those, but with a lot of other things too—the jar is 22MB.
You can get that (zipped) jar from here:
https://github.com/validator/validator/releases/download/17.3.0/vnu.jar_17.3.0.zip
Once you unzip that, you’ll have a local vnu.jar file, which you can use like this:
java -cp vnu.jar com.thaiopensource.relaxng.util.Driver \
-c https://raw.github.com/validator/validator/master/schema/html5/xhtml5.rnc \
FILE.xhtml
Of course if you have a local clone of the https://github.com/validator/validator repo, then you can replace https://raw.github.com/validator/validator/master/schema/html5/xhtml5.rnc with the filesystem path to the local copy of that xhtml5.rnc file.

Dropwizard serve external images directory

I have a dropwizard API app and I want one endpoint where I can run the call and also upload and image, these images have to be saved in a directory and then served through the same application context.
Is it possible with dropwizard? I can only find static assets bundles.
There is similar question already: Can DropWizard serve assets from outside the jar file?
The above module is mentioned in the third party modules list of dropwizard. There is also official modules list. These two lists are hard to find maybe because the main documentation doesn't reference them.
There is also dropwizard-file-assets which seems new. I don't know which module will work best for your case. Both are based on dropwizard's AssetServlet
If you don't like them you could use it as example how to implement your own. I suspect that the resource caching part may not be appropriate for your use case if someone replace the same resource name with new content: https://github.com/dirkraft/dropwizard-file-assets/blob/master/src/main/java/com/github/dirkraft/dropwizard/fileassets/FileAssetServlet.java#L129-L141
Edit: This is simple project that I've made using dropwizard-configurable-assets-bundle. Follow the instructions in the README.md. I think it is doing exactly what you want: put some files in a directory somewhere on the file system (outside the project source code) and serve them if they exist.

How can I add the Apache POI Library in Eclipse - for Selenium Webdriver project?

I need to add the apache poi to my project (I need hssf, ss and xssf). I downloaded a jar file from the internet but it does not contain xssf. I went to http://poi.apache.org/ and I downloaded this: http://www.apache.org/dyn/closer.cgi/poi/release/src/poi-src-3.9-20121203.zip, I extract it..and got stucked. I tried Part 1 but that was only for JavaDoc.
How should I proceed from here?
Download The latest stable release: Apache POI 3.16-FINAL distribution,
open your eclipse project properties,
Java Built Path > Libraries > Add external JARs,
then extract the zip file you downloaded and navigate the extracted folder,
select all the JARs under the sub folders (docs, lib, ooxml-lib),
then finally in the Order and Export section put marks to jar libs you just added,
and click OK.
Promoting a comment to an answer
You should head to the Apache POI Download Page, and then download the binary release. The binary releases have -bin- in their file names. The binary releases contain the POI jars, and their dependencies.
What you've downloaded with -src- in the name is the source package, which contains everything you need to build Apache POI yourself, but if you just want to get started you're much better off with the pre-compiled binary package.

how to configure apache tiles to read jsps from inside jar files?

The architecture of my web application is highly modular. I am using apache tiles as the templating framework. The app modules are bundled as different jar files and put inside WEB-INF/lib folder. So each jar file will contain its own tiles configuration files (containing tiles definitions) and related jsp templates.
I am using CompleteAutoloadTilesListener which is a part of tiles-extras package to read the tiles config files from the jar files. But the jsp files aren't picked up by tiles. When I access any definition, it couldn't find the jsp template file.
A configuration change will solve this problem? or should I subclass any tiles base class to let tiles load jsps from the jar?
Someone else ran into this problem before and even wrote a blog about it
It mentions this issue that is fixed, so you should be able to use the same setup and load your tiles definitions from the classpath.
I haven't tested it, but it looks like a sensible solution.