libraries for JSF (Sun/Oracle Mojarra) - jsf-2

I am downloading Sun/Oracle Mojarra implementation of JSF from http://javaserverfaces.java.net/download.html
I downloaded the latest -2.1.9 binary. It comes with only one jar - javax.faces-2.1.9.jar.
I had a sample project which I believe is using the older 2.0 version, which includes 2 jars - jsf-api.jar and jsf-impl.jar.
I replaced those 2 older jars with the single new jar. It seems like the sample project still works well.
My question:
Is there anything else I need to do besides replacing those 2 jars???
Any special reason this is this changed from 2 jars to 1?
Thanks a lot.
MORE:
I noticed versions in my faces-config.xml
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0">
</faces-config>
I changed 2.0 and 2_0 to 2.1 and 2_1. The sample project still works. SHould I make these changes?

Is there anything else I need to do besides replacing those 2 jars?
No.
Any special reason this is this changed from 2 jars to 1?
Around the time of the release of 2.1.6, they've refactored the build system conform Java EE Maven rules. See also Mojarra issue 2028. This resulted in the two well known jsf-api.jar and jsf-impl.jar files being replaced by a single javax.faces.jar file.
I changed 2.0 and 2_0 to 2.1 and 2_1. The sample project still works. SHould I make these changes?
You can just do so. The only difference is that the faces-config 2.1 XSD definies two new elements as opposed to faces-config 2.0 XSD:
<facelet-cache-factory> to register a custom FaceletCache
<redirect-param> to specify request parameters for in a redirect navigation case.
If you don't need any of them, then it don't matter if you're using the 2.0 or 2.1 XSD. Mojarra 2.1 has internally no 2.0 fallback modus when using JSF 2.1 with a 2.0 XSD.

Related

What is the different between io.swagger.annotations and com.wordnik.swagger.annotations

I am new to swagger and found there are two packages for swagger annotation: io.swagger.annotations and com.wordnik.swagger.annotations. I wonder what the difference is between them and what I should use?
The com.wordnik package is for the older swagger specifications, 1.x. As of swagger specification 2.0, the package is now io.swagger. The annotation signatures should be the same, just the package has changed.
These are different versions of swagger which go with different versions of other supporting software stack that you might be using.
I too came across these two a month ago when trying to integrate my application with swagger ui. I was using cxf 2.7.11, jackson 2.6.0 with spring 3.0.7 . I struggled a lot with com.wordnik (older version where swagger json is generated at url api_docs with usage of ApiListingResource etc) but then thought of implementing io.swagger (newer version) just to see the difference. Turned out that was the version i should have been using in the first place. Everything fell in place after that.
One addition in case others were wondering, too:
We used swagger version 1.3.13 which was called swagger-core_2.10. Initially I thought this may indicate a swagger API 2.X compatibility which it actually isn't: 2.10 is the bundled Scala version (mentioned here) This means means 25 MB of unecessary dependenies! So the current swagger version 1.5.X was rewritten in pure java and is much smaller in size. The scala version was moved to a separate project.

Compiling Vaadin Widgetsets and Using Generated Files In Another Project

I compiled the GoogleMapWidget (http://vaadin.com/directory#addon/36) using Eclipse, and it generated some files under WEB-INF/vaadin/widgetsets. Then I copied that entire widgetsets directory to another projects in the WEB-INF/vaadin, and tried to use that widget in the second project, but it doesn't seem to want to work.
Are the compiled widgetsets not reusable?
Thank you in advance
I haven't tried, but I guess it should work. However I don't see any reason that justifies the effort. Widgetset compilation takes about one minute, so why bother.
The widgetset is not meant to be compiled every time you build the application. Only if you do client side widget development or add a new addon that requires wigetset recompilation.
Remember to change the widgetset in your web.xml
<init-param>
<description>Application widgetset</description>
<param-name>widgetset</param-name>
<param-value>com.example.widgetset.MySharedWidgetset</param-value>
</init-param>
You might also want to copy the Widgetset .gwt.xml file to the package you described in your web.xml for param widgetset.

Ignoring irrelevant resource bundles in IntelliJ IDEA autocomplete

When editing JSF XHTML files and using autocomplete for resource bundle keys, IntelliJ seems to scan the whole project including libraries for ALL property files - this is very annoying because you get many thousands of irrelevant keys mixed up with your own small JSF declared resource bundle. Is it possible to ignore library property files? This was default behaviour in Netbeans for example, one of the things that really annoys me in IntelliJ.
Unfortunately, it's not possible to control it in the current IDEA version (12), all the files are always scanned. Please submit a request to make it configurable and we'll consider implementing it in the future updates.

Codenameone with WSDL NB - ClassDefNotFound

I have used NB to add a "client web service" to a Codename one app through the NB interface. This works fine in the simulator.
The WSDL classes are generated during build automatically and I have them landing in com.myco.myapp.generated package.
Having checked the generated JAR the WSDL classes are there all ok.
But when I push this to the "build for Android" to codename1, run on the device I get
An Internal application error occurred : java.lang.NoClassDefFoundError: com.myco.myapp.generated.SimpleStockList_Service
But the class is definitely there in the JAR.
I am sure its something to do with the JAR and its manifest, but never really had to get behind the scenes with Ant and JARs and builds to know what to do.
As the classes are generated during ant build, I can not pack them up into a library. (tried that and get fail due to 2 instances of same class.)
Codename One doesn't support binary libraries at this time, you will need to integrate the source code into the build process. There are many complexities involved in supporting binary libraries in such a setup.
Thanking Shai for his help.
Ultimate answer is not to use WSDL as moving objects relies Serialization which is not included in the small Java package.
Due to this I created a custom servlet which codename1 ConnectionRequest can deal with via a standard HTTP request.
This is how I achieved it
http://www.jamesarbrown.com/?p=164

Enable generics in blackberry jde 4.5.0

When i compiled my application in blackberry it shows the following error.
generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
how to solve this
Java 1.3 is barbaric and no one should ever have to suffer its indignities. Fortunately, there is a solution!
Generics, enums, changing return signature in overrides, and pretty much everything that makes java usable was introduced in java 1.5. (see http://en.wikipedia.org/wiki/Java_version_history). Fortunately, most of java 1.5 was designed to be backwards compatible and not require JVM / bytecode changes. (or maybe this was unfortunate, as it lead Java's implementation of generics to be much weaker than C#. just try creating a generic class with static methods / fields that use the generic parameter)
This IBM article does a good job of explaining the background:
http://www.ibm.com/developerworks/java/library/j-jtp02277.html
But this JVM similarity allowed for creation of tools such as:
http://retrotranslator.sourceforge.net/
This is the section from my Ant buildfile that calls retrotranslator:
&lt java jar="${transformer.jar.exe}"
fork="true"
classpath="${epic-framework.dir}/tools/retrotranslator-runtime13-1.2.9.jar:${epic-framework.dir}/tools/retrotranslator-runtime-1.2.9.jar"
args="-srcjar ${build.dir}/classes5.jar -target 1.3 -destjar ${build.dir}/classes5to3.jar"
/>
Run the converted jar through preverify.exe and then give it to rapc.exe and you will have a working Blackberry app written with Java 1.5.
Edit: I missed a key detail in my original post. In addition to being Java 1.3, the Blackberry class hierarchy is missing many classes that would normally be a part of a Java SE 1.3 JDK. The one you will hit first is StringBuilder -- javac transforms ("string" + "otherstr" + "blah blah") into StringBuilder.append("string").append("otherstr").append("blah blah"). That class doesn't exist on BB, so you break. However, BB has StringBuffer, so writing an adapter between the two is pretty easy. The one catch is that BB disallows apps from adding classes into java.*. This can be very effectively fixed in the build process: 1) build your app against Java 1.5 w/ java.lang.StringBuilder on the classpath, 2) string transform java.lang.Stringbuilder (and everything else in your compat shim) to live in com.mycorp.java.lang.StringBuilder and build it into a JAR file. 3) Use that JAR file w/ retrotranslator and retrotranslator will update all bytecode references to java.lang.StringBuilder so that they now point to com.mycorp.java.lang.StringBuilder. Now you have a java 1.3 compatible bytecode that can be run on a Blackberry.
If anyone is interested in this stuff, contact me. I could look into open sourcing the compat library I have.
This is a limitation of J2ME, which uses a subset of the J2SE (no collections, reflection, etc.) and a Java language level of 1.3. Any code written for J2SE will most likely need to be manually ported.
It seems the JDK5 is not yet supported.
Same question was asked on the blackberrry forum but about enum support:
Sadly, the BlackBerry api is very behind in terms of Java versioning. There's no Generics, no Maps, no Enums - it's based around JDK 1.3.
I believe there is no way of enabling this feature within your BlackBerry app. If you find one, I'd be very interested to hear about it.

Resources