Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-1165 allow setting of context root on Payara Micro deployments #3682

Merged
merged 2 commits into from Feb 25, 2019

Conversation

smillidge
Copy link
Contributor

@smillidge smillidge commented Feb 2, 2019

This PR allows to set the context path in two ways:

  1. use --contextroot
java -jar payara-micro.jar --deploy myapp.war --contextroot mycontext
  1. use --deploy with :root after the file name
java -jar payara-micro.jar --deploy myapp.war:mycontext

Both examples configure a effective root context of /mycontext/

When both are specified the root given with --deploy takes precedence. The --contextroot applies to the first given --deploy that does not specify its context path directly.

java -jar payara-micro.jar --deploy app1.war:foo --deploy app2.war --contextroot bar

This will deploy app1 in /foo/ and app2 in /bar/.

Note: --deploy app.war:/ is the same as --deploy app.war: which all deploy in the root /.
That means a leading / is not necessary but can be given. In contrast a tailing / should not be given and seems to not work. While the configuration keeps it as "Context Root": "/foo/" browsing to /foo or /foo/ forwards to /foo// which fails to resolve to the expected page.

@smillidge smillidge added this to the 5.191 milestone Feb 2, 2019
@lprimak
Copy link
Contributor

lprimak commented Feb 3, 2019

jenkins test

Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows?

@rdebusscher
Copy link
Contributor

@smillidge --contextroot is ignored when using --deployFromGAV.

Changing the contextroot logic in fish.payara.micro.impl.PayaraMicroImpl#getGAVURLs to the following statements fixes this.

                String contextRoot = artefactMapEntry.getKey();
                if (this.contextRoot == null) {
                    if ("ROOT".equals(contextRoot)) {
                        contextRoot = "/";
                    }
                } else {
                    contextRoot = this.contextRoot;
                }

@smillidge smillidge added the PR: DO NOT MERGE Don't merge PR until further notice label Feb 21, 2019
@smillidge
Copy link
Contributor Author

@rdebusscher good catch I will fix that

@smillidge
Copy link
Contributor Author

Now works with deploy from Gav and uses File.pathseparator so will work on windows

@smillidge
Copy link
Contributor Author

jenkins test please

@Pandrex247 Pandrex247 merged commit 53963f2 into payara:master Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants