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

Correct InvokeAddress #275

Merged
merged 1 commit into from
Oct 11, 2020

Conversation

tobiasrdm
Copy link
Contributor

@tobiasrdm tobiasrdm commented Sep 22, 2020

This pull request fixes #225 and fixes #183

Implementation details

Two new classes have been created: BaseUrlInfo and BaseUrlInfo.Builder.

The following logic is used now:

  • serverName: if preferedServerName is non-null and non-empty, it will be used as the server name. Otherwise, the server name will be obtained from request.getServerName()
  • serverPort and contextPath was obtained from request.
  • BaseUrlInfo.getBaseUrl() and BaseUrlInfo.getServerUrl() don't append 80 or 443 ports to the URL.
  • protocol is obtained from request.getHeader("X-Forwarded-Proto") or from request.getScheme() instead of checking request.isSecure().

The method public BaseUrlInfo getBaseUrlInfo(final HttpServletRequest request) was created on class AbstractController, and it passes the value of server.endpoint.address environment setting as the preferedServerName, to keep backward compatibility.

The method AbstractController.getHostAddress() has been removed, because it is no longer used.

@karldahlgren
Copy link
Collaborator

Amazing @tobiasrdm!
Thank you once again for all your contributions.

Best regards,
Karl Dahlgren

@karldahlgren karldahlgren merged commit 10540b2 into castlemock:master Oct 11, 2020
@tobiasrdm tobiasrdm deleted the correct-invoke-address branch January 7, 2021 14:37
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.

[Docker] 'Address' show docker-IP instead of Container-IP k8s: invalid ip of address/wsdl in operation page
2 participants