You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-dev@incubator.apache.org by Qiang Fan <jo...@gmail.com> on 2006/11/28 21:45:42 UTC

GoLinkRenderer calls writeURIAttribute to render name and id, why?

In GoLinkRenderer class, there is the following method:

  @Override
  protected void renderId(
    FacesContext context,
    UIComponent  component) throws IOException
  {
    if (shouldRenderId(context, component))
    {
      String clientId = getClientId(context, component);
      // For links, these are actually URI attributes
      context.getResponseWriter().writeURIAttribute("id", clientId, "id");
      context.getResponseWriter().writeURIAttribute("name", clientId, "id");
    }
  }

Why are id and name rendered as URI? Are the id and name used as URI in
javascript logic? I saw some similar code in several other classes too.

Thanks.

John Fan

Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Scott O'Bryan <da...@gmail.com>.
Thanks Adam.  That's what I was looking for.  :) 

Scott

Adam Winer wrote:
> Guys, this is ALWAYS a # URL.  It's the name attr of a link, and
> can't possibly be anything more.  There are zero portal implications.
>
> -- Adam
>
>
> On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
>>
>> Right.  Well it's the other cases I'm worried about.  I would rather not
>> have the decision in the Trinidad code whether to encode the URL or
>> not.  We should always be encoding unless we're certain they are
>> bookmarks.  Otherwise, presumably, the app server or portal will handle
>> it accordingly.  Is that not correct?
>>
>> Scott
>>
>> Matt Cooper wrote:
>> > If the link's destination starts with "#" then yes; if the destination
>> > doesn't start with "http://", "https://", "mailto:", "javascript:" or
>> > anything else.
>> >
>> > On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
>> >>
>> >> So they will basically reference bookmarks, correct?
>> >>
>> >> Scott
>> >>
>> >> Adam Winer wrote:
>> >> > Neither;  they do not need to be encoded at all, as they
>> >> > are only references within a page.
>> >> >
>> >> > -- Adam
>> >> >
>> >> >
>> >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
>> >> >> Adam:
>> >> >>
>> >> >> I asked the question because I am working on a patch for encoding
>> >> >> URLs in
>> >> >> trinidad. I need to know whether to encode the URL as Action 
>> URL or
>> >> >> Resource
>> >> >> URL.
>> >> >>
>> >> >> For the following scenarios I guess they should all be encoded as
>> >> Action
>> >> >> URL. But I am not sure. Just want to confirm with you.
>> >> >>
>> >> >> In HeaderRenderer (in this case only name is rendered and I did 
>> not
>> >> >> see id
>> >> >> for it):
>> >> >>
>> >> >>     renderURIAttribute(context, NAME_ATTRIBUTE, label);
>> >> >>
>> >> >> And in LinkRenderer:
>> >> >>
>> >> >>   protected void renderID(
>> >> >>     UIXRenderingContext context,
>> >> >>     UINode           node
>> >> >>     ) throws IOException
>> >> >>   {
>> >> >>     Object id = getID(context, node);
>> >> >>
>> >> >>     if (id != null)
>> >> >>     {
>> >> >>       if (supportsID(context))
>> >> >>       {
>> >> >>         // For links, "name" and thus "id" is a URI attribute.
>> >> >>         renderURIID(context, id);
>> >> >>       }
>> >> >>
>> >> >>       if (supportsNameIdentification(context) &&
>> >> >> makeNameAndIDSame(context))
>> >> >>       {
>> >> >>         renderURIAttribute(context, "name", id);
>> >> >>       }
>> >> >>     }
>> >> >>   }
>> >> >> Are they all Action URLs?
>> >> >>
>> >> >> Thanks.
>> >> >>
>> >> >> John
>> >> >>
>> >> >>
>> >> >> On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
>> >> >> >
>> >> >> > The value of the attribute on "name" on GoLink will end up 
>> mapping
>> >> >> > up to "href" on some other link.  So it really is a URI.
>> >> >> > E.g., you need to use % encoding, not & encoding.
>> >> >> > And "id" must equal "name".
>> >> >> >
>> >> >> > -- Adam
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
>> >> >> > > In GoLinkRenderer class, there is the following method:
>> >> >> > >
>> >> >> > >   @Override
>> >> >> > >   protected void renderId(
>> >> >> > >     FacesContext context,
>> >> >> > >     UIComponent  component) throws IOException
>> >> >> > >   {
>> >> >> > >     if (shouldRenderId(context, component))
>> >> >> > >     {
>> >> >> > >       String clientId = getClientId(context, component);
>> >> >> > >       // For links, these are actually URI attributes
>> >> >> > >       context.getResponseWriter().writeURIAttribute("id",
>> >> clientId,
>> >> >> > "id");
>> >> >> > >       context.getResponseWriter().writeURIAttribute("name",
>> >> >> clientId,
>> >> >> > "id");
>> >> >> > >     }
>> >> >> > >   }
>> >> >> > >
>> >> >> > > Why are id and name rendered as URI? Are the id and name 
>> used as
>> >> >> URI in
>> >> >> > > javascript logic? I saw some similar code in several other
>> >> >> classes too.
>> >> >> > >
>> >> >> > > Thanks.
>> >> >> > >
>> >> >> > > John Fan
>> >> >> > >
>> >> >> > >
>> >> >> >
>> >> >>
>> >> >>
>> >> >
>> >>
>> >>
>> >
>>
>>
>


Re: Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Adam Winer <aw...@gmail.com>.
Also?  I thought that's exactly what we were talking about.
Were we talking about anything else?

-- Adam


On 11/29/06, Qiang Fan <jo...@gmail.com> wrote:
> Adam:
>
> Your comment also applies to the following GoLinkRenderer code, right?
>
>   @Override
>   protected void renderId(
>     FacesContext context,
>     UIComponent  component) throws IOException
>   {
>     if (shouldRenderId(context, component))
>     {
>       String clientId = getClientId(context, component);
>       // For links, these are actually URI attributes
>       context.getResponseWriter().writeURIAttribute("id", clientId, "id");
>       context.getResponseWriter().writeURIAttribute("name", clientId, "id");
>
>     }
>   }
>
>
> Thanks.
>
> John
>
>
>
> On 11/29/06, Adam Winer <aw...@gmail.com> wrote:
> >
> > Guys, this is ALWAYS a # URL.  It's the name attr of a link, and
> > can't possibly be anything more.  There are zero portal implications.
> >
> > -- Adam
> >
> >
> > On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
> > >
> > > Right.  Well it's the other cases I'm worried about.  I would rather not
> > > have the decision in the Trinidad code whether to encode the URL or
> > > not.  We should always be encoding unless we're certain they are
> > > bookmarks.  Otherwise, presumably, the app server or portal will handle
> > > it accordingly.  Is that not correct?
> > >
> > > Scott
> > >
> > > Matt Cooper wrote:
> > > > If the link's destination starts with "#" then yes; if the destination
> > > > doesn't start with "http://", "https://", "mailto:", "javascript:" or
> > > > anything else.
> > > >
> > > > On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
> > > >>
> > > >> So they will basically reference bookmarks, correct?
> > > >>
> > > >> Scott
> > > >>
> > > >> Adam Winer wrote:
> > > >> > Neither;  they do not need to be encoded at all, as they
> > > >> > are only references within a page.
> > > >> >
> > > >> > -- Adam
> > > >> >
> > > >> >
> > > >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> > > >> >> Adam:
> > > >> >>
> > > >> >> I asked the question because I am working on a patch for encoding
> > > >> >> URLs in
> > > >> >> trinidad. I need to know whether to encode the URL as Action URL
> > or
> > > >> >> Resource
> > > >> >> URL.
> > > >> >>
> > > >> >> For the following scenarios I guess they should all be encoded as
> > > >> Action
> > > >> >> URL. But I am not sure. Just want to confirm with you.
> > > >> >>
> > > >> >> In HeaderRenderer (in this case only name is rendered and I did
> > not
> > > >> >> see id
> > > >> >> for it):
> > > >> >>
> > > >> >>     renderURIAttribute(context, NAME_ATTRIBUTE, label);
> > > >> >>
> > > >> >> And in LinkRenderer:
> > > >> >>
> > > >> >>   protected void renderID(
> > > >> >>     UIXRenderingContext context,
> > > >> >>     UINode           node
> > > >> >>     ) throws IOException
> > > >> >>   {
> > > >> >>     Object id = getID(context, node);
> > > >> >>
> > > >> >>     if (id != null)
> > > >> >>     {
> > > >> >>       if (supportsID(context))
> > > >> >>       {
> > > >> >>         // For links, "name" and thus "id" is a URI attribute.
> > > >> >>         renderURIID(context, id);
> > > >> >>       }
> > > >> >>
> > > >> >>       if (supportsNameIdentification(context) &&
> > > >> >> makeNameAndIDSame(context))
> > > >> >>       {
> > > >> >>         renderURIAttribute(context, "name", id);
> > > >> >>       }
> > > >> >>     }
> > > >> >>   }
> > > >> >> Are they all Action URLs?
> > > >> >>
> > > >> >> Thanks.
> > > >> >>
> > > >> >> John
> > > >> >>
> > > >> >>
> > > >> >> On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
> > > >> >> >
> > > >> >> > The value of the attribute on "name" on GoLink will end up
> > mapping
> > > >> >> > up to "href" on some other link.  So it really is a URI.
> > > >> >> > E.g., you need to use % encoding, not & encoding.
> > > >> >> > And "id" must equal "name".
> > > >> >> >
> > > >> >> > -- Adam
> > > >> >> >
> > > >> >> >
> > > >> >> >
> > > >> >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> > > >> >> > > In GoLinkRenderer class, there is the following method:
> > > >> >> > >
> > > >> >> > >   @Override
> > > >> >> > >   protected void renderId(
> > > >> >> > >     FacesContext context,
> > > >> >> > >     UIComponent  component) throws IOException
> > > >> >> > >   {
> > > >> >> > >     if (shouldRenderId(context, component))
> > > >> >> > >     {
> > > >> >> > >       String clientId = getClientId(context, component);
> > > >> >> > >       // For links, these are actually URI attributes
> > > >> >> > >       context.getResponseWriter().writeURIAttribute("id",
> > > >> clientId,
> > > >> >> > "id");
> > > >> >> > >       context.getResponseWriter().writeURIAttribute("name",
> > > >> >> clientId,
> > > >> >> > "id");
> > > >> >> > >     }
> > > >> >> > >   }
> > > >> >> > >
> > > >> >> > > Why are id and name rendered as URI? Are the id and name used
> > as
> > > >> >> URI in
> > > >> >> > > javascript logic? I saw some similar code in several other
> > > >> >> classes too.
> > > >> >> > >
> > > >> >> > > Thanks.
> > > >> >> > >
> > > >> >> > > John Fan
> > > >> >> > >
> > > >> >> > >
> > > >> >> >
> > > >> >>
> > > >> >>
> > > >> >
> > > >>
> > > >>
> > > >
> > >
> > >
> >
> >
>
>

Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Qiang Fan <jo...@gmail.com>.
Adam:

Your comment also applies to the following GoLinkRenderer code, right?

  @Override
  protected void renderId(
    FacesContext context,
    UIComponent  component) throws IOException
  {
    if (shouldRenderId(context, component))
    {
      String clientId = getClientId(context, component);
      // For links, these are actually URI attributes
      context.getResponseWriter().writeURIAttribute("id", clientId, "id");
      context.getResponseWriter().writeURIAttribute("name", clientId, "id");

    }
  }


Thanks.

John



On 11/29/06, Adam Winer <aw...@gmail.com> wrote:
>
> Guys, this is ALWAYS a # URL.  It's the name attr of a link, and
> can't possibly be anything more.  There are zero portal implications.
>
> -- Adam
>
>
> On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
> >
> > Right.  Well it's the other cases I'm worried about.  I would rather not
> > have the decision in the Trinidad code whether to encode the URL or
> > not.  We should always be encoding unless we're certain they are
> > bookmarks.  Otherwise, presumably, the app server or portal will handle
> > it accordingly.  Is that not correct?
> >
> > Scott
> >
> > Matt Cooper wrote:
> > > If the link's destination starts with "#" then yes; if the destination
> > > doesn't start with "http://", "https://", "mailto:", "javascript:" or
> > > anything else.
> > >
> > > On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
> > >>
> > >> So they will basically reference bookmarks, correct?
> > >>
> > >> Scott
> > >>
> > >> Adam Winer wrote:
> > >> > Neither;  they do not need to be encoded at all, as they
> > >> > are only references within a page.
> > >> >
> > >> > -- Adam
> > >> >
> > >> >
> > >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> > >> >> Adam:
> > >> >>
> > >> >> I asked the question because I am working on a patch for encoding
> > >> >> URLs in
> > >> >> trinidad. I need to know whether to encode the URL as Action URL
> or
> > >> >> Resource
> > >> >> URL.
> > >> >>
> > >> >> For the following scenarios I guess they should all be encoded as
> > >> Action
> > >> >> URL. But I am not sure. Just want to confirm with you.
> > >> >>
> > >> >> In HeaderRenderer (in this case only name is rendered and I did
> not
> > >> >> see id
> > >> >> for it):
> > >> >>
> > >> >>     renderURIAttribute(context, NAME_ATTRIBUTE, label);
> > >> >>
> > >> >> And in LinkRenderer:
> > >> >>
> > >> >>   protected void renderID(
> > >> >>     UIXRenderingContext context,
> > >> >>     UINode           node
> > >> >>     ) throws IOException
> > >> >>   {
> > >> >>     Object id = getID(context, node);
> > >> >>
> > >> >>     if (id != null)
> > >> >>     {
> > >> >>       if (supportsID(context))
> > >> >>       {
> > >> >>         // For links, "name" and thus "id" is a URI attribute.
> > >> >>         renderURIID(context, id);
> > >> >>       }
> > >> >>
> > >> >>       if (supportsNameIdentification(context) &&
> > >> >> makeNameAndIDSame(context))
> > >> >>       {
> > >> >>         renderURIAttribute(context, "name", id);
> > >> >>       }
> > >> >>     }
> > >> >>   }
> > >> >> Are they all Action URLs?
> > >> >>
> > >> >> Thanks.
> > >> >>
> > >> >> John
> > >> >>
> > >> >>
> > >> >> On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
> > >> >> >
> > >> >> > The value of the attribute on "name" on GoLink will end up
> mapping
> > >> >> > up to "href" on some other link.  So it really is a URI.
> > >> >> > E.g., you need to use % encoding, not & encoding.
> > >> >> > And "id" must equal "name".
> > >> >> >
> > >> >> > -- Adam
> > >> >> >
> > >> >> >
> > >> >> >
> > >> >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> > >> >> > > In GoLinkRenderer class, there is the following method:
> > >> >> > >
> > >> >> > >   @Override
> > >> >> > >   protected void renderId(
> > >> >> > >     FacesContext context,
> > >> >> > >     UIComponent  component) throws IOException
> > >> >> > >   {
> > >> >> > >     if (shouldRenderId(context, component))
> > >> >> > >     {
> > >> >> > >       String clientId = getClientId(context, component);
> > >> >> > >       // For links, these are actually URI attributes
> > >> >> > >       context.getResponseWriter().writeURIAttribute("id",
> > >> clientId,
> > >> >> > "id");
> > >> >> > >       context.getResponseWriter().writeURIAttribute("name",
> > >> >> clientId,
> > >> >> > "id");
> > >> >> > >     }
> > >> >> > >   }
> > >> >> > >
> > >> >> > > Why are id and name rendered as URI? Are the id and name used
> as
> > >> >> URI in
> > >> >> > > javascript logic? I saw some similar code in several other
> > >> >> classes too.
> > >> >> > >
> > >> >> > > Thanks.
> > >> >> > >
> > >> >> > > John Fan
> > >> >> > >
> > >> >> > >
> > >> >> >
> > >> >>
> > >> >>
> > >> >
> > >>
> > >>
> > >
> >
> >
>
>

Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Adam Winer <aw...@gmail.com>.
Guys, this is ALWAYS a # URL.  It's the name attr of a link, and
can't possibly be anything more.  There are zero portal implications.

-- Adam


On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
>
> Right.  Well it's the other cases I'm worried about.  I would rather not
> have the decision in the Trinidad code whether to encode the URL or
> not.  We should always be encoding unless we're certain they are
> bookmarks.  Otherwise, presumably, the app server or portal will handle
> it accordingly.  Is that not correct?
>
> Scott
>
> Matt Cooper wrote:
> > If the link's destination starts with "#" then yes; if the destination
> > doesn't start with "http://", "https://", "mailto:", "javascript:" or
> > anything else.
> >
> > On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
> >>
> >> So they will basically reference bookmarks, correct?
> >>
> >> Scott
> >>
> >> Adam Winer wrote:
> >> > Neither;  they do not need to be encoded at all, as they
> >> > are only references within a page.
> >> >
> >> > -- Adam
> >> >
> >> >
> >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> >> >> Adam:
> >> >>
> >> >> I asked the question because I am working on a patch for encoding
> >> >> URLs in
> >> >> trinidad. I need to know whether to encode the URL as Action URL or
> >> >> Resource
> >> >> URL.
> >> >>
> >> >> For the following scenarios I guess they should all be encoded as
> >> Action
> >> >> URL. But I am not sure. Just want to confirm with you.
> >> >>
> >> >> In HeaderRenderer (in this case only name is rendered and I did not
> >> >> see id
> >> >> for it):
> >> >>
> >> >>     renderURIAttribute(context, NAME_ATTRIBUTE, label);
> >> >>
> >> >> And in LinkRenderer:
> >> >>
> >> >>   protected void renderID(
> >> >>     UIXRenderingContext context,
> >> >>     UINode           node
> >> >>     ) throws IOException
> >> >>   {
> >> >>     Object id = getID(context, node);
> >> >>
> >> >>     if (id != null)
> >> >>     {
> >> >>       if (supportsID(context))
> >> >>       {
> >> >>         // For links, "name" and thus "id" is a URI attribute.
> >> >>         renderURIID(context, id);
> >> >>       }
> >> >>
> >> >>       if (supportsNameIdentification(context) &&
> >> >> makeNameAndIDSame(context))
> >> >>       {
> >> >>         renderURIAttribute(context, "name", id);
> >> >>       }
> >> >>     }
> >> >>   }
> >> >> Are they all Action URLs?
> >> >>
> >> >> Thanks.
> >> >>
> >> >> John
> >> >>
> >> >>
> >> >> On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
> >> >> >
> >> >> > The value of the attribute on "name" on GoLink will end up mapping
> >> >> > up to "href" on some other link.  So it really is a URI.
> >> >> > E.g., you need to use % encoding, not & encoding.
> >> >> > And "id" must equal "name".
> >> >> >
> >> >> > -- Adam
> >> >> >
> >> >> >
> >> >> >
> >> >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> >> >> > > In GoLinkRenderer class, there is the following method:
> >> >> > >
> >> >> > >   @Override
> >> >> > >   protected void renderId(
> >> >> > >     FacesContext context,
> >> >> > >     UIComponent  component) throws IOException
> >> >> > >   {
> >> >> > >     if (shouldRenderId(context, component))
> >> >> > >     {
> >> >> > >       String clientId = getClientId(context, component);
> >> >> > >       // For links, these are actually URI attributes
> >> >> > >       context.getResponseWriter().writeURIAttribute("id",
> >> clientId,
> >> >> > "id");
> >> >> > >       context.getResponseWriter().writeURIAttribute("name",
> >> >> clientId,
> >> >> > "id");
> >> >> > >     }
> >> >> > >   }
> >> >> > >
> >> >> > > Why are id and name rendered as URI? Are the id and name used as
> >> >> URI in
> >> >> > > javascript logic? I saw some similar code in several other
> >> >> classes too.
> >> >> > >
> >> >> > > Thanks.
> >> >> > >
> >> >> > > John Fan
> >> >> > >
> >> >> > >
> >> >> >
> >> >>
> >> >>
> >> >
> >>
> >>
> >
>
>

Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Scott O'Bryan <da...@gmail.com>.
Right.  Well it's the other cases I'm worried about.  I would rather not 
have the decision in the Trinidad code whether to encode the URL or 
not.  We should always be encoding unless we're certain they are 
bookmarks.  Otherwise, presumably, the app server or portal will handle 
it accordingly.  Is that not correct?

Scott

Matt Cooper wrote:
> If the link's destination starts with "#" then yes; if the destination
> doesn't start with "http://", "https://", "mailto:", "javascript:" or
> anything else.
>
> On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
>>
>> So they will basically reference bookmarks, correct?
>>
>> Scott
>>
>> Adam Winer wrote:
>> > Neither;  they do not need to be encoded at all, as they
>> > are only references within a page.
>> >
>> > -- Adam
>> >
>> >
>> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
>> >> Adam:
>> >>
>> >> I asked the question because I am working on a patch for encoding
>> >> URLs in
>> >> trinidad. I need to know whether to encode the URL as Action URL or
>> >> Resource
>> >> URL.
>> >>
>> >> For the following scenarios I guess they should all be encoded as
>> Action
>> >> URL. But I am not sure. Just want to confirm with you.
>> >>
>> >> In HeaderRenderer (in this case only name is rendered and I did not
>> >> see id
>> >> for it):
>> >>
>> >>     renderURIAttribute(context, NAME_ATTRIBUTE, label);
>> >>
>> >> And in LinkRenderer:
>> >>
>> >>   protected void renderID(
>> >>     UIXRenderingContext context,
>> >>     UINode           node
>> >>     ) throws IOException
>> >>   {
>> >>     Object id = getID(context, node);
>> >>
>> >>     if (id != null)
>> >>     {
>> >>       if (supportsID(context))
>> >>       {
>> >>         // For links, "name" and thus "id" is a URI attribute.
>> >>         renderURIID(context, id);
>> >>       }
>> >>
>> >>       if (supportsNameIdentification(context) &&
>> >> makeNameAndIDSame(context))
>> >>       {
>> >>         renderURIAttribute(context, "name", id);
>> >>       }
>> >>     }
>> >>   }
>> >> Are they all Action URLs?
>> >>
>> >> Thanks.
>> >>
>> >> John
>> >>
>> >>
>> >> On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
>> >> >
>> >> > The value of the attribute on "name" on GoLink will end up mapping
>> >> > up to "href" on some other link.  So it really is a URI.
>> >> > E.g., you need to use % encoding, not & encoding.
>> >> > And "id" must equal "name".
>> >> >
>> >> > -- Adam
>> >> >
>> >> >
>> >> >
>> >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
>> >> > > In GoLinkRenderer class, there is the following method:
>> >> > >
>> >> > >   @Override
>> >> > >   protected void renderId(
>> >> > >     FacesContext context,
>> >> > >     UIComponent  component) throws IOException
>> >> > >   {
>> >> > >     if (shouldRenderId(context, component))
>> >> > >     {
>> >> > >       String clientId = getClientId(context, component);
>> >> > >       // For links, these are actually URI attributes
>> >> > >       context.getResponseWriter().writeURIAttribute("id", 
>> clientId,
>> >> > "id");
>> >> > >       context.getResponseWriter().writeURIAttribute("name",
>> >> clientId,
>> >> > "id");
>> >> > >     }
>> >> > >   }
>> >> > >
>> >> > > Why are id and name rendered as URI? Are the id and name used as
>> >> URI in
>> >> > > javascript logic? I saw some similar code in several other
>> >> classes too.
>> >> > >
>> >> > > Thanks.
>> >> > >
>> >> > > John Fan
>> >> > >
>> >> > >
>> >> >
>> >>
>> >>
>> >
>>
>>
>


Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Matt Cooper <ma...@gmail.com>.
If the link's destination starts with "#" then yes; if the destination
doesn't start with "http://", "https://", "mailto:", "javascript:" or
anything else.

On 11/29/06, Scott O'Bryan <da...@gmail.com> wrote:
>
> So they will basically reference bookmarks, correct?
>
> Scott
>
> Adam Winer wrote:
> > Neither;  they do not need to be encoded at all, as they
> > are only references within a page.
> >
> > -- Adam
> >
> >
> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> >> Adam:
> >>
> >> I asked the question because I am working on a patch for encoding
> >> URLs in
> >> trinidad. I need to know whether to encode the URL as Action URL or
> >> Resource
> >> URL.
> >>
> >> For the following scenarios I guess they should all be encoded as
> Action
> >> URL. But I am not sure. Just want to confirm with you.
> >>
> >> In HeaderRenderer (in this case only name is rendered and I did not
> >> see id
> >> for it):
> >>
> >>     renderURIAttribute(context, NAME_ATTRIBUTE, label);
> >>
> >> And in LinkRenderer:
> >>
> >>   protected void renderID(
> >>     UIXRenderingContext context,
> >>     UINode           node
> >>     ) throws IOException
> >>   {
> >>     Object id = getID(context, node);
> >>
> >>     if (id != null)
> >>     {
> >>       if (supportsID(context))
> >>       {
> >>         // For links, "name" and thus "id" is a URI attribute.
> >>         renderURIID(context, id);
> >>       }
> >>
> >>       if (supportsNameIdentification(context) &&
> >> makeNameAndIDSame(context))
> >>       {
> >>         renderURIAttribute(context, "name", id);
> >>       }
> >>     }
> >>   }
> >> Are they all Action URLs?
> >>
> >> Thanks.
> >>
> >> John
> >>
> >>
> >> On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
> >> >
> >> > The value of the attribute on "name" on GoLink will end up mapping
> >> > up to "href" on some other link.  So it really is a URI.
> >> > E.g., you need to use % encoding, not & encoding.
> >> > And "id" must equal "name".
> >> >
> >> > -- Adam
> >> >
> >> >
> >> >
> >> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> >> > > In GoLinkRenderer class, there is the following method:
> >> > >
> >> > >   @Override
> >> > >   protected void renderId(
> >> > >     FacesContext context,
> >> > >     UIComponent  component) throws IOException
> >> > >   {
> >> > >     if (shouldRenderId(context, component))
> >> > >     {
> >> > >       String clientId = getClientId(context, component);
> >> > >       // For links, these are actually URI attributes
> >> > >       context.getResponseWriter().writeURIAttribute("id", clientId,
> >> > "id");
> >> > >       context.getResponseWriter().writeURIAttribute("name",
> >> clientId,
> >> > "id");
> >> > >     }
> >> > >   }
> >> > >
> >> > > Why are id and name rendered as URI? Are the id and name used as
> >> URI in
> >> > > javascript logic? I saw some similar code in several other
> >> classes too.
> >> > >
> >> > > Thanks.
> >> > >
> >> > > John Fan
> >> > >
> >> > >
> >> >
> >>
> >>
> >
>
>

Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Scott O'Bryan <da...@gmail.com>.
So they will basically reference bookmarks, correct?

Scott

Adam Winer wrote:
> Neither;  they do not need to be encoded at all, as they
> are only references within a page.
>
> -- Adam
>
>
> On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
>> Adam:
>>
>> I asked the question because I am working on a patch for encoding 
>> URLs in
>> trinidad. I need to know whether to encode the URL as Action URL or 
>> Resource
>> URL.
>>
>> For the following scenarios I guess they should all be encoded as Action
>> URL. But I am not sure. Just want to confirm with you.
>>
>> In HeaderRenderer (in this case only name is rendered and I did not 
>> see id
>> for it):
>>
>>     renderURIAttribute(context, NAME_ATTRIBUTE, label);
>>
>> And in LinkRenderer:
>>
>>   protected void renderID(
>>     UIXRenderingContext context,
>>     UINode           node
>>     ) throws IOException
>>   {
>>     Object id = getID(context, node);
>>
>>     if (id != null)
>>     {
>>       if (supportsID(context))
>>       {
>>         // For links, "name" and thus "id" is a URI attribute.
>>         renderURIID(context, id);
>>       }
>>
>>       if (supportsNameIdentification(context) && 
>> makeNameAndIDSame(context))
>>       {
>>         renderURIAttribute(context, "name", id);
>>       }
>>     }
>>   }
>> Are they all Action URLs?
>>
>> Thanks.
>>
>> John
>>
>>
>> On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
>> >
>> > The value of the attribute on "name" on GoLink will end up mapping
>> > up to "href" on some other link.  So it really is a URI.
>> > E.g., you need to use % encoding, not & encoding.
>> > And "id" must equal "name".
>> >
>> > -- Adam
>> >
>> >
>> >
>> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
>> > > In GoLinkRenderer class, there is the following method:
>> > >
>> > >   @Override
>> > >   protected void renderId(
>> > >     FacesContext context,
>> > >     UIComponent  component) throws IOException
>> > >   {
>> > >     if (shouldRenderId(context, component))
>> > >     {
>> > >       String clientId = getClientId(context, component);
>> > >       // For links, these are actually URI attributes
>> > >       context.getResponseWriter().writeURIAttribute("id", clientId,
>> > "id");
>> > >       context.getResponseWriter().writeURIAttribute("name", 
>> clientId,
>> > "id");
>> > >     }
>> > >   }
>> > >
>> > > Why are id and name rendered as URI? Are the id and name used as 
>> URI in
>> > > javascript logic? I saw some similar code in several other 
>> classes too.
>> > >
>> > > Thanks.
>> > >
>> > > John Fan
>> > >
>> > >
>> >
>>
>>
>


Re: Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Adam Winer <aw...@gmail.com>.
Neither;  they do not need to be encoded at all, as they
are only references within a page.

-- Adam


On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> Adam:
>
> I asked the question because I am working on a patch for encoding URLs in
> trinidad. I need to know whether to encode the URL as Action URL or Resource
> URL.
>
> For the following scenarios I guess they should all be encoded as Action
> URL. But I am not sure. Just want to confirm with you.
>
> In HeaderRenderer (in this case only name is rendered and I did not see id
> for it):
>
>     renderURIAttribute(context, NAME_ATTRIBUTE, label);
>
> And in LinkRenderer:
>
>   protected void renderID(
>     UIXRenderingContext context,
>     UINode           node
>     ) throws IOException
>   {
>     Object id = getID(context, node);
>
>     if (id != null)
>     {
>       if (supportsID(context))
>       {
>         // For links, "name" and thus "id" is a URI attribute.
>         renderURIID(context, id);
>       }
>
>       if (supportsNameIdentification(context) && makeNameAndIDSame(context))
>       {
>         renderURIAttribute(context, "name", id);
>       }
>     }
>   }
> Are they all Action URLs?
>
> Thanks.
>
> John
>
>
> On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
> >
> > The value of the attribute on "name" on GoLink will end up mapping
> > up to "href" on some other link.  So it really is a URI.
> > E.g., you need to use % encoding, not & encoding.
> > And "id" must equal "name".
> >
> > -- Adam
> >
> >
> >
> > On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> > > In GoLinkRenderer class, there is the following method:
> > >
> > >   @Override
> > >   protected void renderId(
> > >     FacesContext context,
> > >     UIComponent  component) throws IOException
> > >   {
> > >     if (shouldRenderId(context, component))
> > >     {
> > >       String clientId = getClientId(context, component);
> > >       // For links, these are actually URI attributes
> > >       context.getResponseWriter().writeURIAttribute("id", clientId,
> > "id");
> > >       context.getResponseWriter().writeURIAttribute("name", clientId,
> > "id");
> > >     }
> > >   }
> > >
> > > Why are id and name rendered as URI? Are the id and name used as URI in
> > > javascript logic? I saw some similar code in several other classes too.
> > >
> > > Thanks.
> > >
> > > John Fan
> > >
> > >
> >
>
>

Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Qiang Fan <jo...@gmail.com>.
Adam:

I asked the question because I am working on a patch for encoding URLs in
trinidad. I need to know whether to encode the URL as Action URL or Resource
URL.

For the following scenarios I guess they should all be encoded as Action
URL. But I am not sure. Just want to confirm with you.

In HeaderRenderer (in this case only name is rendered and I did not see id
for it):

    renderURIAttribute(context, NAME_ATTRIBUTE, label);

And in LinkRenderer:

  protected void renderID(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {
    Object id = getID(context, node);

    if (id != null)
    {
      if (supportsID(context))
      {
        // For links, "name" and thus "id" is a URI attribute.
        renderURIID(context, id);
      }

      if (supportsNameIdentification(context) && makeNameAndIDSame(context))
      {
        renderURIAttribute(context, "name", id);
      }
    }
  }
Are they all Action URLs?

Thanks.

John


On 11/28/06, Adam Winer <aw...@gmail.com> wrote:
>
> The value of the attribute on "name" on GoLink will end up mapping
> up to "href" on some other link.  So it really is a URI.
> E.g., you need to use % encoding, not & encoding.
> And "id" must equal "name".
>
> -- Adam
>
>
>
> On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> > In GoLinkRenderer class, there is the following method:
> >
> >   @Override
> >   protected void renderId(
> >     FacesContext context,
> >     UIComponent  component) throws IOException
> >   {
> >     if (shouldRenderId(context, component))
> >     {
> >       String clientId = getClientId(context, component);
> >       // For links, these are actually URI attributes
> >       context.getResponseWriter().writeURIAttribute("id", clientId,
> "id");
> >       context.getResponseWriter().writeURIAttribute("name", clientId,
> "id");
> >     }
> >   }
> >
> > Why are id and name rendered as URI? Are the id and name used as URI in
> > javascript logic? I saw some similar code in several other classes too.
> >
> > Thanks.
> >
> > John Fan
> >
> >
>

Re: GoLinkRenderer calls writeURIAttribute to render name and id, why?

Posted by Adam Winer <aw...@gmail.com>.
The value of the attribute on "name" on GoLink will end up mapping
up to "href" on some other link.  So it really is a URI.
E.g., you need to use % encoding, not & encoding.
And "id" must equal "name".

-- Adam



On 11/28/06, Qiang Fan <jo...@gmail.com> wrote:
> In GoLinkRenderer class, there is the following method:
>
>   @Override
>   protected void renderId(
>     FacesContext context,
>     UIComponent  component) throws IOException
>   {
>     if (shouldRenderId(context, component))
>     {
>       String clientId = getClientId(context, component);
>       // For links, these are actually URI attributes
>       context.getResponseWriter().writeURIAttribute("id", clientId, "id");
>       context.getResponseWriter().writeURIAttribute("name", clientId, "id");
>     }
>   }
>
> Why are id and name rendered as URI? Are the id and name used as URI in
> javascript logic? I saw some similar code in several other classes too.
>
> Thanks.
>
> John Fan
>
>