You got a problem there...put the phone in a zip-lock bag with dry white rice. Leave it there for a few days. Do not attempt to turn your phone on. Coffee is very acidic and, unfortunately, there is no way to predict what damage has/will be done. Apple does however have an out of warranty replacement program, cost in the US is $199. Normally, I would completely disassemble and soak for a day in distilled water, then dry all of the components. However, this is not feasible for most users and on the iPhone 4, the glass & digitizer are glued together.
Message was edited by: wjosten