Skip to content

Exclude context path from application generated links#475

Merged
chenejac merged 5 commits intovivo-project:mainfrom
litvinovg:custom-context-path
Aug 9, 2025
Merged

Exclude context path from application generated links#475
chenejac merged 5 commits intovivo-project:mainfrom
litvinovg:custom-context-path

Conversation

@litvinovg
Copy link
Member

@litvinovg litvinovg commented Sep 27, 2024

VIVO GitHub issue: (please link to issue)
VIVO PR

What does this pull request do?

New boolean configuration property context.path.exclude to exclude tomcat application context from generated links useful in case the application is deployed with reverse proxy.

What's new?

Created context.path.exclude configuration property to exclude context path from generated links.
Replaced calls for context path to utility methods that allow overriding default context path.

How should this be tested?

Default behavior when configuration property is not set should be the same.

  • To test application behind proxy one would need to configure webserver and tomcat in proxy mode like described in workaround of linked issue and set context.path.exclude = true in runtime.properties
  • General navigation between application pages
  • Authorization
  • Edit this individual page should work the same

#Additional notes

  • Duplicate tests were removed.
  • This change require documentation to be updated.

Interested parties

@VIVO-project/vivo-committers

Reviewers' expertise

Candidates for reviewing this PR should have some of the following expertises:

  1. Java

Reviewers' report template

General comment

A reviewer should provide here comments and suggestions for requested changes if any.

Testing

A reviewer should briefly describe here how it was tested

Code reviewing

A reviewer should briefly describe here which part was code reviewed

Copy link
Contributor

@chenejac chenejac left a comment

Choose a reason for hiding this comment

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

@litvinovg I have left two tiny comments. Please, also invest whether edu/cornell/mannlib/vitro/webapp/filters/PageRoutingFilter.java should be updated as well.

@litvinovg
Copy link
Member Author

litvinovg commented Oct 28, 2024

@litvinovg I have left two tiny comments. Please, also invest whether edu/cornell/mannlib/vitro/webapp/filters/PageRoutingFilter.java should be updated as well.

I think PageRoutingFilter shouldn't be changed.

@litvinovg litvinovg requested a review from chenejac October 28, 2024 14:08
chenejac
chenejac previously approved these changes Oct 29, 2024
Copy link
Contributor

@chenejac chenejac left a comment

Choose a reason for hiding this comment

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

@litvinovg thanks. Well done.

@litvinovg
Copy link
Member Author

Resolved merge conflicts, rebased on top of main branch

Copy link
Member

@brianjlowe brianjlowe left a comment

Choose a reason for hiding this comment

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

See comment on FreemarkerHttpServlet.java

@litvinovg litvinovg changed the title Custom context path configuation option Exclude context path from application generated links Jul 31, 2025
@litvinovg litvinovg requested a review from brianjlowe July 31, 2025 10:42
@litvinovg litvinovg force-pushed the custom-context-path branch from 0def300 to 47b6f4e Compare July 31, 2025 10:47
Copy link
Member

@brianjlowe brianjlowe left a comment

Choose a reason for hiding this comment

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

Have tested the various functionality when reverse-proxying the root path to the /vivo/ context in Tomcat. Everything works fine, and this is a very useful feature. I made just some very tiny suggested tweaks to the example.runtime.properties.

#
Vitro.defaultNamespace = http://vivo.mydomain.edu/individual/

# To exclude tomcat application context name from generated links uncomment following line.
Copy link
Member

Choose a reason for hiding this comment

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

I would leave a blank line (without #) before the next property starts on line 29, which would match the corresponding file in VIVO. I would also suggest a small edit to "To exclude the Tomcat [capitalized]..." and putting a period after "Default value is false."

Copy link
Member Author

Choose a reason for hiding this comment

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

I corrected the text.

@litvinovg litvinovg requested a review from brianjlowe August 6, 2025 09:28
@chenejac chenejac merged commit 0bee9d8 into vivo-project:main Aug 9, 2025
1 check passed
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.

If browser context path has changed edit this individual page doesn't work

3 participants