Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Servlet or filter or something to remove whitespace? (http://www.velocityreviews.com/forums/t134204-servlet-or-filter-or-something-to-remove-whitespace.html)

Ryan Stewart 06-09-2004 12:24 AM

Servlet or filter or something to remove whitespace?
 
I didn't really mean to make two posts so close together, but I just thought
of something I was considering at work today. I'm building a web application
which has some potentially very large generated pages. One JSP in particular
I've been working on can generate HTML over 1M in size. Due to the taglibs
and indentation and so on, a *lot* of this is just whitespace. Does anyone
know of a servlet or filter (or Struts plug-in, as that's what we're using)
that would remove or compress the extra whitespace? I plan on trying to
write something, but we're on a tight deadline atm, so it'll have to wait a
while.



Real Gagnon 06-09-2004 12:49 AM

Re: Servlet or filter or something to remove whitespace?
 
> is just whitespace. Does anyone know of a servlet or filter (or Struts
> plug-in, as that's what we're using) that would remove or compress the
> extra whitespace? I plan on trying to write something, but we're on a
> tight deadline atm, so it'll have to wait a while.


See Trim Filter ver. 1.5, at
http://www.servletsuite.com/servlets/trimflt.htm

you may also consider "the Compress Filter ver. 1.3"
http://www.servletsuite.com/servlets/gzipflt.htm

Bye.
--
Real Gagnon from Quebec, Canada
* Looking for Java or PB snippets ? Visit Real's How-to
* http://www.rgagnon.com/howto.html

Andrew Thompson 06-09-2004 01:09 AM

Re: Servlet or filter or something to remove whitespace?
 
On Tue, 8 Jun 2004 19:24:15 -0500, Ryan Stewart wrote:

> One JSP in particular
> I've been working on can generate HTML over 1M in size. Due to the taglibs
> and indentation and so on, a *lot* of this is just whitespace.


Could this be a job for..
res.setHeader("Content-Encoding", "gzip")
res.setHeader("Content-Encoding", "x-compress")
res.setHeader("Content-Encoding", "compress")
?

[ OK, that is from my servlet
book, but be lateral.. ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Roedy Green 06-09-2004 01:37 AM

Re: Servlet or filter or something to remove whitespace?
 
On Wed, 09 Jun 2004 01:09:03 GMT, Andrew Thompson
<SeeMySites@www.invalid> wrote or quoted :

>> I've been working on can generate HTML over 1M in size. Due to the taglibs
>> and indentation and so on, a *lot* of this is just whitespace.


you might want to use Compactor logic on it to remove excess
whitespace.

Look at the html on my website to see the result.

That works even if the browser does not support gzip.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Liz 06-09-2004 02:49 AM

Re: Servlet or filter or something to remove whitespace?
 

"Ryan Stewart" <zzanNOtozz@gSPAMo.com> wrote in message
news:0dGdnW7FudExxVvdRVn-ug@texas.net...
> I didn't really mean to make two posts so close together, but I just

thought
> of something I was considering at work today. I'm building a web

application
> which has some potentially very large generated pages. One JSP in

particular
> I've been working on can generate HTML over 1M in size. Due to the taglibs
> and indentation and so on, a *lot* of this is just whitespace. Does anyone
> know of a servlet or filter (or Struts plug-in, as that's what we're

using)
> that would remove or compress the extra whitespace? I plan on trying to
> write something, but we're on a tight deadline atm, so it'll have to wait

a
> while.
>

Since you are on a tight deadline it would be wasting your time to make this
improvement now. Most links can handle the size easily and most of the
slower
ones like 56KB/s have compression built into the modem or ppp protocol. So
keep your eyes on the main job for now.



Ryan Stewart 06-09-2004 03:22 AM

Re: Servlet or filter or something to remove whitespace?
 
"Roedy Green" <look-on@mindprod.com.invalid> wrote in message
news:gcqcc0d1e4g24le5s2ink5vdt7jrc3b4p9@4ax.com...
> On Wed, 09 Jun 2004 01:09:03 GMT, Andrew Thompson
> <SeeMySites@www.invalid> wrote or quoted :
>
> >> I've been working on can generate HTML over 1M in size. Due to the

taglibs
> >> and indentation and so on, a *lot* of this is just whitespace.

>
> you might want to use Compactor logic on it to remove excess
> whitespace.
>
> Look at the html on my website to see the result.
>
> That works even if the browser does not support gzip.
>

Yes, something like that is what I would like. It'd be nice if you could get
rid of the cr/lf's as well. What is this "Compactor logic"?



Roedy Green 06-09-2004 05:31 AM

Re: Servlet or filter or something to remove whitespace?
 
On Tue, 8 Jun 2004 22:22:06 -0500, "Ryan Stewart"
<zzanNOtozz@gSPAMo.com> wrote or quoted :

>Yes, something like that is what I would like. It'd be nice if you could get
>rid of the cr/lf's as well. What is this "Compactor logic"?


See http://mindprod.com/projects/htmlcompactor.html
It collapses CrLf to Lf and gets rid of lead/trail space on each line.
You can take out more than that without changing how it renders.

I have implemented the part of the project that does not require a
browser plugin.

I have not released the code publicly yet. It needs some
documentation and a little polishing. It works fine. I have been
using it in production over a year without incident.

I'd be willing to give it to you on an asis basis, which would
probably prompt me to prepare it for its public debut.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Liz 06-09-2004 05:57 AM

Re: Servlet or filter or something to remove whitespace?
 
>
> I have not released the code publicly yet. It needs some
> documentation and a little polishing. It works fine. I have been
> using it in production over a year without incident.
>

How can you have something in production that is not documented?????

BTW: is this bottom post format ok?



Roedy Green 06-09-2004 09:32 AM

Re: Servlet or filter or something to remove whitespace?
 
On Wed, 09 Jun 2004 05:57:05 GMT, "Liz" <Liz@nospam.com> wrote or
quoted :

>How can you have something in production that is not documented?????


To be published, I need to package it with end-user level
documentation. For my own use the JavaDoc suffices plus the project
description.

It is also a matter of bundling up zips with all the relevant source
code.

There is also the matter of separating out code that is not of general
interest.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Liz 06-09-2004 09:16 PM

Re: Servlet or filter or something to remove whitespace?
 

"Roedy Green" <look-on@mindprod.com.invalid> wrote in message
news:p5mdc0hc10im0182vftf0kmtjv2eic54i0@4ax.com...
> On Wed, 09 Jun 2004 05:57:05 GMT, "Liz" <Liz@nospam.com> wrote or
> quoted :
>
> >How can you have something in production that is not documented?????

>
> To be published, I need to package it with end-user level
> documentation. For my own use the JavaDoc suffices plus the project
> description.
>
> It is also a matter of bundling up zips with all the relevant source
> code.
>
> There is also the matter of separating out code that is not of general
> interest.
>
> --

So it is not in production, just developer test.




All times are GMT. The time now is 06:34 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.