tel scheme (telephone)

Splash Forums Rewrite Users tel scheme (telephone)


This topic contains 5 replies, has 2 voices, and was last updated by  Christian Kaltepoth 8 years, 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #23755


    I am using urls containing the phone scheme tel:somephonenumberhere, it seems rewrite only supports mailto:someemailhere, here is the stacktrace:

    java.lang.IllegalArgumentException: [tel:] is not a valid URL fragment. Consider encoding relevant portions of the URL with [class org.ocpsoft.urlbuilder.util.Encoder]
    at org.ocpsoft.urlbuilder.AddressBuilder.create(
    at org.ocpsoft.rewrite.servlet.impl.HttpRewriteWrappedResponse.encodeURL(
    at com.sun.faces.context.ExternalContextImpl.encodeResourceURL(
    at javax.faces.context.ExternalContextWrapper.encodeResourceURL(
    at com.sun.faces.renderkit.html_basic.OutputLinkRenderer.renderAsActive(
    at com.sun.faces.renderkit.html_basic.OutputLinkRenderer.encodeBegin(

    The view code:
    <h:outputLink value="tel:#{}">#{}</h:outputLink>

    Note I am also using the fax scheme. I do not think I should have to do any modification to continue using those schemes.
    I was using PrettyFaces before I migrated to Rewrite.



    it seems like Rewrite tries to create a from your URL which fails. Could you perhaps post the full stacktrace. There should be a caused by part which may be interesting.

    BTW: You can work around this problem by simply using a plain <a> link instead, which I would prefer in any cases because it doesn’t create an extra component in the component tree:

    <a href="#{}">


    Caused by: Expected scheme-specific part at index 4: tel:
    at org.ocpsoft.urlbuilder.AddressBuilder.create(
    … 73 more

    Could indeed use simple html in that case.


    Is it possible that #{} is null or empty in your case? I just tested whether URI can parse tel URLs and and seems to work fine. I only doesn’t work if I try to parse tel: which is NOT valid and throws exactly the same exception like you got.

    Perhaps you could do something like this:

    <h:outputLink value="tel:#{}" rendered="#{ not empty }">


    As I did not get any errors with this code using PrettyFaces I suspected it was some bug of Rewrite, the error helped find out that I was missing not empty checks in that part of the code. The mailto: never failed because the email is required… So thanks for Rewrite and taking some time helping me out.


    It’s not really a bug in Rewrite. But Rewrite seems to fail for invalid URLs while PrettyFaces doesn’t.

    However, I’m glad to hear you fixed your problem. 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Rewrite Users’ is closed to new topics and replies.

Comments are closed.