[ 
https://jira.codehaus.org/browse/MRM-1830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=344984#comment-344984
 ] 

Matt Magoffin commented on MRM-1830:
------------------------------------

I was able to work around the issue by replacing the XML above with the 
following:

{code:xml}
    <!-- Note: Don't filter /* because we don't want /repository/* to include
    charset on binary content. -->
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/js/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/feeds/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/restServices/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>*.html</url-pattern>
  </filter-mapping>
{code}

The idea was to say "filter all paths *except* {{/repository/*}}, but without a 
custom filter it is hard to do that in web.xml... thus this might not apply the 
filter as expected in all situations.

> Charset applied to binary repository HTTP responses
> ---------------------------------------------------
>
>                 Key: MRM-1830
>                 URL: https://jira.codehaus.org/browse/MRM-1830
>             Project: Archiva
>          Issue Type: Bug
>    Affects Versions: 2.0.1
>            Reporter: Matt Magoffin
>            Priority: Minor
>
> I am trying to set up a Karaf Cave proxy of an Archiva repository filled with 
> OSGi bundles, and noticed that Cave would not find any OSGi bundles after 
> scanning the repository (e.g. by traversing the URLs under the */repository/* 
> path). When investigating why, I noticed that Archiva sends in the HTTP 
> response Content-Type header
> {noformat}
> Content-Type: application/java-archive;charset=UTF-8
> {noformat}
> The {{;charset=UTF-8}} caught me eye, and then I looked in Cave's source and 
> noticed it performs a full string comparison, looking for just 
> {{application/java-archive}}. I thought perhaps the error was more on the 
> Archiva side, as sending the charset for the binary payload seems incorrect.
> To be clear, I expected to see the following header:
> {noformat}
> Content-Type: application/java-archive
> {noformat}
> Looking in Archiva's *apps/archiva/WEB-INF/web.xml* I saw why the charset 
> parameter was provided:
> {noformat}
>   <filter-mapping>
>     <filter-name>encodingFilter</filter-name>
>     <url-pattern>/*</url-pattern>
>   </filter-mapping>
> {noformat}
> That filter forcibly applies the charset parameter to all responses.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to