Fetching media by urls



I would like to retrieve media inside statuses, but as I could read in the docs:

For media in direct messages, media_url_https must be accessed via an authenticated twitter.com session or by signing a request with the user’s access token using OAuth 1.0A. It is not possible to directly embed these images in a web page.

Now my question is, how to do that kind of request using Java API? or however what is the correct request with RestAPI, using App only auth?

another question: what is the difference for media in direct messages and media shared in Tweets? how can I see the difference inside json object representing a status?