Announcement Announcement Module
Collapse
No announcement yet.
Generating web URL from business layer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generating web URL from business layer

    I need to send emails after certain events in my application, and in those emails include a URL that points to an application URL. For example, when a user registers for an account, I send them an email with a confirmation URL in it so they can activate the account. The emails are sent via a method interceptor on the business layer.

    My question is: what is the best way to access the web-context specific information from the business layer? I would like not to have to code in the web context or web controller if possible. Currently I just use a property like

    my.url=http://foo.bar/thing

    but wondered if there was perhaps a better way?

  • #2
    I think the cleanest way is for your web layer to pass in the URL down to your service/business layer. Your business layer knows nothing about anything above it, after all...

    But I wouldn't hard-code the host, port, context etc. The web layer should just get these from the current request, and then tack on a context relative portion which is a property being set in the appcontext.

    Comment

    Working...
    X