What is wicket-request module for? - wicket

After some research I decided to use Apache Wicked framework to write my new application. I downloaded the distribution and found there a lot of modules along with a wicket-core. I investigated the list to find out what exactly may I need for my requirements. All is more or less clear except wicked-request. What is it for? Can somebody explain clearer, so I can decide if I really need it?

If you look at the pom.xml of wicket-core, you can see that core has two main intra-project dependencies:
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-util</artifactId>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-request</artifactId>
</dependency>
So wicket-request is an essential module that has just been split from the core to group components dealing with client requests together.

Related

Profile management in Wildfly

The domain.xml file is huge, with large <profile> sections. Each <profile> section has a lot in common.
Is it possible to split it something more modular ? My guess is no because the server has to rewrite the whole domain.xml file at any change, and because I've never read anything about it.
But, I'm still asking the question as it hurts my DRY developer eyes. (Don't Repeat Yourself)
The real answer is you shouldn't edit the raw XML :) The short answer though is no.
It's best to either use the web console or use CLI to manage the profiles. You can use CLI script files as well.

OSGi Karaf Scala UnsupportedAudioFileException

this is my first post here. I'm currently working on a simple http audio servlet in Scala on Apache-Karaf 3.0.0. I'm deploying it as a feature from inside some bundles, which I've built using a maven project. I'm using the 'javax.sound.sampled' library to get the audio, and I'm loading the file from the AudioSystem with 'java.io.File'.
val file = new File("audioFile.wav")
val audioStream = AudioSystem.getAudioInputStream(file)
This is obviously not the actual code, as I've stripped out all of the trivial bits. But this is where it fails, on the 'getAudioInputStream' call.
When I deploy this code to Karaf it fails with 'UnsupportedAudioFileException'. The file does exist, and is readable, I've already validated this. Also, I've made sure that this code can be run under the following.
- Scala 2.10.2, 2.10.3
- Java 1.7.0_45 ( This is the same JRE as my Karaf program is using )
- SBT 0.12.4 ( With the different Scala versions )
The only place this fails is when I deploy it to Karaf. I don't know if Karaf has cut out some random audio support, or what is going on, because this otherwise works when deployed through SBT or using the Scala command line. I've also looked into alternative libraries, but to no avail. Most other solutions seem to be based around actually playing the audio through a sound driver, which is useless to me. I need the actual byte data.
Also, keep in mind that just sending the file over is also useless me. Another requirement is that I need to be able to be able to merge multiple audio files in to one seamless audio stream. I already have this done, I just need to port it to OSGi, and for some reason I am now getting this error. I don't know if Karaf has something to do with it, or if my building it through a Maven project has broken something. I've looked around, and have found very little hint as to where the problem might be.
The audio files I'm using are of Waveform audio. 8,000 sampling rate, 16 bits per sample. I don't think this would actually make a difference, but I'm no expert on audio formats.
My pom.xml dependencies are as follows. The only plugin I'm using is the Scala compiler, and of course my root pom.xml is using the org.apache.felix maven-bundle-plugin. There's really not much magic going on here, yet the mystery remains.
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.3</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
Any clues would be greatly appreciated, thank you.
I think AudioSystem is not fully OSGi ready. This is what I found in the Aries Spy Fly dcoumentation.
Not sure what exactly you have to do to make it work but this might help.
https://aries.apache.org/modules/spi-fly.html
Special Cases
SPI Fly can be used for most SPI provider/lookup systems that use the TCCL pattern to obtain implementations. However in some cases, some special treatment is needed. This special treatment is often needed when the API itself does not match the name of the resources in META-INF/services, java.util.ServiceLoader is such a case, however SPI-Fly has built-in knowledge of ServiceLoader. Known APIs that require special treatment are listed below:
javax.sound.sampled.AudioSystem: This class uses sun.misc.Service under the covers (via com.sun.media.sound.JDK13Services) which is a predecessor to java.util.ServiceLoader. There is no special treatment for sun.misc.Service in SPI Fly (yet), but the AudioSystem.getAudioInputStream() API can be made to work by explicitly listing it in the provider bundle (the one that contains the relevant META-INF/services resources): SPI-Provider: javax.sound.sampled.AudioSystem on the consumer side you can use SPI-Consumer: javax.sound.sampled.AudioSystem#getAudioInputStream
Christian's answer is correct but I wanted to provide an updated link to the spifly documentation page. Specifically:
Java's java.util.ServiceLoader.load(), other similar methods such as
sun.misc.Service.providers() and also other static finder methods such
as the FactoryFinder.find() methods try to locate 'service'
implementations by looking for resources in the META-INF/services
directory of all the jars visible to the Thread Context ClassLoader
(TCCL).
There are a number of issues with the above mechanisms when used in
OSGi:
The Thread Context ClassLoader is not defined in general in an OSGi context. It can and has to be set by the caller and OSGi cannot
generally enforce that.
A bundle can't Import-Package META-INF/services as potentially many bundles will contain this pseudo-package and the OSGi framework
will only bind a single exporter to an importer for a given package.
Instantiating an SPI provider generally requires access to internal implementation classes, by exporting these classes an
implementing bundle would break its encapsulation.
Even if an implementation class was exported, importing this class in a consumer bundle would bind it to the specific implementation
package provided, which violates the principle of loose coupling.
Bundles have a dynamic life-cycle which means that provided services could disappear when a bundle is updated or uninstalled. The
java.util.ServiceLoader API does not provide a mechanism to inform
service consumers of such an event.
The SPI Fly project makes it possible to use existing code that uses
ServiceLoader.load() and similar mechanisms under OSGi.
Please note that as of 2016-05-20 new versions of the com.googlecode.soundlibs artifacts were uploaded to the maven central repository. These new versions of the artifacts are proper OSGi bundles. This will help everyone who needs to use the Java Sound API within an OSGi container
I created a simple example project on github that demonstrates how to play an MP3 file inside an OSGi container using the Java Sound API. Checkout the branch static-weaving and dynamic-weaving to see the respective solutions.

Eclipse m2e content assist in POM not working past top level elements

I can't seem to get Eclipse to pick up any content past the top level configuration elements.
For example:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.7</version>
<configuration>
<container> <-- Content Assist
... <-- No Content Assist
</container>
<deployables> <-- Content Assist
... <-- No Content Assist
</deployables>
Maybe I'm insane, but I know this has worked in the past.
I have full indexing enabled, and I've rebuilt my repository indexes.
Is this a limitation of the plugin's implementation, or is it environmental?
Currently M2Eclipse gets autocompletion hints for a specific Mojo in a plugin from that plugin's embedded plugin.xml descriptor. The descriptor provides the instructions to Maven about how to populate the fields in a Mojo from the XML configuration. The work to do this is performed by internally by reflection so we don't capture anymore detail in the plugin.xml which is why there is no autocomplete information beyond the first level: the first level corresponds to the field level in the Mojo. We don't have any sub-type information currently.
We realize this is a limitation in M2eclipse and Anton Tanasenko (one of the M2Eclipse committers) is working on some editor improvements and we hope to provide an autocomplete mechanism that will be able to inspect the parameter types and provide better information.
We have now added full support for plugin configuration content assist in M2Eclipse with:
https://github.com/eclipse/m2e-core/commit/e84152165805547b1fad2dbc775da711bd169383
Anton finished this work today and we plan to have this out in the next milestone release for people to try.

Problems with GWT 2.4

I compiled the version in svn tagged as gwt2.4rc. Now there are a
couple of more libraries than I had the last time. Are the any
instructions on which library is needed for what? I tried it with only
the standard libraries (servlet, servlet-deps, user) but I get the
following error when a requestfactory call is made:
java.lang.NoSuchMethodError:
com.google.gwt.core.client.impl.WeakMapping.setWeak(Ljava/lang/
Object;Ljava/lang/String;Ljava/lang/Object;)
I tried declaring the requestfactory-client and requestfactory-server
jars as dependencies, but i doesn't help. I am using maven to manage
my dependencies.
I would go back to 2.4 beta, but I need the drag&drop features that
were introduced later.
Does anybody has an idea what could be wrong? or any hints how i can
dig deeper into this? I spend a lot of time trying to figure this out
but without any success :(
Do I need to provide more information?
Regards,
arne
Are you sure you deployed the 2.4-rc1 gwt-servlet.jar in your war/WEB-INF/lib ? Also, make sure you override the SDK for the gwt-maven-plugin: http://mojo.codehaus.org/gwt-maven-plugin/user-guide/using-different-gwt-sdk-version.html
That being said:
when using Maven, you shouldn't use gwt-servlet-deps but instead reference org.json:json and javax.validation:validation-api
requestfactory-server can be used instead of gwt-servlet if you only use RequestFactory on the server-side (no GWT-RPC, no SafeHtml, no RegExp, etc.); requestfactory-client is to be used for Java clients (such as Android), not the case here.

GWT gilead problem

I am getting lots of difficulty in integrating gilead in gwt. Can
someone please send the jars they have successfully used that works
because the one I have downloaded does not work
Please someone help me with this gilead and GWT, it makes one full day that i
trying to integrate gilead into gwt with no success!!!
Thanks
What problems are you having?
I'm using hibernate4gwt
<dependency>
<groupId>net.sf.hibernate4gwt</groupId>
<artifactId>hibernate4gwt</artifactId>
<version>1.1.1</version>
</dependency>