• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: compacting html, whitespaces
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compacting html, whitespaces


  • Subject: Re: compacting html, whitespaces
  • From: Patrick Middleton <email@hidden>
  • Date: Thu, 21 May 2009 09:52:52 +0100

Back in the WO451 days I overrode Application.handleRequest to do some very simple HTML parsing to remove excess whitespace while remaining aware of comments, <pre> tags and the like. We used it for some years but abandoned it; it ate CPU, and in terms of the time for a request/response cycle to complete all the back to the user's browser, it didn't save any time. It did make for smaller response message bodies though, which was good for applications targeted at mobile devices.

These days if I want smaller response message bodies, I enable mod_gzip. Depends what you're trying to achieve of course.

On 20 May 2009, at 19:08, Hugi Thordarson wrote:

If you're really adventurous, you can try something like this:

	public WOResponse dispatchRequest( WORequest request ) {
		WOResponse response = super.dispatchRequest( request );

		String contentString = response.contentString();
		contentString = contentString.replace( "\n", "" );
		contentString = contentString.replace( "\t", "" );
		response.setContent( contentString );

		return response;
	}

Be careful, though. It will work, but it will mess up stuff in pre- tags and within textareas.

Cheers,
- Hugi



On 20.5.2009, at 16:29, Amedeo Mantica wrote:

Hello,

Anyone knows if there is a Property or something similar in order to get a compact html output with withespaces stripped?

Thanks, Regards
Amedeo

--- Regards Patrick OneStep Solutions (Research) LLP www.onestep.co.uk

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >compacting html, whitespaces (From: Amedeo Mantica <email@hidden>)
 >Re: compacting html, whitespaces (From: Hugi Thordarson <email@hidden>)

  • Prev by Date: Re: Question on fetching theory
  • Next by Date: ERXEC.useSharedEditingContext
  • Previous by thread: Re: compacting html, whitespaces
  • Next by thread: Question on fetching theory
  • Index(es):
    • Date
    • Thread