I thought I might just start with an introduction first. :)
The basic principal behind Free Electron Laser is that of synchrotron radiation. When electrons or charged particles are made to change momentum (like being bent in a in an arc where the force is radially inwards) they emit electromagnetic radiation.
If the particles are relativistic then the electromagnetic radiation the lab observer relative to the electron will observe the electromagnetic radiation being emitted in a cone in the direction of motion. (i'll post figures if people really want!)
In the case of the free electron laser you need to have magnetic arrays which are simply dipole magnets aligned such that the electrons will see as its travelling in a straight line, alternating vertical magnetic fields. This causes the electrons to "undulate" horizontally. With relativistic electrons (which is not hard to do) you will emit synchrotron radiation like a pencil beam. The wavelength from an undulator is given by lambda = undulator_period/(2gamma^2)*(1+a^2/2), where gamma is the relativistic gamma factor, a = e*B*undulator_period/(2*pi*electronmass*speedlight) where B is the strength of the magnetic field and e the electric charge. But the radiation from all the electrons are not very temporally coherent!
Now as to why its called a laser! The fundamental feature of why lasers are powerful is because the waves emitted by all sources are emitted in a temporally coherent fashion. I.e. all the electric fields add constructively so the total power scales like pN^2 where p is the power emitted by a single source and N is the number of sources.
In a FEL the undulation is small enough that the electrons are irradiated by its own synchrotron radiation and is therefore travelling in an optical field as well as the magnetic field from the dipole magnets. The optical field causes the electrons to micro-bunch and cause further amplification of that particular wavelength (micro-bunching effect) and is referred to as self-amplified spontaneous emission (SASE). This positive feedback generates powers that give an additional gain of N. Typical bunches of electrons are 10^11 electrons, so you can get orders of magnitude more power.
I presume you can reduce the size of the magnetic arrays to just a stretch of material with carefully oriented domains however it will be difficult to reach the fields required. To measure thats the field of spectroscopy which i'm less familiar. For UV you'll have to have some material with dispersion properties like a prism of sorts and a detector that will respond to UV radiation. For x-rays you can use monochromators that use the Bragg principal and determine the energy (calibrated to know emission lines from elements).
The energy loss along the undulator is a small factor. The emitted photons are very small fractions of its total energy. For example for 10 to 100 nm wavelengths you would need something like 300 MeV electrons (rest mass of an electron is 0.5 MeV) so beta = 0.9999986, and 10 nm photons are only 10s of eV.
I thought the military were focusing on UV FELs like you said, to reduce water absorption. Xrays are much harder to generate with enough power to cause damage.
That was more than i initially intended to say. Hope its useful.