Return-Path: X-Original-To: apmail-wicket-users-archive@minotaur.apache.org Delivered-To: apmail-wicket-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A063B10B6B for ; Tue, 30 Jul 2013 17:07:39 +0000 (UTC) Received: (qmail 66412 invoked by uid 500); 30 Jul 2013 17:07:38 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 66020 invoked by uid 500); 30 Jul 2013 17:07:38 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Received: (qmail 66011 invoked by uid 99); 30 Jul 2013 17:07:37 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jul 2013 17:07:37 +0000 Received: from localhost (HELO mail-wi0-f181.google.com) (127.0.0.1) (smtp-auth username mgrigorov, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jul 2013 17:07:37 +0000 Received: by mail-wi0-f181.google.com with SMTP id en1so4545723wid.8 for ; Tue, 30 Jul 2013 10:07:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=wqXBtBapMvnxz3jLURN0sJDjOqt5GxQwowayUaf+rig=; b=JQDyP9GNrLCioKt/qm3HGny4DjtA42SDuCrkSLYWj9nod22dT6V8RZDAhCMkNNldk1 5ZFD1E7BmQLE+2nFrBmPmCGah3ZSpbnLvPyyyZIi3ixBKjNfa4IBgq1tHIQ3QdBmkF5S xrc3+5Wbc4tRvFM0ZBz0KytZSxa044EFRAwKn4NXX98zoLImoLbeKm+5tLR5Ogz/Ji0z xRQ1n9b2hHv3CqaWwBaS+JQKLoL9Y8OceOoReIMCm38HiJbHqlmHhDyQcdh1oenBfsnW Rlrpgf+HRnZOvAxKdiqADKuNH9G9yLjGRFGS3stwxFbL+o2kwSuXx0zk93Ac/l9ZG3ix UgPA== X-Received: by 10.180.80.198 with SMTP id t6mr1610090wix.61.1375204055895; Tue, 30 Jul 2013 10:07:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.3.141 with HTTP; Tue, 30 Jul 2013 10:06:55 -0700 (PDT) In-Reply-To: <29C80C91-4618-4E96-991F-998D571957AA@biologos.org> References: <29C80C91-4618-4E96-991F-998D571957AA@biologos.org> From: Martin Grigorov Date: Tue, 30 Jul 2013 19:06:55 +0200 Message-ID: Subject: Re: SVG mime-type incorrect To: "users@wicket.apache.org" Content-Type: multipart/alternative; boundary=f46d044287ee3ed71d04e2bda5f4 --f46d044287ee3ed71d04e2bda5f4 Content-Type: text/plain; charset=UTF-8 Hi, You can override org.apache.wicket.Application#getMimeType On Tue, Jul 30, 2013 at 7:01 PM, Chris Snyder wrote: > I'm trying to serve SVG images as package resources. However, when I do > so, the image files are served with a mime-type of application/xml, rather > than the correct image/svg+xml. This causes strange behavior in Google > Chrome - the image displays as a broken link when included in an > tag, but renders fine when the image URL is opened directly. If the > resource is served from the main webapp directory rather than as a package > resource, the correct mime-type is sent and Chrome displays the image > properly. > > Delving into the code, it appears that the problem is Java's > URLConnection.guessContentTypeFromStream() method, which doesn't support > SVG files. I've verified this problem on both the Apple-supplied Java 1.6 > and the official Oracle Java 1.7, both on MacOS X. > > What would be the best way to work around this issue? I tried creating my > own custom PackageResource wrapper, which had its own PackageResourceStream > wrapper, but it quickly got unwieldy (as well as being a nightmare for > future maintainability). > > My goal is to have a subclass of Image that returns either a reference to > an SVG or a PNG depending on the browser version. I first noticed the > mime-type problem with my subclass, but I verified that it also exists when > using the standard Image class. > > Thanks in advance for your help! > -Chris Snyder > -- > Chris Snyder > Web Developer, BioLogos > 616.328.5208 x203 > biologos.org > > --f46d044287ee3ed71d04e2bda5f4--