You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dirk Forchel <di...@exedio.com> on 2011/10/10 10:02:10 UTC
PackageResourceReference and Doctype in Markup file
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.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< 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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PackageResourceReference and Doctype in Markup file
Posted by Dirk Forchel <di...@exedio.com>.
I've figured out, that this might be a problem with autodetecting the content
type of a FileResourceStream. If our application uses the development mode,
we use our own ResourceStreamLocator for loading resources from the source
path rather than the class path. This was working in Wicket 1.4 without
problems. The used FileResourceStreams returned null as content type.
In the FileResourceStream class you can find this ...
@Override
public String getContentType()
{
// Let ResourceStreamRequestTarget handle content-type automatically
return null;
}
Where in Wicket 1.4 the Response class has an appropriate method to detect
the content type automatically ...
public void detectContentType(RequestCycle requestCycle, String uri)
{
...
}
But in Wicket 1.5. this might be handled in another way. The returned
content type is always unknown for css-files or image files. In addition
with our own WicketFilter implementation, where by default the content type
for all requests handled by this filter is set to "text/html", this results
in the problem described above.
Of course could our own ResourceStreamLocator handle the correct content
type, but the problem with auto-detecting the correct content type for
FileResourceStreams should be fixed anyway.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PackageResourceReference-and-Doctype-in-Markup-file-tp3889467p3890212.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PackageResourceReference and Doctype in Markup file
Posted by Dirk Forchel <di...@exedio.com>.
After creating a quickstart I've noticed that this might not be a bug but
rather a problem with my application settings. I've got no problems with the
quickstart application and the test page running on Jetty. I let you know
what causes the problem.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PackageResourceReference-and-Doctype-in-Markup-file-tp3889467p3889587.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PackageResourceReference and Doctype in Markup file
Posted by Martin Grigorov <mg...@apache.org>.
Looks like a bug.
Please create a quickstart and attach it to ticket in Jira.
Thanks!
On Mon, Oct 10, 2011 at 11:02 AM, Dirk Forchel <di...@exedio.com> wrote:
> 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.
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> < 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org