A new mathematical and computational technique for calculating quantum vacuum expectation values of energy and momentum densities associated with electromagnetic fields in bounded domains containing inhomogeneous media is discussed. This technique is illustrated by calculating the mode contributions to the difference in the vacuum force expectation between opposite ends of an inhomogeneous dielectric non-dispersive medium confined to a perfectly conducting rigid box.