{"action":"created","comment":{"url":"https://api.github.com/repos/pedestal/pedestal/pulls/comments/196718533","pull_request_review_id":130322685,"id":196718533,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjcxODUzMw==","diff_hunk":"@@ -147,13 +147,16 @@\n          port :port\n          {:keys [ssl? ssl-port\n                  h2? h2c? connection-factory-fns\n-                 context-configurator configurator max-threads daemon? reuse-addr?]\n+                 context-configurator context-path configurator max-threads daemon? reuse-addr?]\n           :or {configurator identity\n+               context-path \"/\"\n                max-threads (max 50 (needed-pool-size))\n                h2c? true\n                reuse-addr? true}} :container-options} options\n         thread-pool (QueuedThreadPool. ^Integer max-threads)\n         server (Server. thread-pool)\n+        _ (when-not (clojure.string/starts-with? context-path \"/\")","path":"jetty/src/io/pedestal/http/jetty.clj","position":13,"original_position":13,"commit_id":"1d9083421cb8fa407d2093212e048e8420009c29","original_commit_id":"1d9083421cb8fa407d2093212e048e8420009c29","user":{"login":"ohpauleez","id":153929,"node_id":"MDQ6VXNlcjE1MzkyOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/153929?v=4","gravatar_id":"","url":"https://api.github.com/users/ohpauleez","html_url":"https://github.com/ohpauleez","followers_url":"https://api.github.com/users/ohpauleez/followers","following_url":"https://api.github.com/users/ohpauleez/following{/other_user}","gists_url":"https://api.github.com/users/ohpauleez/gists{/gist_id}","starred_url":"https://api.github.com/users/ohpauleez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohpauleez/subscriptions","organizations_url":"https://api.github.com/users/ohpauleez/orgs","repos_url":"https://api.github.com/users/ohpauleez/repos","events_url":"https://api.github.com/users/ohpauleez/events{/privacy}","received_events_url":"https://api.github.com/users/ohpauleez/received_events","type":"User","site_admin":false},"body":"I'm going to add a `:require` for clojure.string in another branch, even though it's technically not needed.","created_at":"2018-06-20T10:04:32Z","updated_at":"2018-06-20T10:07:56Z","html_url":"https://github.com/pedestal/pedestal/pull/579#discussion_r196718533","pull_request_url":"https://api.github.com/repos/pedestal/pedestal/pulls/579","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pedestal/pedestal/pulls/comments/196718533"},"html":{"href":"https://github.com/pedestal/pedestal/pull/579#discussion_r196718533"},"pull_request":{"href":"https://api.github.com/repos/pedestal/pedestal/pulls/579"}}},"pull_request":{"url":"https://api.github.com/repos/pedestal/pedestal/pulls/579","id":195800282,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1ODAwMjgy","html_url":"https://github.com/pedestal/pedestal/pull/579","diff_url":"https://github.com/pedestal/pedestal/pull/579.diff","patch_url":"https://github.com/pedestal/pedestal/pull/579.patch","issue_url":"https://api.github.com/repos/pedestal/pedestal/issues/579","number":579,"state":"open","locked":false,"title":"Support Jetty context-path in container-options and url-for","user":{"login":"terjesb","id":6209,"node_id":"MDQ6VXNlcjYyMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/6209?v=4","gravatar_id":"","url":"https://api.github.com/users/terjesb","html_url":"https://github.com/terjesb","followers_url":"https://api.github.com/users/terjesb/followers","following_url":"https://api.github.com/users/terjesb/following{/other_user}","gists_url":"https://api.github.com/users/terjesb/gists{/gist_id}","starred_url":"https://api.github.com/users/terjesb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terjesb/subscriptions","organizations_url":"https://api.github.com/users/terjesb/orgs","repos_url":"https://api.github.com/users/terjesb/repos","events_url":"https://api.github.com/users/terjesb/events{/privacy}","received_events_url":"https://api.github.com/users/terjesb/received_events","type":"User","site_admin":false},"body":"Proposed patch for issue #578.\r\n\r\nIn route.clj, I think maybe the (concat context-path-parts path-parts) could replace that cond.\r\n\r\n# Description\r\n\r\nI've been looking into migrating some Pedestal services from WildFly/Immutant to standalone Jetty. When run under WildFly, the deployment gets its context path from the container. When deploying the same route table to Jetty, it's now in the root context. This makes it inconvenient to target both containers during a transition. There may also be other use-cases for deploying the same app to Jetty under multiple/different context paths. Or even running multiple Jetty apps behind a single load balancer, and having them under different contexts/prefixes instead of all in the root context on different ports.\r\n\r\nOne option is to (programmatically) update the routes, i.e. have separate route tables for the different containers.\r\nAnother option would be to use the same route table, but enable Jetty to use a context similar to WildFly.\r\n\r\nI've looked into the latter and have a patch for this with passing tests:\r\n* add support for a :context-path in Jetty's :container-options\r\n* change url-for-routes to support existing :context parameter (it had an if branch for this already, but I didn't get it to work and it doesn't appear to be tested)\r\n* change servlet-interceptor to add :context-path to the request again, to support dynamic url-for via :request :context-path and the same if branch as above. (Ref also our previous discussion in issue #439.) Tried to do this with an 'external' interceptor, but then the default-interceptors and routing plumbing seem to adds the url-for function to the context _before_ the :context-path is available. Not sure how to prepend an interceptor to the chain. (default-interceptors both constructs the vector and updates service-map, perhaps these two operations could be separated later.)\r\n\r\nI think the changes are only breaking for anyone using url-for and its :context parameter, but I believe this did not work as documented.\r\n\r\n(Note that url-for probably doesn't work for WildFly/Immutant right now either, ref the previous discussion. This patch doesn't fix this, but possibly makes it easier to do. OTOH, if url-for isn't wanted/required for Jetty either, adding only :context-path seems trivial.)\r\n\r\nPreparing a PR.\r\n\r\n## Expected Behavior\r\n\r\nPedestal could support Jetty's context-path and make it more convenient to transition between WildFly and Jetty deployment, or support the same app under different contexts.\r\n\r\n## Actual Behavior\r\n\r\nPedestal does not support Jetty's context-path.\r\n\r\n## Steps to reproduce\r\n\r\n# Environment\r\n\r\n## Operating System (including version).\r\n\r\n## Your current Leiningen or Boot version (`lein --version` or `boot --version`)\r\n\r\n## Pedestal version\r\n\r\n0.5.3\r\n","created_at":"2018-06-19T11:49:17Z","updated_at":"2018-06-20T10:07:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df7efe40de756395f64e25ef280a56bb1bde1a7b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pedestal/pedestal/pulls/579/commits","review_comments_url":"https://api.github.com/repos/pedestal/pedestal/pulls/579/comments","review_comment_url":"https://api.github.com/repos/pedestal/pedestal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pedestal/pedestal/issues/579/comments","statuses_url":"https://api.github.com/repos/pedestal/pedestal/statuses/1d9083421cb8fa407d2093212e048e8420009c29","head":{"label":"terjesb:578-jetty-context-path","ref":"578-jetty-context-path","sha":"1d9083421cb8fa407d2093212e048e8420009c29","user":{"login":"terjesb","id":6209,"node_id":"MDQ6VXNlcjYyMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/6209?v=4","gravatar_id":"","url":"https://api.github.com/users/terjesb","html_url":"https://github.com/terjesb","followers_url":"https://api.github.com/users/terjesb/followers","following_url":"https://api.github.com/users/terjesb/following{/other_user}","gists_url":"https://api.github.com/users/terjesb/gists{/gist_id}","starred_url":"https://api.github.com/users/terjesb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terjesb/subscriptions","organizations_url":"https://api.github.com/users/terjesb/orgs","repos_url":"https://api.github.com/users/terjesb/repos","events_url":"https://api.github.com/users/terjesb/events{/privacy}","received_events_url":"https://api.github.com/users/terjesb/received_events","type":"User","site_admin":false},"repo":{"id":137875602,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc4NzU2MDI=","name":"pedestal","full_name":"terjesb/pedestal","owner":{"login":"terjesb","id":6209,"node_id":"MDQ6VXNlcjYyMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/6209?v=4","gravatar_id":"","url":"https://api.github.com/users/terjesb","html_url":"https://github.com/terjesb","followers_url":"https://api.github.com/users/terjesb/followers","following_url":"https://api.github.com/users/terjesb/following{/other_user}","gists_url":"https://api.github.com/users/terjesb/gists{/gist_id}","starred_url":"https://api.github.com/users/terjesb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terjesb/subscriptions","organizations_url":"https://api.github.com/users/terjesb/orgs","repos_url":"https://api.github.com/users/terjesb/repos","events_url":"https://api.github.com/users/terjesb/events{/privacy}","received_events_url":"https://api.github.com/users/terjesb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/terjesb/pedestal","description":"The Pedestal Server-side Libraries","fork":true,"url":"https://api.github.com/repos/terjesb/pedestal","forks_url":"https://api.github.com/repos/terjesb/pedestal/forks","keys_url":"https://api.github.com/repos/terjesb/pedestal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/terjesb/pedestal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/terjesb/pedestal/teams","hooks_url":"https://api.github.com/repos/terjesb/pedestal/hooks","issue_events_url":"https://api.github.com/repos/terjesb/pedestal/issues/events{/number}","events_url":"https://api.github.com/repos/terjesb/pedestal/events","assignees_url":"https://api.github.com/repos/terjesb/pedestal/assignees{/user}","branches_url":"https://api.github.com/repos/terjesb/pedestal/branches{/branch}","tags_url":"https://api.github.com/repos/terjesb/pedestal/tags","blobs_url":"https://api.github.com/repos/terjesb/pedestal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/terjesb/pedestal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/terjesb/pedestal/git/refs{/sha}","trees_url":"https://api.github.com/repos/terjesb/pedestal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/terjesb/pedestal/statuses/{sha}","languages_url":"https://api.github.com/repos/terjesb/pedestal/languages","stargazers_url":"https://api.github.com/repos/terjesb/pedestal/stargazers","contributors_url":"https://api.github.com/repos/terjesb/pedestal/contributors","subscribers_url":"https://api.github.com/repos/terjesb/pedestal/subscribers","subscription_url":"https://api.github.com/repos/terjesb/pedestal/subscription","commits_url":"https://api.github.com/repos/terjesb/pedestal/commits{/sha}","git_commits_url":"https://api.github.com/repos/terjesb/pedestal/git/commits{/sha}","comments_url":"https://api.github.com/repos/terjesb/pedestal/comments{/number}","issue_comment_url":"https://api.github.com/repos/terjesb/pedestal/issues/comments{/number}","contents_url":"https://api.github.com/repos/terjesb/pedestal/contents/{+path}","compare_url":"https://api.github.com/repos/terjesb/pedestal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/terjesb/pedestal/merges","archive_url":"https://api.github.com/repos/terjesb/pedestal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/terjesb/pedestal/downloads","issues_url":"https://api.github.com/repos/terjesb/pedestal/issues{/number}","pulls_url":"https://api.github.com/repos/terjesb/pedestal/pulls{/number}","milestones_url":"https://api.github.com/repos/terjesb/pedestal/milestones{/number}","notifications_url":"https://api.github.com/repos/terjesb/pedestal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/terjesb/pedestal/labels{/name}","releases_url":"https://api.github.com/repos/terjesb/pedestal/releases{/id}","deployments_url":"https://api.github.com/repos/terjesb/pedestal/deployments","created_at":"2018-06-19T10:19:58Z","updated_at":"2018-06-19T10:20:01Z","pushed_at":"2018-06-19T11:47:59Z","git_url":"git://github.com/terjesb/pedestal.git","ssh_url":"git@github.com:terjesb/pedestal.git","clone_url":"https://github.com/terjesb/pedestal.git","svn_url":"https://github.com/terjesb/pedestal","homepage":"","size":3822,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pedestal:master","ref":"master","sha":"c750f94947569511fe92a63bc08af339679a2f6f","user":{"login":"pedestal","id":3730037,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3MzAwMzc=","avatar_url":"https://avatars0.githubusercontent.com/u/3730037?v=4","gravatar_id":"","url":"https://api.github.com/users/pedestal","html_url":"https://github.com/pedestal","followers_url":"https://api.github.com/users/pedestal/followers","following_url":"https://api.github.com/users/pedestal/following{/other_user}","gists_url":"https://api.github.com/users/pedestal/gists{/gist_id}","starred_url":"https://api.github.com/users/pedestal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedestal/subscriptions","organizations_url":"https://api.github.com/users/pedestal/orgs","repos_url":"https://api.github.com/users/pedestal/repos","events_url":"https://api.github.com/users/pedestal/events{/privacy}","received_events_url":"https://api.github.com/users/pedestal/received_events","type":"Organization","site_admin":false},"repo":{"id":8560576,"node_id":"MDEwOlJlcG9zaXRvcnk4NTYwNTc2","name":"pedestal","full_name":"pedestal/pedestal","owner":{"login":"pedestal","id":3730037,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3MzAwMzc=","avatar_url":"https://avatars0.githubusercontent.com/u/3730037?v=4","gravatar_id":"","url":"https://api.github.com/users/pedestal","html_url":"https://github.com/pedestal","followers_url":"https://api.github.com/users/pedestal/followers","following_url":"https://api.github.com/users/pedestal/following{/other_user}","gists_url":"https://api.github.com/users/pedestal/gists{/gist_id}","starred_url":"https://api.github.com/users/pedestal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedestal/subscriptions","organizations_url":"https://api.github.com/users/pedestal/orgs","repos_url":"https://api.github.com/users/pedestal/repos","events_url":"https://api.github.com/users/pedestal/events{/privacy}","received_events_url":"https://api.github.com/users/pedestal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pedestal/pedestal","description":"The Pedestal Server-side Libraries","fork":false,"url":"https://api.github.com/repos/pedestal/pedestal","forks_url":"https://api.github.com/repos/pedestal/pedestal/forks","keys_url":"https://api.github.com/repos/pedestal/pedestal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pedestal/pedestal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pedestal/pedestal/teams","hooks_url":"https://api.github.com/repos/pedestal/pedestal/hooks","issue_events_url":"https://api.github.com/repos/pedestal/pedestal/issues/events{/number}","events_url":"https://api.github.com/repos/pedestal/pedestal/events","assignees_url":"https://api.github.com/repos/pedestal/pedestal/assignees{/user}","branches_url":"https://api.github.com/repos/pedestal/pedestal/branches{/branch}","tags_url":"https://api.github.com/repos/pedestal/pedestal/tags","blobs_url":"https://api.github.com/repos/pedestal/pedestal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pedestal/pedestal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pedestal/pedestal/git/refs{/sha}","trees_url":"https://api.github.com/repos/pedestal/pedestal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pedestal/pedestal/statuses/{sha}","languages_url":"https://api.github.com/repos/pedestal/pedestal/languages","stargazers_url":"https://api.github.com/repos/pedestal/pedestal/stargazers","contributors_url":"https://api.github.com/repos/pedestal/pedestal/contributors","subscribers_url":"https://api.github.com/repos/pedestal/pedestal/subscribers","subscription_url":"https://api.github.com/repos/pedestal/pedestal/subscription","commits_url":"https://api.github.com/repos/pedestal/pedestal/commits{/sha}","git_commits_url":"https://api.github.com/repos/pedestal/pedestal/git/commits{/sha}","comments_url":"https://api.github.com/repos/pedestal/pedestal/comments{/number}","issue_comment_url":"https://api.github.com/repos/pedestal/pedestal/issues/comments{/number}","contents_url":"https://api.github.com/repos/pedestal/pedestal/contents/{+path}","compare_url":"https://api.github.com/repos/pedestal/pedestal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pedestal/pedestal/merges","archive_url":"https://api.github.com/repos/pedestal/pedestal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pedestal/pedestal/downloads","issues_url":"https://api.github.com/repos/pedestal/pedestal/issues{/number}","pulls_url":"https://api.github.com/repos/pedestal/pedestal/pulls{/number}","milestones_url":"https://api.github.com/repos/pedestal/pedestal/milestones{/number}","notifications_url":"https://api.github.com/repos/pedestal/pedestal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pedestal/pedestal/labels{/name}","releases_url":"https://api.github.com/repos/pedestal/pedestal/releases{/id}","deployments_url":"https://api.github.com/repos/pedestal/pedestal/deployments","created_at":"2013-03-04T17:18:45Z","updated_at":"2018-06-19T19:23:22Z","pushed_at":"2018-06-19T11:49:18Z","git_url":"git://github.com/pedestal/pedestal.git","ssh_url":"git@github.com:pedestal/pedestal.git","clone_url":"https://github.com/pedestal/pedestal.git","svn_url":"https://github.com/pedestal/pedestal","homepage":"","size":3818,"stargazers_count":1910,"watchers_count":1910,"language":"Clojure","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":221,"mirror_url":null,"archived":false,"open_issues_count":36,"license":null,"forks":221,"open_issues":36,"watchers":1910,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pedestal/pedestal/pulls/579"},"html":{"href":"https://github.com/pedestal/pedestal/pull/579"},"issue":{"href":"https://api.github.com/repos/pedestal/pedestal/issues/579"},"comments":{"href":"https://api.github.com/repos/pedestal/pedestal/issues/579/comments"},"review_comments":{"href":"https://api.github.com/repos/pedestal/pedestal/pulls/579/comments"},"review_comment":{"href":"https://api.github.com/repos/pedestal/pedestal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pedestal/pedestal/pulls/579/commits"},"statuses":{"href":"https://api.github.com/repos/pedestal/pedestal/statuses/1d9083421cb8fa407d2093212e048e8420009c29"}},"author_association":"NONE"}}
{"actor":{"display_login":"ohpauleez"}}