Where is WinHttpClients in HttpClient? - apache-httpclient-4.x

I'm following a example of HttpClient4.4, which is
https://hc.apache.org/httpcomponents-client-4.4.x/httpclient-win/examples/org/apache/http/examples/client/win/ClientWinAuth.java
However, this class cannot be compiled, because of NOT FOUND WinHttpClients.
I'm sure that the lib I imported is 4.4. So, is there anyone knows what's going on? (I have already checked my classpath. Still not found this class also.)
Thanks

Windows specific is shipped as a separate module. Make sure to add httpclient-win as a dependency to your project
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-win</artifactId>
<version>4.4</version>
</dependency>

Related

Trouble implementing p:linkButton

I am trying to use the Primefaces link button component. I tried using Primefaces 6.2 and the project builds but I get the error message
"/index.xhtml #82,60 <p:linkButton> Tag Library supports namespace: http://primefaces.org/ui, but no tag was defined for name: linkButton"
When I try to update my primefaces version to 6.2.RC1 or 6.2.RC2, I get a DependencyResolutionException. How can I properly link Primefaces in my pom file so that I can use the linkButton? I noticed that the Primefaces showcase for the component says it is using 6.3 and have tried that as well, even though I didn't see that version on the repository list. Is this component not available yet?
Here are the primefaces dependencies in my pom.xml...
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.3</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.9</version>
</dependency>
This component is supported in 7.0. At the time of the question, the showcase was running a SNAPSHOT version of 6.3 which was not released but became 7.0. sThe fact that the showcase was running something newer than OP used made it visible there. See https://github.com/primefaces/primefaces/issues/3613
Could not figure out how to get the p:linkButton working but I instead used p:button to get the same exact functionality as described in the Primefaces showcase.

Does PrimeFaces Extensions components use OmniFaces?

I was looking for any omnifaces import in PrimeFaces Extensions API but did not found.
http://primefaces-extensions.github.io/reports/apidocs/index.html
Question in title. Any ideas? Or I'm on wrong way and PE don't use OmniFaces?
No.
See <dependencies> in the PFE project POM. That's all.

Google maps classes not showing in Import-Package in MANIFEST.MF

I'm using the maven-bundle-plugin and trying to bundle Google maps dependency.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-ClassPath>*;scope=compile|runtime</Bundle-ClassPath>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Directory>OSGI-INF/lib</Embed-Directory>
<Import-Package>
*
</Import-Package>
<_exportcontents>
*
</_exportcontents>
</instructions>
</configuration>
</plugin>
When I inspect the JAR (Manifest.MF) I can see com.google.maps.model in Export-Package but not in Import-Package. How can I get it in the Import-Package as well?
This question is linked to a previously unresolved question How to import a class from third party jar file in an OSGi component
Well, there shouldn't be anything in the Import-Package here, as you're not importing the google maps classes, you are embedding them. You're packing the google jar inside your own bundle, and Import-Package applies only when you want to use those classes exported from another bundle.
As of the other question, I'm not entirely sure (I don't use the maven bundle plugin at all) but the 'exportcontents *' seems suspect, exporting too much can lead to subtle problems.
I'd say start by exporting nothing and add packages as needed.
If you are embedding the jar in your bundle and want to access its classes, use the Include-Resource instruction, it has an option to unroll a JAR resource (see # option)

Logback: "Could not find Janino library on the class path"

I'm getting error message Could not find Janino library on the class path. Skipping conditional processing. What should I incude in classpath to fix this (lib and version)?
Logback requires the Janino library for conditional logging. You don't need it if you aren't using the structures in your config files.
If you are using conditionals, you will need to add the Janino dependency. You can add this to your pom.xml file to get the dependency:
<!-- The org.codehaus.janino:commons-compiler:2.6.1 dependency -->
<!-- will be automatically pulled in by Maven's transitivity rules -->
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>2.6.1</version>
</dependency>
I believe this question is a duplicate of this one.

org.json JAR provisioning

I was wondering why www.json.org/anyone else doesn't provide an official JAR package of org.json for download? All queries I find of people asking where they can download the JAR results in replies to the page which just lists the source files.
It seems a bit cumbersome to expect everybody to download each source file and prepare the JAR file themselves.
Have you considered using Maven? for instance, if you wanted a JAR to pars JSON you could just include...
http://mvnrepository.com/artifact/org.codehaus.jackson/jackson-core-asl/1.9.6
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.6</version>
</dependency>
in a pom.xml, this will give you the jar for JSON.
Or better yet, use the org.json one...
http://mvnrepository.com/artifact/org.json/json
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
I downloaded a jar from here:
http://code.google.com/p/org-json-java/downloads/detail?name=org.json-20120521.jar&can=2&q=
The implementation from json.org by Douglas Crockford is nōn-free. Luckily, a Free almost drop-in replacement exists (apparently, Google’s code packaged by someone else for Maven Central):
<dependency>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
<version>0.0.20131108.vaadin1</version>
</dependency>
Add this to pom.xml instead of using the json.org one. We had to do only one minor change to our code for this: the vaadin one can throw JSONException in more places, so we had to either catch them or pass them through to the callers (extend the throws declaration).
Beware that the json.org software has a non-open source license. This causes downstream problems in many cases.
The issue is that the license is essentially the MIT license, but it adds a line that says that the software should only be used for good, not evil. This sounds fine, but if you have to get a corporate lawyer to sign off it gets nasty because there is no consensus legal definition of "evil". If you use json.org's library, you can't put your software into Debian, for instance. Your software likewise can't be a dependency for any Apache project.
To help with this, I have adapted and packaged the android clean-room rewrite of the json.org library. The source is on github and is Apache licensed. See https://github.com/tdunning/open-json. To use this, add something like this to your pom (or equivalent):
<!-- https://mvnrepository.com/artifact/com.tdunning/json -->
<dependency>
<groupId>com.tdunning</groupId>
<artifactId>json</artifactId>
<version>1.3</version>
</dependency>
Ping me with pull requests or issues on github or however you like.
Using the com.tdunnning package can lead to dependency conflicts, especially if you make your project available to others as a library. The implementation does not have 100% compatibility with org.json
That package(com.tdunning) has been forked to https://github.com/openjson/openjson with the package renamed to com.github.openjson instead of org.json to prevent conflicts.
The maven dependency:
<dependency>
<groupId>com.github.openjson</groupId>
<artifactId>openjson</artifactId>
<version>1.0.10</version>
</dependency>