Break out appid/spaceid parsing for reuse.

Signed-off-by: Mike Gehard <mgehard@pivotallabs.com>