What is the prefered way to replace removed HeaderContributors in Wicket 1.5?
The migration guide says:

Wicket 1.4:
public class MyPage extends WebPage {
  public MyPage() {
    add(HeaderContributor.forCss(AbstractCalendar.class,
"assets/skins/sam/calendar.css"));
  }
}

becomes in Wicket 1.5:

public class MyPage extends WebPage {
  public MyPage() {
  }
  public void renderHead(IHeaderResponse response) {
    response.renderCSSReference(new
PackageResourceReference(AbstractCalendar.class,
      "assets/skins/sam/calendar.css"));
  }
}

So I did in my classes.

My working class in Wicket 1.4 looks like:

public class DoctypeTestPage extends WebPage
{
public static final ResourceReference TEST_CSS = new
ResourceReference(DoctypeTestPage.class, "test.css");

        public DoctypeTestPage( final PageParameters parameters )
        {
                super( parameters );
                add(CSSPackageResource.getHeaderContribution( TEST_CSS ) );
                ...
        }
}

The same class in Wicket 1.5 looks like:

public class DoctypeTestPage extends WebPage
{
        public static final ResourceReference TEST_CSS = new
PackageResourceReference(DoctypeTestPage.class, "test.css");

        public DoctypeTestPage( final PageParameters parameters )
        {
                super( parameters );
        }
       @Override
        public void renderHead(final IHeaderResponse response)
        {
                response.renderCSSReference( TEST_CSS );
        }
}

I've noticed with Tamper Data, that with Wicket 1.5 the content type of the
css-Resource is "text/html" instead of  "text/css" with Wicket 1.4!!! This
causes the browser to switch into quirks mode in order to render the request
properly. The used markup header-tag is:

<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>

If I add the following Doctype declaration to the markup file, the browser
would never change into quirks mode, but also the CSS resource is not found
anymore. 

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
< html xmlns="http://www.w3.org/1999/xhtml";  
     
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";  
      xml:lang="en"  
      lang="en">

Do I miss something? Or is this a bug with Wicket 1.5?




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/PackageResourceReference-and-Doctype-in-Markup-file-tp3889467p3889467.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to