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

Improved: Add uri shortener function (OFBIZ-13154) #841

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

nmalin
Copy link
Contributor

@nmalin nmalin commented Oct 19, 2024

This improvement offer the possibility to use an url shortener to call ofbiz when it render an url.

The origin requirement is to send by email an url to contact OFBiz without any information on technical or functionnal context like JWToken, userLogin, orderId, partyId and so on. OFBiz forwards only a short reference that match the actual uri wanted.

Example :

  • ecommerce/myaccount/order/ORD10034 -> s/tiozerzaze
  • ecommerce/myaccount?token=JWT[more..than..100]axdr&userLoginId=Me@ofbiz.org -> s/epsserlner

When a request arrive in OFBiz with the pattern s/{shortener}, the request handler forward to matched uri.

To generate a shortener on freemarker template just define it like that :

<@ofbizUrl pathShortener="true">${MyBigUriToSecure}/@ofbizUrl

For email template it's ugly recommand to use webSiteId and fullPath

<@ofbizUrl webSiteId="MyWebSite" fullPath="true" pathShortener="true">${MyBigUriToSecure}/@ofbizUrl

With this you can have an url like this : https://mywebsite.mydomain/s/rytedqzdfd

At this time only <@ofbizUrl macro freemarker support it.

This improvement offer the possibility to use a shortener url to call ofbiz when it render a url.

The origin requirement is to send by email a url to contact OFBiz without any information on technical or functionnal context like JWToken, userLogin, orderId, partyId and so on. OFBiz forward only a short reference that match the actual uri wanted.

Example :
  * ecommerce/myaccount/order/ORD10034 -> s/tiozerzaze
  * ecommerce/myaccount?token=JWT[more..than..100]axdr&userLoginId=Me@ofbiz.org -> s/epsserlner

When a request arrive in OFBiz with the pattern s/{shortener}, the request handler forward to matched uri.

To generate a shortener on freemarker template just use it like it :

   <@ofbizUrl pathShortener="true">${MyBigUriToSecure}</@ofbizUrl>

For email template it's ugly recommand to use webSiteId and fullPath

   <@ofbizUrl webSiteId="MyWebSite" fullPath="true" pathShortener="true">${MyBigUriToSecure}</@ofbizUrl>

With this you can have a url like this : https://mywebsite.mydomain/s/rytedqzdfd

At this time only <@ofbizUrl macro freemarker support it.
Copy link

sonarcloud bot commented Oct 19, 2024

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.

1 participant