https://issues.apache.org/jira/browse/WICKET-2412

wow, now we all can be happy together ;-)

mf

2009/8/3 Igor Vaynberg <igor.vaynb...@gmail.com>

> yep, now if you would only attach it to a jira issue and check that
> "attachment is ASL licensed" check box we will be happy to roll it in
> :)
>
> -igor
>
> On Mon, Aug 3, 2009 at 8:58 AM, Martin Funk<mafulaf...@googlemail.com>
> wrote:
> > like this?
> >
> > ~/dev/sandbox/wicket-trunk$ jsvn diff
> > Index: wicket/src/main/java/org/apache/wicket/Application.java
> > ===================================================================
> > --- wicket/src/main/java/org/apache/wicket/Application.java    (revision
> > 800428)
> > +++ wicket/src/main/java/org/apache/wicket/Application.java    (working
> > copy)
> > @@ -33,6 +33,7 @@
> >  import org.apache.wicket.application.IComponentOnBeforeRenderListener;
> >  import org.apache.wicket.javascript.DefaultJavascriptCompressor;
> >  import org.apache.wicket.markup.IMarkupCache;
> > +import org.apache.wicket.markup.html.EmptySrcAttributeFilter;
> >  import org.apache.wicket.markup.html.IHeaderContributor;
> >  import org.apache.wicket.markup.html.IHeaderResponse;
> >  import
> >
> org.apache.wicket.markup.html.image.resource.DefaultButtonImageResourceFactory;
> > @@ -348,6 +349,8 @@
> >             getDebugSettings().setDevelopmentUtilitiesEnabled(true);
> >             //
> getDebugSettings().setOutputMarkupContainerClassName(true);
> >             getResourceSettings().setJavascriptCompressor(null);
> > +            getRequestCycleSettings().addResponseFilter(
> > +                EmptySrcAttributeFilter.LOG_EMPTY_SRC_ATTRIBUTE);
> >         }
> >         else if (DEPLOYMENT.equalsIgnoreCase(configurationType))
> >         {
> > Index:
> >
> wicket/src/main/java/org/apache/wicket/markup/html/EmptySrcAttributeFilter.java
> > ===================================================================
> > ---
> >
> wicket/src/main/java/org/apache/wicket/markup/html/EmptySrcAttributeFilter.java
> > (revision 0)
> > +++
> >
> wicket/src/main/java/org/apache/wicket/markup/html/EmptySrcAttributeFilter.java
> > (revision 0)
> > @@ -0,0 +1,50 @@
> > +/*
> > + * Licensed to the Apache Software Foundation (ASF) under one or more
> > + * contributor license agreements.  See the NOTICE file distributed with
> > + * this work for additional information regarding copyright ownership.
> > + * The ASF licenses this file to You under the Apache License, Version
> 2.0
> > + * (the "License"); you may not use this file except in compliance with
> > + * the License.  You may obtain a copy of the License at
> > + *
> > + *      http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing, software
> > + * distributed under the License is distributed on an "AS IS" BASIS,
> > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> > + * See the License for the specific language governing permissions and
> > + * limitations under the License.
> > + */
> > +package org.apache.wicket.markup.html;
> > +
> > +import org.apache.wicket.IResponseFilter;
> > +import org.apache.wicket.util.string.AppendingStringBuffer;
> > +import org.slf4j.Logger;
> > +import org.slf4j.LoggerFactory;
> > +
> > +
> > +public class EmptySrcAttributeFilter implements IResponseFilter
> > +{
> > +    private static final Logger log =
> > LoggerFactory.getLogger(EmptySrcAttributeFilter.class);
> > +
> > +    /**
> > +     * Indicates that an exception page appropriate to development
> should
> > be shown when an
> > +     * unexpected exception is thrown.
> > +     */
> > +    public static final EmptySrcAttributeFilter LOG_EMPTY_SRC_ATTRIBUTE
> =
> > new EmptySrcAttributeFilter();
> > +
> > +    /**
> > +     * @see
> org.apache.wicket.IResponseFilter#filter(AppendingStringBuffer)
> > +     */
> > +    public AppendingStringBuffer filter(AppendingStringBuffer
> > responseBuffer)
> > +    {
> > +        int emptySrcIndex = responseBuffer.indexOf("src=\"\"");
> > +        if (emptySrcIndex != -1)
> > +        {
> > +            log.warn("Empty src attribute found in response:");
> > +            int from = Math.max(0, emptySrcIndex - 10);
> > +            int to = Math.min(emptySrcIndex + 10,
> responseBuffer.length());
> > +            log.warn(responseBuffer.substring(from, to));
> > +        }
> > +        return responseBuffer;
> > +    }
> > +}
> > \ No newline at end of file
> >
> >
> > 2009/8/3 Igor Vaynberg <igor.vaynb...@gmail.com>
> >
> >> it should be possible to create an IResponseFilter that checks for
> >> this and reports the error in dev mode.
> >>
> >> -igor
> >>
> >> On Mon, Aug 3, 2009 at 8:00 AM, Martin Funk<mafulaf...@googlemail.com>
> >> wrote:
> >> > I know its been talked about before
> >> >
> >>
> http://cwiki.apache.org/WICKET/best-practices-and-gotchas.html#BestPracticesandGotchas-Gotchas
> >> >
> >> > Just had to restate it, make myself remember.
> >> >
> >> > mf
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to