PrimeFaces ExternalContext responsewriter concrete type
I'm looking at a csv export from a java app using JBoss and PrimeFaces. The export is a straight call from the datatable on the web page to the PrimeFaces DataExporter and CSVExporter implementation. I can follow it all through reasonably enough but it begins by getting the writer type from the external context of the PrimeFaces context
public void export(FacesContext context,...
ExternalContext externalContext = context.getExternalContext();
configureResponse(externalContext, filename, encodingType);
Writer writer = externalContext.getResponseOutputWriter();
...
else {
exportAll(context, table, writer);
}
...
writer.flush();
writer.close();
}
I was wondering how I can find the concrete class of the writer ?
My end game in this is just to understand whether the export is all held in Heap Memory until the export is finished, which I suspect it is or whether there is some background process which might be letting it go ?
So I'm assuming the flush at the end means that the file is not written until the end but I was just interested by the fact it is doing a line by line call to a cast to PrintWriter
protected void exportAll(FacesContext context, DataTable table, Object document) {
for(int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
exportRow(table, document, rowIndex);
}
}
}
protected void exportRow(DataTable table, Object document, int rowIndex) {
table.setRowIndex(rowIndex);
...
exportCells(table, document);
...
}
@Override
protected void exportCells(DataTable table, Object document) {
PrintWriter writer = (PrintWriter) document;
for (UIColumn col : table.getColumns()) {
'write cell (no flush) }
}
}
There are many reports of people having issues with Excel but none with csv. Is this just because the csv process is so much less resource hungry or because I'm misreading it and actually the memory is flushed between each line write ?
primefaces export-to-csv
add a comment |
I'm looking at a csv export from a java app using JBoss and PrimeFaces. The export is a straight call from the datatable on the web page to the PrimeFaces DataExporter and CSVExporter implementation. I can follow it all through reasonably enough but it begins by getting the writer type from the external context of the PrimeFaces context
public void export(FacesContext context,...
ExternalContext externalContext = context.getExternalContext();
configureResponse(externalContext, filename, encodingType);
Writer writer = externalContext.getResponseOutputWriter();
...
else {
exportAll(context, table, writer);
}
...
writer.flush();
writer.close();
}
I was wondering how I can find the concrete class of the writer ?
My end game in this is just to understand whether the export is all held in Heap Memory until the export is finished, which I suspect it is or whether there is some background process which might be letting it go ?
So I'm assuming the flush at the end means that the file is not written until the end but I was just interested by the fact it is doing a line by line call to a cast to PrintWriter
protected void exportAll(FacesContext context, DataTable table, Object document) {
for(int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
exportRow(table, document, rowIndex);
}
}
}
protected void exportRow(DataTable table, Object document, int rowIndex) {
table.setRowIndex(rowIndex);
...
exportCells(table, document);
...
}
@Override
protected void exportCells(DataTable table, Object document) {
PrintWriter writer = (PrintWriter) document;
for (UIColumn col : table.getColumns()) {
'write cell (no flush) }
}
}
There are many reports of people having issues with Excel but none with csv. Is this just because the csv process is so much less resource hungry or because I'm misreading it and actually the memory is flushed between each line write ?
primefaces export-to-csv
1
Why don't you set a breakpoint and run in debug? According to the docs if used on a servlet engine (99,99999% of the time) it must returnServletResponse.getWriter()
and please add references to 'here are many reports of people having issues with Excel but none with csv. ' And yes, csv is less hungry, but for excel you can use 'streaming' so it totally depends on how the excel is generated
– Kukeltje
Nov 26 '18 at 15:35
I answered this here: stackoverflow.com/questions/51741023/… Please upvote if it fixes your issue.
– Melloware
Nov 27 '18 at 12:11
add a comment |
I'm looking at a csv export from a java app using JBoss and PrimeFaces. The export is a straight call from the datatable on the web page to the PrimeFaces DataExporter and CSVExporter implementation. I can follow it all through reasonably enough but it begins by getting the writer type from the external context of the PrimeFaces context
public void export(FacesContext context,...
ExternalContext externalContext = context.getExternalContext();
configureResponse(externalContext, filename, encodingType);
Writer writer = externalContext.getResponseOutputWriter();
...
else {
exportAll(context, table, writer);
}
...
writer.flush();
writer.close();
}
I was wondering how I can find the concrete class of the writer ?
My end game in this is just to understand whether the export is all held in Heap Memory until the export is finished, which I suspect it is or whether there is some background process which might be letting it go ?
So I'm assuming the flush at the end means that the file is not written until the end but I was just interested by the fact it is doing a line by line call to a cast to PrintWriter
protected void exportAll(FacesContext context, DataTable table, Object document) {
for(int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
exportRow(table, document, rowIndex);
}
}
}
protected void exportRow(DataTable table, Object document, int rowIndex) {
table.setRowIndex(rowIndex);
...
exportCells(table, document);
...
}
@Override
protected void exportCells(DataTable table, Object document) {
PrintWriter writer = (PrintWriter) document;
for (UIColumn col : table.getColumns()) {
'write cell (no flush) }
}
}
There are many reports of people having issues with Excel but none with csv. Is this just because the csv process is so much less resource hungry or because I'm misreading it and actually the memory is flushed between each line write ?
primefaces export-to-csv
I'm looking at a csv export from a java app using JBoss and PrimeFaces. The export is a straight call from the datatable on the web page to the PrimeFaces DataExporter and CSVExporter implementation. I can follow it all through reasonably enough but it begins by getting the writer type from the external context of the PrimeFaces context
public void export(FacesContext context,...
ExternalContext externalContext = context.getExternalContext();
configureResponse(externalContext, filename, encodingType);
Writer writer = externalContext.getResponseOutputWriter();
...
else {
exportAll(context, table, writer);
}
...
writer.flush();
writer.close();
}
I was wondering how I can find the concrete class of the writer ?
My end game in this is just to understand whether the export is all held in Heap Memory until the export is finished, which I suspect it is or whether there is some background process which might be letting it go ?
So I'm assuming the flush at the end means that the file is not written until the end but I was just interested by the fact it is doing a line by line call to a cast to PrintWriter
protected void exportAll(FacesContext context, DataTable table, Object document) {
for(int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
exportRow(table, document, rowIndex);
}
}
}
protected void exportRow(DataTable table, Object document, int rowIndex) {
table.setRowIndex(rowIndex);
...
exportCells(table, document);
...
}
@Override
protected void exportCells(DataTable table, Object document) {
PrintWriter writer = (PrintWriter) document;
for (UIColumn col : table.getColumns()) {
'write cell (no flush) }
}
}
There are many reports of people having issues with Excel but none with csv. Is this just because the csv process is so much less resource hungry or because I'm misreading it and actually the memory is flushed between each line write ?
primefaces export-to-csv
primefaces export-to-csv
asked Nov 26 '18 at 12:57
gringogordogringogordo
53411133
53411133
1
Why don't you set a breakpoint and run in debug? According to the docs if used on a servlet engine (99,99999% of the time) it must returnServletResponse.getWriter()
and please add references to 'here are many reports of people having issues with Excel but none with csv. ' And yes, csv is less hungry, but for excel you can use 'streaming' so it totally depends on how the excel is generated
– Kukeltje
Nov 26 '18 at 15:35
I answered this here: stackoverflow.com/questions/51741023/… Please upvote if it fixes your issue.
– Melloware
Nov 27 '18 at 12:11
add a comment |
1
Why don't you set a breakpoint and run in debug? According to the docs if used on a servlet engine (99,99999% of the time) it must returnServletResponse.getWriter()
and please add references to 'here are many reports of people having issues with Excel but none with csv. ' And yes, csv is less hungry, but for excel you can use 'streaming' so it totally depends on how the excel is generated
– Kukeltje
Nov 26 '18 at 15:35
I answered this here: stackoverflow.com/questions/51741023/… Please upvote if it fixes your issue.
– Melloware
Nov 27 '18 at 12:11
1
1
Why don't you set a breakpoint and run in debug? According to the docs if used on a servlet engine (99,99999% of the time) it must return
ServletResponse.getWriter()
and please add references to 'here are many reports of people having issues with Excel but none with csv. ' And yes, csv is less hungry, but for excel you can use 'streaming' so it totally depends on how the excel is generated– Kukeltje
Nov 26 '18 at 15:35
Why don't you set a breakpoint and run in debug? According to the docs if used on a servlet engine (99,99999% of the time) it must return
ServletResponse.getWriter()
and please add references to 'here are many reports of people having issues with Excel but none with csv. ' And yes, csv is less hungry, but for excel you can use 'streaming' so it totally depends on how the excel is generated– Kukeltje
Nov 26 '18 at 15:35
I answered this here: stackoverflow.com/questions/51741023/… Please upvote if it fixes your issue.
– Melloware
Nov 27 '18 at 12:11
I answered this here: stackoverflow.com/questions/51741023/… Please upvote if it fixes your issue.
– Melloware
Nov 27 '18 at 12:11
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481631%2fprimefaces-externalcontext-responsewriter-concrete-type%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481631%2fprimefaces-externalcontext-responsewriter-concrete-type%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Why don't you set a breakpoint and run in debug? According to the docs if used on a servlet engine (99,99999% of the time) it must return
ServletResponse.getWriter()
and please add references to 'here are many reports of people having issues with Excel but none with csv. ' And yes, csv is less hungry, but for excel you can use 'streaming' so it totally depends on how the excel is generated– Kukeltje
Nov 26 '18 at 15:35
I answered this here: stackoverflow.com/questions/51741023/… Please upvote if it fixes your issue.
– Melloware
Nov 27 '18 at 12:11