Skip to content

Instantly share code, notes, and snippets.

@bbrowning
Last active December 12, 2015 07:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbrowning/4740889 to your computer and use it in GitHub Desktop.
Save bbrowning/4740889 to your computer and use it in GitHub Desktop.
bbrowning@bbrowning-mbp:~$ curl -I http://localhost:8080/posts/
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: foobar=k5wDvCA2jZvAlwqb2HgFMdsX; Domain=foobar.com; Expires=Fri, 08-Feb-2013 18:17:44 GMT; Path=/baz; Secure; HttpOnly
X-UA-Compatible: IE=Edge
ETag: "903b327bb0b526d7d9b6b4d8344fc56f"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 9cac85c7ee32c524896767ff8ce730ca
X-Runtime: 0.796000
Content-Type: text/html;charset=utf-8
Content-Length: 0
Date: Fri, 08 Feb 2013 18:17:15 GMT
Rails.application.config.session_store :torquebox_store
war_meta_data = TorqueBox::MSC.deployment_unit.get_attachment(org.jboss.as.web.deployment.WarMetaData::ATTACHMENT_KEY)
jboss_web_meta_data = war_meta_data.getMergedJBossWebMetaData
virtual_host = jboss_web_meta_data.virtual_hosts.first || 'default-host'
context_path = jboss_web_meta_data.context_root
service_string = "jboss.web.deployment.#{virtual_host}.#{context_path}"
service_name = org.jboss.msc.service.ServiceName.parse(service_string)
catalina_context = TorqueBox::MSC.get_service(service_name).value
catalina_context.session_timeout = 30 #minutes
cookie_config = catalina_context.session_cookie
cookie_config.name = 'foobar'
cookie_config.domain = 'foobar.com'
cookie_config.path = '/baz'
cookie_config.http_only = true
cookie_config.secure = true
cookie_config.max_age = 3600 # seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment