Hi, Eelco,

Well... looking at the other filters, the key to this is getting the
ContainerInfo from the Markup, since ContainerInfo has a getLocale()
method.

The best example of this is WicketMessageTagHandler, whose constructor
requires the ContainerInfo in its constructor:

  public WicketMessageTagHandler(final ContainerInfo containerInfo)


The WicketMessageTagHandler is instantiated in
MarkupParser.initializeMarkupFilters():

  final MarkupResourceStream resource = markup.getResource();
  if (resource != null)
  {  
      final ContainerInfo containerInfo = resource.getContainerInfo();
      if (containerInfo != null)
      {
          if (WicketMessageTagHandler.enable)
          {
              appendMarkupFilter(new
WicketMessageTagHandler(containerInfo));
          }
          ....
      }
      ....
  }


If I could also inject this into the constructor of my filter, I'd be
set!


This could be possible if we changed

protected void initFilterChain()
{
}

to

protected void initFilterChain(ContainerInfo containerInfo)
{
}


(or if we added in that method to the api)


That way, I'd just need to sublcass MarkupParser.


wdyt?




On Sat, 2007-09-01 at 12:56 -0700, Eelco Hillenius wrote:
> On 8/30/07, David Leangen <[EMAIL PROTECTED]> wrote:
> >
> > Ok, thanks!
> >
> > I've been looking for a way to somehow attach a Session to this filter,
> > but can't see one.
> >
> > Essentially, I am trying to grab certain tags (such as <p>) and add the
> > attribute lang="en" (or whatever, according to the current locale).
> >
> > Tried looking at the Page component, too, but didn't see any nice way of
> > doing this.
> 
> Take a look at how other markup filters are implemented to get some
> inspiration. I think you should be able to do it by inserting auto
> tags when you recognize tags you want to modify at runtime. You might
> even make something neatly reusable out of it (a similar construct
> like <wicket:link> maybe?). Keep us informed.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to