Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How to Find the size of the AEM page

Avatar

Level 6

Hi Team,

 I have a requirement to find the size of the AEM page. While writing the content if we can able give hint to authors saying that this page size : xxx.  

 Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

during rendering it's normally not possible to determine the size of a page (unless you buffer all output in a request filter and calculate the size there, but that's not a really good idea ...). And it's even harder to determine the size of a page A when you have a page B containing a link to A and you want to add the information about the size of the linked page A.

So I would argue, that you should avoid to implement this, as it adds substantial cost and effort to your application.

Jörg

View solution in original post

8 Replies

Avatar

Level 9

Hi,

if i understand correctly for current loaded page by author you need to provide the size.  it should be easy.  Get the Content-Length from header and covert to kilobytes ( by dividing with 1024).    Please note author & publish will have different size because in author has to inject other edit tags.

Thanks,

Avatar

Level 6

Thanks, @MCstuff that's exactly I am looking for. How Can I get the content-length while loading the AEM page in authoring instance? 

I am able to see the content-length in firefox, not in google chrome. 

 

Thanks In Advance.

Avatar

Correct answer by
Employee Advisor

Hi,

during rendering it's normally not possible to determine the size of a page (unless you buffer all output in a request filter and calculate the size there, but that's not a really good idea ...). And it's even harder to determine the size of a page A when you have a page B containing a link to A and you want to add the information about the size of the linked page A.

So I would argue, that you should avoid to implement this, as it adds substantial cost and effort to your application.

Jörg

Avatar

Level 6

Humm, I will agree but we need to upload pages/articles to AWS cloud. AWS cloud allows only certain limit for uploading recently we found out that few pages/articles were too big in size to upload to AWS. We have around 70000 pages in the repository we need to find how many existing pages/articles crossed that size and for the new once we are just planning to alert the authors whenever it reaches that limit while authoring. Is there any way I can do get the size easily?

Thanks

Avatar

Level 9

You are right @dragon2A chrome does not provide it[1].    Anyway to read the value need to use Header.  

@Jorg,    Why do you need to add the size of linked page?  The question in thread is size of the page & linked does not make sense since when they upload aws they will upload current page & not linked pages.    Unless I misunderstood & you agree , Possible option is have response wrapper & calculate the size.     

[1]  https://developer.chrome.com/extensions/webRequest

Avatar

Employee Advisor

I just assumed that the requirement was to print the size of a page next to the link to this page :-

Avatar

Employee Advisor

Hi,

dragon2A wrote...

Humm, I will agree but we need to upload pages/articles to AWS cloud. AWS cloud allows only certain limit for uploading recently we found out that few pages/articles were too big in size to upload to AWS. We have around 70000 pages in the repository we need to find how many existing pages/articles crossed that size and for the new once we are just planning to alert the authors whenever it reaches that limit while authoring. Is there any way I can do get the size easily?

Thanks

 


I wonder what kind of limit you are hitting regarding the size of the pages. Can you elaborate on it? I don't think that the problem is the size of a page (I rarely see pages larger than 100kb, but that shouldn't be a limit on any AWS service), but rather a problem of either using the wrong service or a programming error in your connection to AWS.

Jörg

Avatar

Level 6

Hi Jorg,

You are right there is no limitation in AEM but our requirement little bit different.

  As I said we need to upload pages/documents to AWS cloud which has limitation it allows the only 1MB for single document and 5Mb for the batch documents.  Right now in the repository, we have identified couple pages crossed this size. We wanted to find all in one shot , then authors can split those pages in 2 and to avoid that to new pages we are planning to alert the authors.

Thanks