{"action":"created","issue":{"url":"https://api.github.com/repos/wildfly-swarm/wildfly-swarm/issues/31","labels_url":"https://api.github.com/repos/wildfly-swarm/wildfly-swarm/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/wildfly-swarm/wildfly-swarm/issues/31/comments","events_url":"https://api.github.com/repos/wildfly-swarm/wildfly-swarm/issues/31/events","html_url":"https://github.com/wildfly-swarm/wildfly-swarm/issues/31","id":79623022,"number":31,"title":"How is the web context set in undertow ?","user":{"login":"agoncal","id":729277,"avatar_url":"https://avatars.githubusercontent.com/u/729277?v=3","gravatar_id":"","url":"https://api.github.com/users/agoncal","html_url":"https://github.com/agoncal","followers_url":"https://api.github.com/users/agoncal/followers","following_url":"https://api.github.com/users/agoncal/following{/other_user}","gists_url":"https://api.github.com/users/agoncal/gists{/gist_id}","starred_url":"https://api.github.com/users/agoncal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoncal/subscriptions","organizations_url":"https://api.github.com/users/agoncal/orgs","repos_url":"https://api.github.com/users/agoncal/repos","events_url":"https://api.github.com/users/agoncal/events{/privacy}","received_events_url":"https://api.github.com/users/agoncal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-22T21:44:30Z","updated_at":"2015-05-23T10:27:01Z","closed_at":null,"body":"Hi all,\r\n\r\nI'm playing with JBoss Forge and the Swarm-addon for Forge. Basically, this addon just sets up the Swarm dependency in the `pom.xml`, and it works quite well actually. \r\n\r\nSo, when I create a basic REST endpoint with Forge I'd go : \r\n\r\n```\r\n$ project-new --named test\r\n$ rest-new-endpoint --named MyEndpoint --methods GET \r\n```\r\n\r\nThis creates a `test.war` file, I package it, deploy it to Wildfly, and I can ping my endpoint pointing at `http://localhost:8080/test/rest/myEnpoint`. Then, I setup Swarm\r\n\r\n```\r\n$ wildfly-swarm-setup\r\n```\r\n\r\nI can now execute the Fatjar and ping my endpoint at `http://localhost:8080/rest/myEnpoint`.\r\n\r\nThe good thing is that I can quickly create a Swarm project with Forge in only 3 lines of code. The problem, is that the web context differs from one to the other. This is what I get when deploying the war to WildFly :\r\n\r\n```\r\nINFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0021: Registered web context: /test\r\n```\r\nThis is what I get when executing the Fatjar : \r\n```\r\nINFO  [org.wildfly.extension.undertow] (MSC service thread 1-16) WFLYUT0021: Registered web context: /\r\n```\r\n\r\nThe root context cannot be set in `web.xml` (there is none in the project anyway) and should be set in a higher descriptor (eg. `application.xml`) or other descriptor (eg. `jboss-web.xml`, `jboss-deployment-structure.xml`). But because there is none, I assume that Undertow creates one when a war is deployed (based on the name of the war) but doesn't when executed with Swarm.\r\n\r\nIs there a way to have the same root context in both cases (deployed in WildFly and executed with Swarm) ? Or how could I have a `test` web root context in Swarm ?\r\n"},"comment":{"url":"https://api.github.com/repos/wildfly-swarm/wildfly-swarm/issues/comments/104879333","html_url":"https://github.com/wildfly-swarm/wildfly-swarm/issues/31#issuecomment-104879333","issue_url":"https://api.github.com/repos/wildfly-swarm/wildfly-swarm/issues/31","id":104879333,"user":{"login":"agoncal","id":729277,"avatar_url":"https://avatars.githubusercontent.com/u/729277?v=3","gravatar_id":"","url":"https://api.github.com/users/agoncal","html_url":"https://github.com/agoncal","followers_url":"https://api.github.com/users/agoncal/followers","following_url":"https://api.github.com/users/agoncal/following{/other_user}","gists_url":"https://api.github.com/users/agoncal/gists{/gist_id}","starred_url":"https://api.github.com/users/agoncal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoncal/subscriptions","organizations_url":"https://api.github.com/users/agoncal/orgs","repos_url":"https://api.github.com/users/agoncal/repos","events_url":"https://api.github.com/users/agoncal/events{/privacy}","received_events_url":"https://api.github.com/users/agoncal/received_events","type":"User","site_admin":false},"created_at":"2015-05-23T10:27:01Z","updated_at":"2015-05-23T10:27:01Z","body":"You can see it as another way of differentiating services. If I need to have several microservices running on the same machine, I need to change port numbers, REST endpoints, servlets.... but why not also being able to change the context root ? \r\n\r\nIn the example I'm giving with Forge, it's a nice way to show that deploying the war or running the fatjar is identical : same root context, same services...."}}