You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by dayanand <da...@citiustech.com> on 2013/12/30 16:22:29 UTC
Compression in karaf
Hi,
I m new to apache karaf, I wanted to enable the gzip compression at jetty
web server level in karaf.
My application doesn't have web.xml
Please suggest, how to acheive compression
--
View this message in context: http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: Compression in karaf
Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,
you'll find plenty of samples at the Pax-Web GitHub project. [1]
If you want to use the HttpService as you've done before, you'll just need
to register a compression filter as I've send you before. [2]
You'll find a sample on how to register filters with Pax-Web at [3].
Another way of using filters is to use a WAB [4]. There you need to
register your compression filter also, as JB mentioned first.
There is nothing directly to be configured for Jetty.
regards, Achim
[1] - https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples
[2] - http://www.eclipse.org/jetty/documentation/current/gzip-filter.html
[3] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/Activator.java#L101
[4] -
https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples/war-spring-osgi
2014/1/3 dayanand <da...@citiustech.com>
> Hi All,
>
> Please reply ..... I m really in need
>
> Thanks in Advance
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841p4030897.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>
--
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>
Re: Compression in karaf
Posted by mikl <el...@gmail.com>.
Hello can you find a solution i am also searching (i want to enable the
configuration for the global server not for individual webapp).
--
View this message in context: http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841p4049926.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: Compression in karaf
Posted by dayanand <da...@citiustech.com>.
Hi All,
Please reply ..... I m really in need
Thanks in Advance
--
View this message in context: http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841p4030897.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: Compression in karaf
Posted by dayanand <da...@citiustech.com>.
I created 'jetty-web.xml' and 'webdefault.xml' in dsp-k-1.5.0\etc folder
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="defaultsDescriptor">webdefault.xml</Set>
</Configure>
and 'webdefault.xml'
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
<init-param>
<param-name>mimeTypes</param-name>
<param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,application/json,image/svg+xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Add entry in org.ops4j.pax.web.cfg file
org.ops4j.pax.web.config.file=./etc/jetty-web.xml
still it is not working,, can you please provide me an simple example
talking about gzip compression in karaf
--
View this message in context: http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841p4030872.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: Compression in karaf
Posted by Achim Nierbeck <bc...@googlemail.com>.
I checked the Jetty documentation, it's quite simple to support gzip
compression,
you just need a filter for it. So add a filter to your Application
according to the documentation of jetty [1].
regards, Achim
[1] - http://www.eclipse.org/jetty/documentation/current/gzip-filter.html
2013/12/31 dayanand <da...@citiustech.com>
> Hi,
>
> Can you please give an example how to add rule to jetty.xml.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841p4030851.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>
--
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>
Re: Compression in karaf
Posted by dayanand <da...@citiustech.com>.
Hi,
Can you please give an example how to add rule to jetty.xml.
Thanks
--
View this message in context: http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841p4030851.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: Compression in karaf
Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,
You might try to add a general rule to the jetty.xml. Or move your project
into a wab project.
Regards achim
sent from mobile device
Am 31.12.2013 13:19 schrieb "dayanand" <da...@citiustech.com>:
> Hi JB,
>
> Thank you for your reply.
>
> My application doesn't have web.xml, then where do i put these lines
>
> Is there any other way ?
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841p4030843.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>
Re: Compression in karaf
Posted by dayanand <da...@citiustech.com>.
Hi JB,
Thank you for your reply.
My application doesn't have web.xml, then where do i put these lines
Is there any other way ?
--
View this message in context: http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841p4030843.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: Compression in karaf
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,
You have to use the GzipFilter.
You have to provide a web.xml including something like:
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
<init-param>
<param-name>mimeTypes</param-name>
<param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,image/svg+xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Regards
JB
On 12/30/2013 04:22 PM, dayanand wrote:
> Hi,
>
> I m new to apache karaf, I wanted to enable the gzip compression at jetty
> web server level in karaf.
>
> My application doesn't have web.xml
>
> Please suggest, how to acheive compression
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Compression-in-karaf-tp4030841.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com