How is a qubit realized in a cavity?

Considering a single photon in a cavity, how is a qubit realized in this setup? How is the qubit $|0\rangle$ or $|1\rangle$ manipulated? I.e. how are the transitions $|0\rangle \to |1\rangle$ and $|1\rangle \to |0\rangle$ achieved in a controlled manner?

-
One must be careful, because the states $|0\rangle$ and $|1\rangle$ can mean quite different things in different settings - zero or one photons in some cavity mode, for example, but also horizontally vs vertically polarized single photon, and a host of others. Do you have some specific example in mind? – Emilio Pisanty Oct 25 '12 at 22:49
I do not mean |n> to stand for a n photon state, but rather n=0,1, where we are just talking about an abstract qubit state that is to be realized by a single photon in a cavity. My question is how. What physical states of the photon correspond to |0> and |1> and how are they controlled? – Simon Oct 26 '12 at 7:25
This does not have a unique answer. There are multiple realizations of qubits in cavity QED, each with their advantages and disadvantages, and they each have different applications. Number states are one major possibility, as are polarization states or spatial encoding, but there are others. – Emilio Pisanty Oct 26 '12 at 14:42
A single photon in a cavity is a specific physical state, namely the "1" eigenvector of the number operator $a^\dagger a$. Also harmonic oscillators make terrible qubits by themselves. Usually you couple them to an anharmonic or approximately 2-level system as in the Jaynes-Cummings model described by Vasek below. – Phil Reinhold Oct 26 '12 at 17:50

Using a two-state atom dropped or conveyed through the cavity with a precisely controlled speed such that the Rabi oscillation (atom in $|g\rangle$, cavity mode in $|1\rangle$ $\leftrightarrow$ atom in $|e\rangle$, cavity mode in $|0\rangle$) makes just one $\pi$-rotation.