Example on how to use curl to access a page that requires a login from a different page.
Look at the content of the login page to get the form action:
<form action="j_security_check" method="post">
User Name:
<input type="text" name="j_username" size="35">
User Password:
<input type="password" name="j_password" size="10">
<input type="submit" value="login">
</form>
Create a cookie for storing sessions:
$ curl -b /tmp/cookies.txt -c /tmp/cookies.txt http://localhost:8080/myapp
Send user name and password to the form:
$ curl -b /tmp/cookies.txt -c /tmp/cookies.txt -d "j_username=user&j_password=password" $ http://localhost:8080/myapp/j_security_check
Get the content of the page using the session stored in the cookie:
$ curl -b /tmp/cookies.txt -c /tmp/cookies.txt http://localhost:8080/myapp