You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Philipp Bachmann (JIRA)" <ji...@apache.org> on 2019/07/01 13:42:00 UTC

[jira] [Updated] (CAMEL-13712) If a javax.mail.Session gets referred to using the "session" URL parameter, Apache Camel Mail ignored its hostnames.

     [ https://issues.apache.org/jira/browse/CAMEL-13712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philipp Bachmann updated CAMEL-13712:
-------------------------------------
    Description: 
{color:#658aba}A javax.mail.Session injected using JNDI can refer to one host per protocol. Referring to such a session using the URL query string parameter session=#jndiName seems to ignore the hosts the session is bound to:{color}

{color:#658aba}My first try was simply e.g. "smtp://?session=#jndiName". Now Apache Camel Mail complains about a missing hostname.{color}

{color:#658aba}So I tried "smtp://localhost?session=#jndiName" expecting that "localhost" would have been overridden using the SMTP host the session refers to, which is not the case. Camel complains that no SMTP server was listening on the host named "localhost".{color}

{color:#658aba}The workaround that works – but is somehow redundant in my opinion – is:{color}

{{{color:#3381ff}@Resource{color}(mappedName = {color:#658aba}"jndiName"{color})}}
 {{ {color:#000080}private {color}Session {color:#1948a6}mySession{color};}}

{{{color:#658aba}...to("smtp://"+{color}{color:#1948a6}mySession{color}.getProperty({color:#658aba}"mail.smtp.host"{color})+"{color:#658aba}?session=#jndiName")...{color}}}

{color:#658aba}The same also applies to the IMAP server (and likely to the other protocols supported by Java Mail as well).{color}

{color:#658aba}It would be nice iff referring to a JNDI injected session would take the session as-is to simplify the URL.{color}

{color:#658aba}I found an example for using the "session" parameter: "MailUsingCustomSessionTest". It would be helpful to have another example at hand that either takes the hostname from the session as my example above or that does not contain a hostname at all, given, Apache Camel Mail will support that in the future.{color}

  was:
{color:#658aba}A javax.mail.Session injected using JNDI can refer to one host per protocol. Referring to such a session using the URL query string parameter session=#jndiName seems to ignore the hosts the session is bound to:
{color}

{color:#658aba}My first try was simply e.g. "smtp://?session=#jndiName". Now Apache Camel Mail complains about a missing hostname.{color}

{color:#658aba}So I tried "smtp://localhost?session=#jndiName" expecting that "ignored" would have been overridden using the SMTP host the session refers to, which is not the case. Camel complains that no SMTP server was listening on the host named "localhost".{color}

{color:#658aba}The workaround that works – but is somehow redundant in my opinion – is:{color}

{{{color:#3381ff}@Resource{color}(mappedName = {color:#658aba}"jndiName"{color})}}
{{ {color:#000080}private {color}Session {color:#1948a6}mySession{color};}}

{{{color:#658aba}...to("smtp://"+{color}{color:#1948a6}mySession{color}.getProperty({color:#658aba}"mail.smtp.host"{color})+"{color:#658aba}?session=#jndiName")...{color}}}

{color:#658aba}The same also applies to the IMAP server (and likely to the other protocols supported by Java Mail as well).{color}

{color:#658aba}It would be nice iff referring to a JNDI injected session would take the session as-is to simplify the URL.{color}

{color:#658aba}I found an example for using the "session" parameter: "MailUsingCustomSessionTest". It would be helpful to have another example at hand that either takes the hostname from the session as my example above or that does not contain a hostname at all, given, Apache Camel Mail will support that in the future.{color}


> If a javax.mail.Session gets referred to using the "session" URL parameter, Apache Camel Mail ignored its hostnames.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-13712
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13712
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-mail
>    Affects Versions: 2.22.1
>            Reporter: Philipp Bachmann
>            Priority: Minor
>
> {color:#658aba}A javax.mail.Session injected using JNDI can refer to one host per protocol. Referring to such a session using the URL query string parameter session=#jndiName seems to ignore the hosts the session is bound to:{color}
> {color:#658aba}My first try was simply e.g. "smtp://?session=#jndiName". Now Apache Camel Mail complains about a missing hostname.{color}
> {color:#658aba}So I tried "smtp://localhost?session=#jndiName" expecting that "localhost" would have been overridden using the SMTP host the session refers to, which is not the case. Camel complains that no SMTP server was listening on the host named "localhost".{color}
> {color:#658aba}The workaround that works – but is somehow redundant in my opinion – is:{color}
> {{{color:#3381ff}@Resource{color}(mappedName = {color:#658aba}"jndiName"{color})}}
>  {{ {color:#000080}private {color}Session {color:#1948a6}mySession{color};}}
> {{{color:#658aba}...to("smtp://"+{color}{color:#1948a6}mySession{color}.getProperty({color:#658aba}"mail.smtp.host"{color})+"{color:#658aba}?session=#jndiName")...{color}}}
> {color:#658aba}The same also applies to the IMAP server (and likely to the other protocols supported by Java Mail as well).{color}
> {color:#658aba}It would be nice iff referring to a JNDI injected session would take the session as-is to simplify the URL.{color}
> {color:#658aba}I found an example for using the "session" parameter: "MailUsingCustomSessionTest". It would be helpful to have another example at hand that either takes the hostname from the session as my example above or that does not contain a hostname at all, given, Apache Camel Mail will support that in the future.{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)