trouble reconciling doppler shift for energy and momentum of light [See final additions at bottom for a restatement of the paradox.]
I have seen the assertion in a couple of places that if you trap light in a reflective resonator, or any other kind of sealed trap, then (as another user here put it in answering a different question) by "calculating the Doppler shift at either end and then finding the difference between the red and blue photon momentums", one can show that it's equivalent to "the same mass $m$... that defines how it responds to force".  The net momentum of the light will match that of an equivalent mass moving at the speed of the resonator, the net energy will match the relativistic total energy of that mass at that speed, and the net force when accelerated will match the inertia of that mass, all due to Doppler shifts.
I have been trying to do this calculation, getting the doppler-shifted frequencies and then finding the change of energy and momentum that results from viewing it in another reference frame, to show that they are the same as the energy and momentum of an equivalent rest mass with the velocity of the enclosing resonator.  But I can't do it -- the results keep coming out wrong.
As I understand it, you calculate doppler shifts with a factor of $\sqrt{\frac{1-\beta}{1+\beta}}$ where $\beta$ is the fraction of lightspeed by which the frames differ in velocity. I'll call that $R$.  It can also be expressed as $\gamma(1-\beta)$, where $\gamma$ is the Lorentz factor $1/\sqrt{1-\beta^2}$.  If I have things understood correctly, when a light source is receding then the light you observe from it has its wavelength divided by $R$ and its frequency multiplied by $R$.  But if light hits a moving mirror, the factor needs to be applied twice: the outgoing light gets shifted by $R^2$.
So I modeled a simple resonator, or laser, and looked at a small sample of light in it, which might be one photon.  In its rest frame the laser has length $d$, and the light sample has frequency $f$, wavelength $\lambda$, and energy $E$.  So when moving the forward-going light will have frequency $f/R$ and wavelength $\lambda R$, and vice versa for the reverse-moving light.  And energy is proportional to frequency. And I thought, if we average the forward momentum with the backward momentum we should get the total, and likewise for energy.  This led me to a pair of naive first-approximation formulas: for momentum, $\frac{1}{2}(\frac{1}{R} – R)E∕c$, and for energy, $\frac{1}{2}(\frac{1}{R} + R)E$.  For a numeric example, consider $\beta=\frac{1}{2}$: in this case $R=\sqrt{\frac{1}{3}}$, and the blue-shifted forward light has three times the frequency of the red-shifted backward light.  The resulting energy is $1.1547E$ and the momentum is $0.57735E/c$, which are correct.  Then I did some algebra and verified that this momentum formula is indeed equivalent to $\gamma\beta E/c$ and the energy formula is equivalent to $\gamma E$.  Problem solved, right?
Not so fast.  I then noticed a problem.  I'd been doing a simple average of forward and backward globs of light, giving them equal weight.  But the light isn't weighted equally!  It spends more time going forward than going backward.  In the $\beta=\frac{1}{2}$ case, it spends three fourths of its time going forward and one fourth going backward.  This means that at any given time, three fourths of the photons in the laser are going forward, and have blue-shifted energy rather than red-shifted energy.
Here, I made a spacetime diagram of it:

Another way to look at it is that if the Doppler shift increases frequency by $R$, it increases power by $R^2$. The rate of photon reception per second goes up, as well as the energy in each photon.  No matter how I look at it, I have to conclude that in this case, there is nine times as much energy and momentum in the forward-moving light as in the backward-moving light: three times as many photons with three times as much oomph apiece.
But this produces a completely wrong result when I try to compare the resulting mass or energy to what it should be.  Like, instead of $1.1547E$ for the energy, I get $1.443E$.  I got this by weighting the forward light by $(1+\beta)$ and the backward light by $(1-\beta)$ before averaging.  And that is way too much, apparently violating conservation of energy.
Where have I gone wrong in my understanding?

Update: In an earlier update which I've deleted, I said that I thought I was getting to an answer.  I was wrong.  I fooled myself and didn't notice I was subtly slipping back into the rest frame of reference.
During the time I thought my new approach was working, I made a new spacetime diagram, showing a more continuously operating resonator, which at some given time opens both its mirrors, dumping half of the light out of each end:

This diagram confirms that at speed $\frac{1}{2}c$, photons or wavefronts moving to the right are three times as frequent in both space and time as those going to the left.  (Though if you measure along the rest-frame diagonals everything is even.)  This difference in photons per second is enough to completely account for all of the expected change of net energy in the system, without leaving any room for each photon to also have differing energy due to its changed frequency.
While I was at it, I recast some of my equations using momentary energy in terms of continuous power.  In these, the light's "mass" is $2Pd/c^3$, where $P$ is the power in one direction in the rest frame.  There were no surprises and it left the question unchanged.  The boosted state still has too much energy relative to the resting state.

Later update, ignoring the mirrors: I tried to clarify exactly how the energy would change with frame of reference, and ended up kind of ignoring the mirrors and looking at two opposing beams of light, which have equal frequencies and power in the rest frame.  How much energy does each beam have within a window of length $d$?  The energy is $hfk$ where $h$ is Planck's constant and $k$ is the count of photons.  How does that transform when the window moves at speed $\beta$?  I believe $d_\beta=d_0/ \gamma$, $f_\beta=f_0/R$, and $k_\beta=k_0(1+\beta)=k_0/\gamma R$.  More photons fit in the window when blue-shifted (photon density changes with frequency), but the narrowing of the window cuts that down a bit.  So $E_\beta=E_0(1+\beta)/R = E_0\gamma(1+\beta)^2$.  You would then apply a boost of $-\beta$ to the opposing beam.  Note that the total photon count is still $2k_0$.  The total energy is $E_\beta+E_{-\beta}$, and that's supposed to add up to $2\gamma E_0$ (the energy that an equivalent mass would have at that speed), but it doesn't.  [Edit: it adds up to $2\gamma(1+\beta^2)E_0$, just as in udrv's answer.]
Similarly, the momentum in each direction would be $p_\beta=E_0(1+\beta)/Rc$, and the total would be $p_\beta-p_{-\beta}$.  That's supposed to add up to $2\beta\gamma E_0/c$.  It doesn't.

Summation, after udrv's answer: We now have a total of five different mathematical approaches, from my first try which took a weighted average of a small sample of light over time, to udrv's final approach using a segment of spacetime shaped like a hyperwedge.  I believe all five ended up producing the same answer.  They all say that the energy of the system in a moving observer's frame is greater than the energy of the bare photons in the rest frame by a factor of $\gamma(1+\beta^2)$, when I would expect the change to be a factor of $\gamma$ only.  So it's pretty clear that the answer to this question is not to fix the math.  No matter how you come at it, the math is coming out consistent.
So the question now is, how can this make sense physically?  Where can that much energy come from?  How can it be reconciled with the apparent fact that if we were boosting massive particles instead of light, the resulting energy would be smaller?
I end up imagining the following scenario.  Let's say you have a reservoir of cold electrons and positrons, and when you release them, you convert them into gamma rays which then get trapped in the resonator.  (Yeah, I know this is a stretch.)  If you convert them in the rest frame, the energy of the resulting photons equals the energy of the particles' mass.  If you first boost the particles into a moving frame, their mass-energy goes up by a factor of $\gamma$, and if you then convert them into photons, the energy must be the same.  But if you convert them into photons in the rest frame and then switch to a moving view of those photons while they're in the resonator, this finding seems to say that you end up with more total energy than you do if you convert already boosted particles.  This is a paradox.
How do we resolve this?  How can we either show that these boosted energies which appear to be different are really the same, or show that energies which appear the same in the rest frame are actually different, or show that it's somehow not contradictory for the two to have conflicting results?

Udrv's second answer (the one with the +100 bounty awarded) points out that the issue doesn't just apply to light, but to trapped massy particles as well.  This is true.  If I model massy particles trapped between things that bounce them back into the enclosed volume, or equivalently if I examine an arbitrary volume into which streams of massy particles flow from opposite directions (the former may be imagined as a string on two pulleys, and the latter as two rods passing through an open-ended box), then I get the same paradox.  The forward-moving mass contains more particles and spends more time in transit than the backward-moving mass does, to a degree that increases with the relative speed between the forward and backward masses, apparently becoming lightlike at the limit.  This paradox goes away if you imagine two masses that stay entirely enclosed in the volume and duration under examination, so that the forward and backward groups have the same number of particles.
The two scenarios (reflector vs selecting a window from a larger set of passing particles) can be seen as equivalent when viewed in terms of flux at the boundaries.  Each end has an equal number of particles passing inward and outward at that surface, but not an equal amount of energy except in the rest frame.
ANYWAY, where it stands now, it sounds like the original idea -- that light trapped in a resonator is externally equivalent to mass of equal energy -- must be false.  Is that what people are concluding?

I am going to try to frame the paradox one last time, in terms which are as clear and unambiguous as possible.  The physical situation depicted in the thought experiment is quite implausible in practical terms, but setting it up this way is beneficial, from my point of view, for the absence of potential distractions.
The thought experiment in question is the one I mentioned earlier, where we annihilate electron-positron pairs inside a resonator.  The setup is as follows: we have $n$ electrons and $n$ positrons, which have an arbitrarily small velocity relative to each other.  At some time, they start to collide and annihilate in pairs.  The annihilation occurs at a steady rate for a finite time $\Delta t$.  By an amazing coincidence, all of the annihilations produce photons that happen to be directed parallel to some given x axis, half of them going each way along it.  The result is two beams emitted in opposite directions, each having steady power while it lasts (to some arbitrary degree of precision), and then ceasing simultaneously.
If we observe this experiment from the rest frame of the particles, each electron and positron has a mass of 0.5110 MeV, and each emitted photon has that same energy.  The total energy in the system never changes.
Now we repeat the experiment, except this time it happens between a pair of perfectly reflective gamma-ray mirrors.  Once again, everything coincidentally lines up on the x axis.  The distance between the mirrors is exactly $c\Delta t$, which means that the reflected photons from the first annihilations reach the center just as the last annihilations are finishing up.  The result is that photons are shuttling continuously in both directions with no gaps.  The numbers and energies of the photons are exactly as they were without the mirrors -- they're just confined to a smaller volume.  The total energy again does not change.
Now let us watch these two experiments from a viewpoint boosted to a speed of ½$c$ along the x axis.  First, without mirrors.  Before annihilation, each electron and positron now has its apparent mass increased by a factor of $\sqrt{4/3}$, so they now weigh 0.59005 MeV.  After annihilation, we have two groups of $n$ photons, one being blueshifted by a factor of $\sqrt{3}$ and the other redshifted by $\sqrt{⅓}$, resulting in energies of 0.8851 and 0.2950 MeV, which adds up to 2 × 0.59005.  Again the total does not change.
But how does it look to the ½$c$ observer with the mirrors in place?  After the annihilation is complete, we have $2n$ photons, but instead of being split fifty-fifty between red and blue frequencies, we've got $1.5n$ blue photons and only $0.5n$ red ones.  All of the math we've thrown at this agrees that with the mirrors in place, the total energy of the system is now no longer 1.1801 MeV per pair, it's now 1.4752 MeV per pair.  The average over time per photon says the excess is there, the stress tensor integration says it's there, the spacetime wedgie says it's there, the half-volume pressure balance says it's there... (for details, see entire rest of thread.)
BUT THIS ADDITIONAL ENERGY CANNOT EXIST.  There is no source for it.  It comes from nowhere, and if you open both ends of the resonator simultaneously in proper time to let the photons out, it vanishes into nowhere, reverting to what we saw in the mirrorless case.  Why does our math keep saying it's there?  It cannot be real actual energy, it is clearly illusory in some sense.  So why do we see more than is actually there?
 A: Since there seem to be no other attempts so far, I'll take a final stab, in the context of the particle annihilation problem.  
Short answer: As already suggested in several comments and one other answer, the paradox resolves itself when we take into account the restoring forces against the gas, either from the resonator walls or, if we dismiss the resonator, from gas outside the physical volume considered. 
But we do not need to invoke work under acceleration of any frame to do the accounting.
Details:
Before anything else, let us look at all this from the point of view of relativistic kinetics (gases). In the current formulation the particle gas before annihilation is basically a "dust" in which all particles are at rest in the resonator rest frame. Unlike the photon gas that it produces, the "dust" has null pressure and its energy and momentum densities transform under boosts as those of individual particles, or 4-vectors. The photon gas, on the other hand, necessarily displays a nonzero pressure which does contribute nontrivially to the stress-energy tensor in the resonator frame, and therefore modifies the way the energy and momentum densities transform under boosts, now as components of the stress-energy tensor. 
Suppose however that we upgrade the initial particle gas from a pressure-less "dust" to an ideal collision-less gas. The essential difference between a gas and a "dust" is that the gas has an intrinsic nonzero pressure $\Pi$ (I assume isotropy for simplicity), while the "dust" is pressure-less, $\Pi=0$. The presence of the pressure in a gas means that the energy and momentum densities become again mere components of the stress-energy tensor and transform accordingly under boosts. Then the gas pressure contributes "naturally" to the boosted energy and momentum, and it does so exactly in the same manner that radiation pressure contributes to the boosted energy and momentum of the photon gas. Considering only time and the boost coordinate, this means 
$$
T_0^{\mu\nu} = \left(\begin{array}{cc}\rho c^2 & 0 \\0 & \Pi \end{array}\right) \;\; \rightarrow T^{\mu\nu} = \Lambda^\mu_{\;\;\alpha} \Lambda^\nu_{\;\;\beta} T_0^{\mu\nu} = \left(\begin{array}{cc}\gamma^2(\rho c^2 + \beta^2 \Pi) & \gamma^2\beta(\rho c^2 + \Pi) \\\gamma^2\beta(\rho c^2 + \Pi) & \gamma^2(\Pi + \beta\rho c^2 )\end{array}\right)
$$ 
where $\rho$ is the gas mass density in its rest frame. Now we have the stress-energy densities for both the particle gas and the photon gas on the same footing.
Does this solve the paradox? Well, yes, and it also makes it easier to pinpoint the "spurious" energy-momentum source. 
For the case with a resonator:
Statement: If we assume everything enclosed in a physical resonator, then the total energy-momentum of entire system, gas + resonator, transforms as a 4-vector and is conserved in the regular sense. This means:
1) The total energy-momentum of the resonator plus the initial particle gas is conserved under boosts.
2) The total energy-momentum of the resonator plus photon gas is also conserved under boosts.
3) As seen from any one frame, the energy-momentum of the resonator plus particle gas is conserved when the particles annihilate into photon gas. Any differences between the stress-energy densities of the particle gas and the those of the photon gas are automatically compensated by a redistribution of stresses within the walls of the resonator.
Proof: In all three cases, pressure contributions from the gas are exactly counteracted by corresponding stresses in the container walls. To see this let us follow an idea from Tolman's old volume on "Relativity, Thermodynamics, and Cosmology". Consider a plane surface $S_1$ that slices through the gas and container perpendicular to the direction of motion, but is closed by another arbitrary surface $S_2$ that lies completely outside the container. This can be done equally well in the resonator rest frame or in a boosted frame. In a boosted frame take $S_1$ and $S_2$ to be co-moving with the resonator. 

Now consider energy-momentum conservation in the 3D-volume enclosed by $S_1 \cup S_2$. Since we have a static system and the energy-momentum content does not change in time, the corresponding total fluxes through $S_1 \cup S_2$ must be null. But this implies that the gas stresses (pressures) plus the container wall stresses integrated on $S_1$ must be null too, because $S_2$ is outside the system and cannot contribute. 
The null stress integrals on the otherwise arbitrary $S_1$ mean in turn null volume integrals for the local stresses of the gas plus container system. Again, this holds both in the container rest frame and in any boosted frame. In a boosted frame it further means that 
$$
\int_{\text{boosted resonator}}{dx \;\gamma^2(\rho_{\text{total}} c^2 + \beta^2 \Pi_{\text{total}})} = \int_{\text{boosted resonator}}{dx \;\gamma^2\rho_{\text{total}} c^2} =  
$$
$$
\int_{\text{rest resonator}}{\frac{dx_0}{\gamma}\; \gamma^2\rho_{\text{total}} c^2} = \gamma \int_{\text{rest resonator}}{dx_0 \;\rho_{\text{total}} c^2}
$$
and similarly for total momentum, which is what we hope to see. Here $\rho_{\text{total}}$ and $\Pi_{\text{total}}$ are extended to denote gas mass density and pressure at points within the gas, and wall mass density and pressure within the walls, whereas 
$$
\int_{\text{boosted resonator}}{dx \;\Pi_{\text{total}} } = \left(\int_{\text{boosted gas}}{dx \;\Pi_{\text{gas}} } \right) + \left(\int_{\text{boosted resonator walls}}{dx \;\Pi_{\text{resonator walls}} }\right) = 0 
$$ 
Note that the argument makes explicit use of the particle gas view. The same holds for the "dust", but the gas enables a smooth generalization to the photon case.
Alternatively, we can apply the 4-volume version of the conservation law as in Update 2 of my previous answer and find that at any point in time stresses in the resonator wall render null the gas contribution on the time-like surface $S_{RO}$.
In any case, the bottom line is that for the total energy $E$ and total momentum $P$ we have the usual relativistic conservation,
$$
\left[ (E_\text{resonator + particle gas})^2 - (P_\text{resonator + particle gas})^2\right] \Big|_{\text{rest frame} } = 
$$
$$
\left[ (E_\text{resonator + particle gas})^2 - (P_\text{resonator + particle gas})^2\right] \Big|_{\text{boosted frame} } = 
$$
$$
\left[ (E_\text{resonator + photon gas})^2 - (P_\text{resonator + photon gas})^2\right] \Big|_{\text{rest frame} } = 
$$
$$
\left[ (E_\text{resonator + photon gas})^2 - (P_\text{resonator + photon gas})^2\right] \Big|_{\text{boosted frame} }
$$
provided stress redistribution within the resonator is properly accounted for.  
For the case without a resonator:
If we dismiss the resonator entirely and look at just a 3D-volume of gas by itself, then the gas remains within the volume because of particle or photon fluxes through its boundaries. As for an ideal gas, the fluxes carry momentum and are equivalent to boundary pressures or stresses. 
This is because the continuity equations hold as always, but any $S_1$ surface as defined previously must be closed by an $S_2$ that at least partially intersects the gas again outside the considered volume. If we take $S_2$ to slice the gas just outside the boundary of the volume considered, it will pick up pressure from gas in the rest of space as a restoring force against the pressure inside. The same reasoning as for the resonator case applies again, but now the compensating stresses are provided by particle and/or photon fluxes through the boundary surface. 
In the 4-volume version the boundary terms are again exactly compensated by outside pressure. 
So the same conclusion holds, provided we account properly for boundary fluxes/stresses around the considered volume:
$$
\left[ (E_\text{particle gas + boundary counterpressure})^2 - (P_\text{particle gas + boundary counterpressure})^2\right]\Big|_{\text{rest frame} }  = 
$$
$$
\left[ (E_\text{particle gas + boundary counterpressure})^2 - (P_\text{particle gas + boundary counterpressure})^2\right] \Big|_{\text{boosted frame} }  = 
$$
$$
\left[ (E_\text{photon gas + boundary counterpressure})^2 - (P_\text{photon gas + boundary counterpressure})^2\right] \Big|_{\text{rest frame} }  = 
$$
$$
\left[ (E_\text{photon gas + boundary counterpressure})^2 - (P_\text{photon gas + boundary counterpressure})^2\right]  \Big|_{\text{boosted frame} } 
$$
Why pressure contributes to total gas energy-momentum:
What is left at this point is to understand why gas pressure contributes to overall gas inertia, even in the case of a photon gas. Which is where lies another advantage of considering a particle gas instead of a "dust". 
Let us look at the gas stress-energy tensor in the rest frame again:
$$
T_0^{\mu\nu} = \left(\begin{array}{cc}\rho c^2 & 0 \\0 & \Pi \end{array}\right)
$$
If we integrate $T_0^{00} = \rho c^2 $ over the gas volume we obviously get the total mass of the gas. In a boosted frame there would also be momentum densities $T_0^{01} = T_0^{10}$, and integrating those would give the total momentum. But what do we get when integrating $T_0^{11} =  \Pi$? 
Assuming uniform pressure and a volume $V$, we get $PV$, which is just the internal energy of the gas, due to the kinetic energy of its particles. And in a relativistic gas, internal energy does contribute to the stress-energy transformation under boosts (see these Lecture Notes for a derivation of the gas stress-energy tensor from relativistic particle kinetics). 
Similarly, radiation pressure corresponds to the internal energy of the photon gas, and as such must again contribute to photon gas energy and momentum under boosts. 
As an aside, this is the same internal energy of the photon gas that is considered in deriving the thermodynamic equation of state in the context of blackbody radiation. The confusing thing is that it is not usually brought up for resonators, although radiation pressure has long been used to set up atomic traps and optical tweezers, to manipulate atomic beams, etc. 
Conversely, we can now use Paul's photon counting to link boosted energy and radiation pressure to Doppler shift :D
A: I got lost in this discussion a while ago and cann't really follow @udvr's answer (not because I think it's wrong, rather because I don't have time to study it properly :( ). So this is probably not an answer, but got a bit too long for a comment.
I understand that the following is still a question that has not been resolved yet (from the question v23):

I end up imagining the following scenario.  Let's say you have a reservoir of cold electrons and positrons, and when you release them, you convert them into gamma rays which then get trapped in the resonator.  (Yeah, I know this is a stretch.)  If you convert them in the rest frame, the energy of the resulting photons equals the energy of the particles' mass.  If you first boost the particles into a moving frame, their mass-energy goes up by a factor of $\gamma$, and if you then convert them into photons, the energy must be the same.  But if you convert them into photons in the rest frame and then boost the photons while they're in the resonator, this finding seems to say that you end up with more total energy than you do if you convert already boosted particles.  This is a paradox.

I think there are 2 separate physical processes here:
Situation 1: Looking at a massive particle-photon conversion in two different frames.
In the rest frame of the resonator the situation is clear: the particles just sit at rest and split into photons which then will have the particles' mass-energy. In a moving frame the whole process is also clear (looking at one massive particle that splits into two oppositely directed photons along the movement direction of the resonator, for simplicity): one photon gets fired in one direction, the other with a different momentum in the other direction. Together they have energy $\gamma m c^2$. This is all consistent.
Situation 2: Physically accelerating („boosting“) the resonator.
As far as I can tell this is the situation that has been considered in the question and in @udvr's answer. And in this case it is not surprising that the two situations are different. Accelerating a photon gas requires you to do more work precisely because of the pressure. The energy difference hence comes from the physical acceleration process being different.
Like I said, nowhere near to an answer, but I hope this sheds some light and is not just complete non-sense (if it is please do say).
A: This problem is equivalent to Einstein's original thought experiment with the center of mass of a tubular spacecraft in an inertial reference frame emitting a photon from one end and reabsorbing it at the opposite end.   This is the same thought experiment convinced an audience of Newtonian physicists that E=mc^2 by arguments related to center of mass.
Whether the photon is absorbed or trapped within a resonating chamber (such as a laser cavity), and regardless of its direction of propagation, the photon has momentum (but exclusively in its direction of linear propagation) all by itself.  In order for the photon to have "real" inertia in more than one direction, that photon energy needs to be 'bound'.
The only reason a resonant chamber works to give a reflected photon inertia in a direction different from the one it is initially propagating is because the photon energy is alternately absorbed and re-emitted from the electrons internal to a system of reflective surfaces which share the inertia of the resonant cavity with the reflected photons.
To answer the question:
Any Doppler shift observed is relative to the state of motion of an observer.  In this case, the observer also shares the inertia of the rest frame of the resonant cavity.  Despite Wheeler's popular upgrade to Einstein's original thought experiment based on the same static geometry first abused by Minkowski, the state of relative motion of the cavity may be oriented in any direction and the photons still share the inertia of the lab frame at rest with respect to the entire cavity.  In the laboratory frame, the cavity is at rest and there is no Doppler shift observed there, at either end that is a result of the reflection of the photons. Or to put it another way, the reflected photons appear to be the same frequency after reflection as they were before being reflected. To observe any Doppler shift of the photons inside of the cavity, the observer would need to be moving with respect to it.
