<p>In a server-side application running on Tomcat, I am generating full HTML pages (with header) based on random user-requested sites pulled down from the Internet. The client-side application uses asynchronous callbacks for requesting processing of a particular web page. Since processing can take a while, I want to inform the user about progress via polling, hence the callbacks.</p>

<p>On server-side, after the web page is retrieved, it is processed and an "enhanced" version is created. Then this version has to go back to the user.
Displaying the page as part of the page of the client-side application is not an option.</p>

<p>Currently, the server generates a temporary file and sends back a link to it. This is clearly suboptimal.</p>

<p>The next best solution I can come up with inolves creating a caching-DB that stores  the  HTML content together with its md5-sums or sha1-ids and then sends back a link to a servlet, with the hash-ID as an argument. The servlet then requests the site from the caching-DB.</p>

<p>Is there any better solution? If not, which DB-backend would you propose? I'm thinking of SQLite. Part of the problem to be solved is: how do I push a page <code>&lt;html&gt;</code> to <code>&lt;/html&gt;</code> back to client side?</p>

[{'answer_id': 81465, 'author': 'Matthias Kestenholz', 'author_id': 317346, 'author_profile': 'https://Stackoverflow.com/users/317346', 'pm_score': 5, 'selected': False, 'text': '<p>One has exactly space for 11 bytes, the other for exactly 11 characters. Some charsets such as Unicode variants may use more than one byte per char, therefore the 11 byte field might have space for less than 11 chars depending on the encoding.</p>\n\n<p>See also <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="noreferrer">http://www.joelonsoftware.com/articles/Unicode.html</a></p>\n'}, {'answer_id': 81469, 'author': 'Seldaek', 'author_id': 6512, 'author_profile': 'https://Stackoverflow.com/users/6512', 'pm_score': 2, 'selected': False, 'text': '<p>I am not sure since I am not an Oracle user, but I assume that the difference lies when you use multi-byte character sets such as Unicode (UTF-16/32). In this case, 11 Bytes could account for less than 11 characters.</p>\n\n<p>Also those field types might be treated differently in regard to accented characters or case, for example \'binaryField(ete) = "été"\' will not match while \'charField(ete) = "été"\' might (again not sure about Oracle).</p>\n'}, {'answer_id': 81492, 'author': 'David Sykes', 'author_id': 3154, 'author_profile': 'https://Stackoverflow.com/users/3154', 'pm_score': 9, 'selected': True, 'text': '<p>Let us assume the database character set is UTF-8, which is the recommended setting in recent versions of Oracle. In this case, some characters take more than 1 byte to store in the database.</p>\n\n<p>If you define the field as <code>VARCHAR2(11 BYTE)</code>, Oracle can use up to 11 bytes for storage, but you may not actually be able to store 11 characters in the field, because some of them take more than one byte to store, e.g. non-English characters.</p>\n\n<p>By defining the field as <code>VARCHAR2(11 CHAR)</code> you tell Oracle it can use enough space to store 11 characters, no matter how many bytes it takes to store each one. A single character may require up to 4 bytes.</p>\n'}, {'answer_id': 81714, 'author': 'user15453', 'author_id': 15453, 'author_profile': 'https://Stackoverflow.com/users/15453', 'pm_score': 4, 'selected': False, 'text': '<p>Depending on the system configuration, size of CHAR mesured in BYTES can vary. In your examples:</p>\n\n<ol>\n<li>Limits field to 11 <b>BYTE</b></li>\n<li>Limits field to 11 <b>CHAR</b>acters</li>\n</ol>\n\n<p><hr/>\nConclusion: 1 CHAR is not equal to 1 BYTE.<br/><br/></p>\n'}, {'answer_id': 67398489, 'author': 'Aman Singh Rajpoot', 'author_id': 12937828, 'author_profile': 'https://Stackoverflow.com/users/12937828', 'pm_score': 1, 'selected': False, 'text': '<p>In simple words when you write <code>NAME VARCHAR2(11 BYTE)</code> then only 11 Byte can be accommodated in that variable.</p>\n<p>No matter which characters set you are using, for example, if you are using Unicode (UTF-16) then only half of the size of Name can be accommodated in <code>NAME</code>.</p>\n<p>On the other hand, if you write  <code>NAME VARCHAR2(11 CHAR)</code> then <code>NAME</code> can accommodate 11 CHAR regardless of their character encoding.</p>\n<p><code>BYTE</code> is the default if you do not specify <code>BYTE</code> or <code>CHAR</code></p>\n<p>So if you write <code>NAME VARCHAR2(4000 BYTE)</code> and use Unicode(UTF-16) character encoding then only 2000 characters can be accommodated in <code>NAME</code></p>\n<p>That means the size limit on the variable is applied in <code>BYTES</code> and it depends on the character encoding that how many characters can be accommodated in that vraible.</p>\n'}]
['https://Stackoverflow.com/questions/81449', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11797/']