JSF 2.0 ERR_SPDY_PROTOCOL_ERROR executing jasper report with date type param2019 Community Moderator ElectionSAP JCo connector loaded forever in GlassFish v2.1 (can't unload)JSF 2.0 and FaceletsMigrating from JSF 1.2 to JSF 2.0selectItems of selectOneMenu with param in JSF 2.0How to include another XHTML in XHTML using JSF 2.0 Facelets?What is STATE_SAVING_METHOD parameter in JSF 2.0How to use jsf @ConversationScoped bean with an hibernate composite primary key?JSON Verification rest serviceJSF JDBC Jasper ReportsJAVA Inner class Variable access
Can Mathematica be used to create an Artistic 3D extrusion from a 2D image and wrap a line pattern around it?
PTIJ: Why can't I eat anything?
How to pass a string to a command that expects a file?
How can The Temple of Elementary Evil reliably protect itself against kinetic bombardment?
Why is Beresheet doing a only a one-way trip?
Norms on fields
Does splitting a potentially monolithic application into several smaller ones help prevent bugs?
Finding algorithms of QGIS commands?
Reverse string, can I make it faster?
Peter's Strange Word
Why don't MCU characters ever seem to have language issues?
Extra alignment tab has been changed to cr. } using table, tabular and resizebox
What is the likely impact of grounding an entire aircraft series?
Exporting list of URLs
How much attack damage does the AC boost from a shield prevent on average?
Grey hair or white hair
Is there an elementary proof that there are infinitely many primes that are *not* completely split in an abelian extension?
Solving "Resistance between two nodes on a grid" problem in Mathematica
Am I not good enough for you?
Moving plot label
Do I really need to have a scientific explanation for my premise?
Why does Captain Marvel assume the people on this planet know this?
Look through the portal of every day
How to clip a background including nodes according to an arbitrary shape?
JSF 2.0 ERR_SPDY_PROTOCOL_ERROR executing jasper report with date type param
2019 Community Moderator ElectionSAP JCo connector loaded forever in GlassFish v2.1 (can't unload)JSF 2.0 and FaceletsMigrating from JSF 1.2 to JSF 2.0selectItems of selectOneMenu with param in JSF 2.0How to include another XHTML in XHTML using JSF 2.0 Facelets?What is STATE_SAVING_METHOD parameter in JSF 2.0How to use jsf @ConversationScoped bean with an hibernate composite primary key?JSON Verification rest serviceJSF JDBC Jasper ReportsJAVA Inner class Variable access
I'm current working with JSF 2.0 and JEE 7.0 web application deployed in wildfly 10
I have one view with 2 p:calendar components and p:commandButton with p:fileDownload that process jasper report.
When i execute this report from http protocol, everything works normally
and pdf file is downloaded, but when i execute from https connection, google chrome show me blank page with ERR_SPDY_PROTOCOL_ERROR, and pdf file is never downloaded.
Firefox show me blank page with nothing of information
Reading server.log in wildfly, everything works normally and no errors are logged.
The onSave() backing bean method prepare stream content file and works normally and finish without errors
If i try others jasper reports without p:calendar component under https connection, works normally and report file is downloaded normally.
I see that the problem is https connection and p:calendar component but i dont know how to repair it..
This is the xhtml view code
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"
xmlns:of="http://omnifaces.org/functions"
xmlns:pe="http://primefaces.org/ui/extensions"
template="/WEB-INF/template.xhtml">
<script type="text/javascript">
function start()
PF('statusDialog').show();
function stop()
PF('statusDialog').hide();
</script>
<ui:define name="content">
<f:metadata>
<o:viewParam id="id" name="report"
value="#reportJasperExecute.reportSelected"
converter="reportClientResourceLookupConverter" />
<f:event type="preRenderView"
listener="#reportJasperExecute.onLoad()" />
</f:metadata>
<h:form>
<div class="layout-portlets-box">
<div class="Container100">
<div class="ContainerIndent TexAlCenter">
<h1 class="BigTopic TexAlCenter">Ejecutar Reporte</h1>
<span class="gray">#reportJasperExecute.reportSelected.getLabel()</span>
<pe:fluidGrid id="fluidGrid" value="#reportJasperExecute.items"
var="data" resizeBound="true" hGutter="20"
widgetVar="fluidGridWdgt">
<pe:fluidGridItem type="bool">
<div class="dynaFormLabel">
<h:outputText for="boolC" value="#data.label" />
</div>
<p:selectBooleanCheckbox id="boolC" value="#data.value"
required="#data.required">
<p:ajax process="fluidGrid" update="fluidGrid"
listener="#reportJasperExecute.refreshItems(data.id, true)" />
</p:selectBooleanCheckbox>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueNumber">
<div class="dynaFormLabel">
<p:outputLabel for="numValue" value="#data.label" />
</div>
<p:inputText id="numValue" value="#data.value"
required="#data.required">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueText">
<div class="dynaFormLabel">
<p:outputLabel for="txtValue" value="#data.label"
rendered="#data.visible and !reportJasperExecute.isClientUUID(data.id)" />
</div>
<p:inputText id="txtValue" value="#data.value"
required="#data.required"
rendered="#data.visible and !reportJasperExecute.isClientUUID(data.id) and !reportJasperExecute.isProductUUID(data.id)">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
<div class="dynaFormLabel">
<p:outputLabel for="chooseClient" value="#data.label"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
</div>
<p:commandButton value="Cliente" icon="ui-icon-extlink"
id="chooseClient"
actionListener="#dialogFrameworkView.chooseClient('', '', 'false')"
process="@this"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)">
<p:ajax event="dialogReturn"
listener="#reportJasperExecute.onClientChosen"
update="fluidGrid panelGeneric" />
</p:commandButton>
<p:panelGrid columns="4" layout="grid" id="panelGeneric"
style="border:0px !important; background:none;"
styleClass="FormContent TexAlLeft">
<p:outputLabel value="Nombre:"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="#reportJasperExecute.client.name"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="Rut:"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="#reportJasperExecute.client.companyId"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
</p:panelGrid>
<p:autoComplete id="productCustom" minQueryLength="2"
value="#reportJasperExecute.product" effect="fade"
completeMethod="#reportJasperExecute.productComplete"
var="product" itemLabel="#product.code.concat(' '.concat(product.name))"
itemValue="#product" converter="productConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isProductUUID(data.id)">
<p:column>
<h:outputText value="#product.code" />
</p:column>
<p:column>
<h:outputText value="#product.name" />
</p:column>
</p:autoComplete>
<p:autoComplete id="product2Custom" minQueryLength="2"
value="#reportJasperExecute.product" effect="fade"
completeMethod="#reportJasperExecute.product2Complete"
var="product" itemLabel="#product.code.concat(' '.concat(product.name))"
itemValue="#product" converter="productConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isProduct2UUID(data.id)">
<p:column>
<h:outputText value="#product.code" />
</p:column>
<p:column>
<h:outputText value="#product.name" />
</p:column>
</p:autoComplete>
<p:autoComplete id="warehouseCustom" minQueryLength="2"
value="#reportJasperExecute.warehouseVO" effect="fade"
completeMethod="#reportJasperExecute.warehouseComplete"
var="warehouse" itemLabel="#warehouse.name"
itemValue="#warehouse" converter="warehouseConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isWarehouseUUID(data.id)">
<p:column>
<h:outputText value="#warehouse.name" />
</p:column>
</p:autoComplete>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValue">
<div class="dynaFormLabel">
<p:outputLabel for="txt" value="#data.label" />
</div>
<p:inputText id="txt" value="#data.value"
required="#data.required">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleSelectRadio">
<div class="dynaFormLabel">
<p:outputLabel for="menuRadio" value="#data.label" />
</div>
<p:selectOneMenu id="menuRadio" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="multiSelectCheckbox">
<div class="dynaFormLabel">
<p:outputLabel for="menuMultiCheck" value="#data.label" />
</div>
<p:selectOneMenu id="menuMultiCheck" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="multiSelect">
<div class="dynaFormLabel">
<p:outputLabel for="menuMulti" value="#data.label" />
</div>
<p:selectCheckboxMenu multiple="true" id="menuMulti" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid @this" update="fluidGrid" />
</p:selectCheckboxMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleSelect">
<div class="dynaFormLabel">
<p:outputLabel for="menu" value="#data.label" />
</div>
<p:selectOneMenu id="menu" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueDate">
<div class="dynaFormLabel">
<p:outputLabel for="cal" value="#data.label" />
</div>
<p:calendar id="cal" value="#data.value"
required="#data.required" showOn="button"
pattern="dd/MM/yyyy">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueDatetime">
<div class="dynaFormLabel">
<p:outputLabel for="calTime" value="#data.label" />
</div>
<p:calendar id="calTime" value="#data.value"
required="#data.required" pattern="dd/MM/yyyy"
showOn="button">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueTime">
<div class="dynaFormLabel">
<p:outputLabel for="time" value="#data.label" />
</div>
<p:calendar id="time" value="#data.value"
required="#data.required" showOn="button">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
</pe:fluidGrid>
<p:separator />
<p:commandButton value="Download" ajax="false" process="fluidGrid"
actionListener="#reportJasperExecute.onSave()"
onclick="PrimeFaces.monitorDownload(start, stop);"
icon="ui-icon-arrowthick-1-s">
<p:fileDownload value="#reportJasperExecute.file" />
</p:commandButton>
</div>
</div>
</div>
</h:form>
</ui:define>
</ui:composition>
Backing bean code
package com.mobilitysol.uy.sfe.view.reports;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.model.SelectItem;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.primefaces.event.SelectEvent;
import org.primefaces.extensions.model.fluidgrid.FluidGridItem;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import com.jaspersoft.jasperserver.dto.reports.inputcontrols.InputControlState;
import com.jaspersoft.jasperserver.dto.reports.inputcontrols.ReportInputControl;
import com.jaspersoft.jasperserver.dto.resources.ClientResourceLookup;
import com.mobilitysol.uy.sfe.annotations.CompanySelected;
import com.mobilitysol.uy.sfe.components.companies.constants.Rol;
import com.mobilitysol.uy.sfe.components.companies.datatypes.GenericClientLigthVO;
import com.mobilitysol.uy.sfe.components.companies.datatypes.MainCompanyVO;
import com.mobilitysol.uy.sfe.components.products.datatypes.product.ProductLigthVO;
import com.mobilitysol.uy.sfe.components.products.factories.ProductCmpFactory;
import com.mobilitysol.uy.sfe.components.reports.interfaces.ReportJasperMgt;
import com.mobilitysol.uy.sfe.components.warehouses.datatypes.WarehouseVO;
import com.mobilitysol.uy.sfe.components.warehouses.factories.WarehouseCmpFactory;
import com.mobilitysol.uy.sfe.datatypes.report.FluidItemCostum;
import com.mobilitysol.uy.sfe.view.ViewConfiguration;
@Named
@ViewScoped
public class ReportJasperExecute extends ViewConfiguration
private static final long serialVersionUID = 1763411949418803308L;
@EJB
private ReportJasperMgt report;
private StreamedContent file;
@Inject
@CompanySelected
private MainCompanyVO companySelected;
private ClientResourceLookup reportSelected;
private List<ReportInputControl> controls;
private Map<String, ReportInputControl> mapControls;
private List<FluidGridItem> items;
private GenericClientLigthVO client;
private boolean init;
private ProductLigthVO product;
private WarehouseVO warehouseVO;
@Inject
private ProductCmpFactory productFactory;
@Inject
private WarehouseCmpFactory warehouseFactory;
public ReportJasperExecute()
// TODO Auto-generated constructor stub
@PostConstruct
public void init()
init = false;
public void onLoad()
if (!init)
init = true;
System.out.println("arranco el load " + reportSelected.getUri());
controls = report.findInputControls(companySelected.getCompanyId(), reportSelected);
items = new ArrayList<FluidGridItem>();
ReportInputControl companyControl = null;
mapControls = new HashMap<>();
for (ReportInputControl oReportInputControl : controls)
mapControls.put(oReportInputControl.getId(), oReportInputControl);
companyControl = mapControls.get("companyid");
if (companyControl != null)
companyControl.getState().setValue(companySelected.getCompanyId());
companyControl.getState().setError("");
mapControls.put("companyid", companyControl);
companyControl = mapControls.get("logoURL");
if (companyControl != null)
companyControl.getState().setValue(
"http://localhost:8080/mobility-sfe/rest/report/image/logo/" + companySelected.getCompanyId());
companyControl.getState().setError("");
mapControls.put("logoURL", companyControl);
for (Map.Entry<String, ReportInputControl> oRepInpCotrl : mapControls.entrySet())
creatItem(oRepInpCotrl.getValue());
/**
*
* @param id del imputcontrol a actualizar
* @param trigger si fue el item que disparo el actualizar, al ser llamada la
* operacion su valor debe ser true!
*/
public void refreshItems(String id, Boolean trigger)
ReportInputControl oReportInputControl = mapControls.get(id);
oReportInputControl.getSlaveDependencies().forEach(slave ->
refreshItems(slave, false);
);
if (!trigger)
Iterator<FluidGridItem> oIterator = items.iterator();
FluidGridItem it;
for (; oIterator.hasNext();)
it = oIterator.next();
FluidItemCostum data = (FluidItemCostum) it.getData();
if (data.getId().equals(id))
oIterator.remove();
break;
creatItem(oReportInputControl);
public List<ProductLigthVO> productComplete(String sProductCode)
List<ProductLigthVO> colProducts;
colProducts = productFactory.getProductMgt().findAllByCode(companySelected.getCompanyId(), sProductCode);
Iterator<ProductLigthVO> oProductIterator = colProducts.iterator();
for (; oProductIterator.hasNext();)
if (!oProductIterator.next().isEnablesForSale())
oProductIterator.remove();
return colProducts;
public List<ProductLigthVO> product2Complete(String sProductCode)
List<ProductLigthVO> colProducts;
colProducts = productFactory.getProductMgt().findAllByCode(companySelected.getCompanyId(), sProductCode);
Iterator<ProductLigthVO> oProductIterator = colProducts.iterator();
for (; oProductIterator.hasNext();)
if (oProductIterator.next().isEnablesForSale())
oProductIterator.remove();
return colProducts;
public List<WarehouseVO> warehouseComplete(String sWarehouseName)
List<WarehouseVO> colWarehouses;
colWarehouses = warehouseFactory.getWarehouseMgt().findAllByName(companySelected.getCompanyId(),
sWarehouseName);
return colWarehouses;
/*
* Getters and Setters
*/
public ClientResourceLookup getReportSelected()
return reportSelected;
public void setReportSelected(ClientResourceLookup reportSelected)
this.reportSelected = reportSelected;
public List<ReportInputControl> getControls()
return controls;
public void setControls(List<ReportInputControl> controls)
this.controls = controls;
public List<FluidGridItem> getItems()
return items;
public void setItems(List<FluidGridItem> items)
this.items = items;
public WarehouseVO getWarehouseVO()
return warehouseVO;
public void setWarehouseVO(WarehouseVO warehouseVO)
this.warehouseVO = warehouseVO;
@Override
public boolean onSave()
try
SimpleDateFormat oDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sFileName;
controls.clear();
items.forEach(it ->
FluidItemCostum data = (FluidItemCostum) it.getData();
ReportInputControl param = mapControls.get(data.getId());
if (data.getId().equals("clientUUID"))
if (client != null)
param.getState().setValue(client.getUuid());
else if (data.getId().equals("clientName"))
if (client != null)
param.getState().setValue(client.getName());
else if (data.getId().equals("productUUID"))
if (product != null)
param.getState().setValue(product.getUuid());
else if (data.getId().equals("product2UUID"))
if (product != null)
param.getState().setValue(product.getUuid());
else if (data.getId().equals("warehouseUUID"))
if (warehouseVO != null)
param.getState().setValue(warehouseVO.getUuid());
else if (data.getId().equals("productName"))
if (product != null)
param.getState().setValue(product.getName());
else if (data.getId().equals("machineTypes"))
String[] colMachineTypes = (String[]) data.getValue();
if (colMachineTypes != null)
for (String type : colMachineTypes)
if (param.getState().getValue() != null && !param.getState().getValue().isEmpty())
param.getState().setValue(param.getState().getValue() + "," + type);
else
param.getState().setValue(type);
else it.getType().equals("singleValueDatetime"))
param.getState().setValue(oDateFormat.format((Date) data.getValue()));
else
param.getState().setValue(data.getValue().toString());
System.out.println(data.getValue().toString());
controls.add(param);
);
System.err.println("Obtaining input stream report");
InputStream stream = report.getReport(companySelected.getCompanyId(), ".pdf", controls, reportSelected);
sFileName = reportSelected.getLabel();
if (client != null)
sFileName = sFileName + " - " + client.getName();
sFileName = sFileName + ".pdf";
file = new DefaultStreamedContent(stream, "application/pdf", sFileName);
System.err.println("Report completed");
init = false;
return true;
catch (Throwable ex)
ex.printStackTrace();
return false;
public StreamedContent getFile()
return file;
public boolean isCompanyId(String sComponent)
String sCompare = "companyid";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isClientUUID(String sComponent)
String sCompare = "clientUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isProductUUID(String sComponent)
String sCompare = "productUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isProduct2UUID(String sComponent)
String sCompare = "product2UUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isWarehouseUUID(String sComponent)
String sCompare = "warehouseUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public void onClientChosen(SelectEvent event)
client = (GenericClientLigthVO) event.getObject();
public GenericClientLigthVO getClient()
return client;
public void setClient(GenericClientLigthVO client)
this.client = client;
public ProductLigthVO getProduct()
return product;
public void setProduct(ProductLigthVO product)
this.product = product;
// PRIVATE METHODS
private void creatItem(ReportInputControl oReportInputControl)
System.out.println(oReportInputControl.getLabel() + " " + oReportInputControl.getType());
oReportInputControl.setState(this.getValues(oReportInputControl));
mapControls.put(oReportInputControl.getId(), oReportInputControl);
List<SelectItem> selectItems = new ArrayList<SelectItem>();
if (oReportInputControl.getState().getOptions() != null)
oReportInputControl.getState().getOptions().forEach(op ->
if (op.getValue() == null)
selectItems.add(new SelectItem(op.getValue(), "Seleccione " + oReportInputControl.getLabel()));
else
selectItems.add(new SelectItem(op.getValue(), op.getLabel()));
);
Object value;
if (oReportInputControl.getType().contains("Date"))
value = new Date();
else
value = oReportInputControl.getState().getValue();
System.out.println(oReportInputControl.getId() + " " + oReportInputControl.getVisible());
items.add(new FluidGridItem(
new FluidItemCostum(oReportInputControl.getId(), oReportInputControl.getLabel(), value,
oReportInputControl.getMandatory(), oReportInputControl.getVisible(), selectItems),
oReportInputControl.getType()));
private InputControlState getValues(ReportInputControl oReportInputControl)
if (oReportInputControl.getMasterDependencies().size() > 0)
List<InputControlState> colMasterDependencies = new ArrayList<>();
oReportInputControl.getMasterDependencies().forEach(dep ->
ReportInputControl masterDep = mapControls.get(dep);
colMasterDependencies.add(masterDep.getState());
);
InputControlState response = report.getControlValues(companySelected.getCompanyId(), oReportInputControl,
colMasterDependencies, reportSelected);
return response;
// FIXME chequear dependencies
return oReportInputControl.getState();
@Override
public Rol getRolView()
return Rol.USER;
java-ee jsf-2
New contributor
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm current working with JSF 2.0 and JEE 7.0 web application deployed in wildfly 10
I have one view with 2 p:calendar components and p:commandButton with p:fileDownload that process jasper report.
When i execute this report from http protocol, everything works normally
and pdf file is downloaded, but when i execute from https connection, google chrome show me blank page with ERR_SPDY_PROTOCOL_ERROR, and pdf file is never downloaded.
Firefox show me blank page with nothing of information
Reading server.log in wildfly, everything works normally and no errors are logged.
The onSave() backing bean method prepare stream content file and works normally and finish without errors
If i try others jasper reports without p:calendar component under https connection, works normally and report file is downloaded normally.
I see that the problem is https connection and p:calendar component but i dont know how to repair it..
This is the xhtml view code
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"
xmlns:of="http://omnifaces.org/functions"
xmlns:pe="http://primefaces.org/ui/extensions"
template="/WEB-INF/template.xhtml">
<script type="text/javascript">
function start()
PF('statusDialog').show();
function stop()
PF('statusDialog').hide();
</script>
<ui:define name="content">
<f:metadata>
<o:viewParam id="id" name="report"
value="#reportJasperExecute.reportSelected"
converter="reportClientResourceLookupConverter" />
<f:event type="preRenderView"
listener="#reportJasperExecute.onLoad()" />
</f:metadata>
<h:form>
<div class="layout-portlets-box">
<div class="Container100">
<div class="ContainerIndent TexAlCenter">
<h1 class="BigTopic TexAlCenter">Ejecutar Reporte</h1>
<span class="gray">#reportJasperExecute.reportSelected.getLabel()</span>
<pe:fluidGrid id="fluidGrid" value="#reportJasperExecute.items"
var="data" resizeBound="true" hGutter="20"
widgetVar="fluidGridWdgt">
<pe:fluidGridItem type="bool">
<div class="dynaFormLabel">
<h:outputText for="boolC" value="#data.label" />
</div>
<p:selectBooleanCheckbox id="boolC" value="#data.value"
required="#data.required">
<p:ajax process="fluidGrid" update="fluidGrid"
listener="#reportJasperExecute.refreshItems(data.id, true)" />
</p:selectBooleanCheckbox>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueNumber">
<div class="dynaFormLabel">
<p:outputLabel for="numValue" value="#data.label" />
</div>
<p:inputText id="numValue" value="#data.value"
required="#data.required">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueText">
<div class="dynaFormLabel">
<p:outputLabel for="txtValue" value="#data.label"
rendered="#data.visible and !reportJasperExecute.isClientUUID(data.id)" />
</div>
<p:inputText id="txtValue" value="#data.value"
required="#data.required"
rendered="#data.visible and !reportJasperExecute.isClientUUID(data.id) and !reportJasperExecute.isProductUUID(data.id)">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
<div class="dynaFormLabel">
<p:outputLabel for="chooseClient" value="#data.label"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
</div>
<p:commandButton value="Cliente" icon="ui-icon-extlink"
id="chooseClient"
actionListener="#dialogFrameworkView.chooseClient('', '', 'false')"
process="@this"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)">
<p:ajax event="dialogReturn"
listener="#reportJasperExecute.onClientChosen"
update="fluidGrid panelGeneric" />
</p:commandButton>
<p:panelGrid columns="4" layout="grid" id="panelGeneric"
style="border:0px !important; background:none;"
styleClass="FormContent TexAlLeft">
<p:outputLabel value="Nombre:"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="#reportJasperExecute.client.name"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="Rut:"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="#reportJasperExecute.client.companyId"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
</p:panelGrid>
<p:autoComplete id="productCustom" minQueryLength="2"
value="#reportJasperExecute.product" effect="fade"
completeMethod="#reportJasperExecute.productComplete"
var="product" itemLabel="#product.code.concat(' '.concat(product.name))"
itemValue="#product" converter="productConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isProductUUID(data.id)">
<p:column>
<h:outputText value="#product.code" />
</p:column>
<p:column>
<h:outputText value="#product.name" />
</p:column>
</p:autoComplete>
<p:autoComplete id="product2Custom" minQueryLength="2"
value="#reportJasperExecute.product" effect="fade"
completeMethod="#reportJasperExecute.product2Complete"
var="product" itemLabel="#product.code.concat(' '.concat(product.name))"
itemValue="#product" converter="productConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isProduct2UUID(data.id)">
<p:column>
<h:outputText value="#product.code" />
</p:column>
<p:column>
<h:outputText value="#product.name" />
</p:column>
</p:autoComplete>
<p:autoComplete id="warehouseCustom" minQueryLength="2"
value="#reportJasperExecute.warehouseVO" effect="fade"
completeMethod="#reportJasperExecute.warehouseComplete"
var="warehouse" itemLabel="#warehouse.name"
itemValue="#warehouse" converter="warehouseConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isWarehouseUUID(data.id)">
<p:column>
<h:outputText value="#warehouse.name" />
</p:column>
</p:autoComplete>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValue">
<div class="dynaFormLabel">
<p:outputLabel for="txt" value="#data.label" />
</div>
<p:inputText id="txt" value="#data.value"
required="#data.required">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleSelectRadio">
<div class="dynaFormLabel">
<p:outputLabel for="menuRadio" value="#data.label" />
</div>
<p:selectOneMenu id="menuRadio" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="multiSelectCheckbox">
<div class="dynaFormLabel">
<p:outputLabel for="menuMultiCheck" value="#data.label" />
</div>
<p:selectOneMenu id="menuMultiCheck" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="multiSelect">
<div class="dynaFormLabel">
<p:outputLabel for="menuMulti" value="#data.label" />
</div>
<p:selectCheckboxMenu multiple="true" id="menuMulti" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid @this" update="fluidGrid" />
</p:selectCheckboxMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleSelect">
<div class="dynaFormLabel">
<p:outputLabel for="menu" value="#data.label" />
</div>
<p:selectOneMenu id="menu" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueDate">
<div class="dynaFormLabel">
<p:outputLabel for="cal" value="#data.label" />
</div>
<p:calendar id="cal" value="#data.value"
required="#data.required" showOn="button"
pattern="dd/MM/yyyy">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueDatetime">
<div class="dynaFormLabel">
<p:outputLabel for="calTime" value="#data.label" />
</div>
<p:calendar id="calTime" value="#data.value"
required="#data.required" pattern="dd/MM/yyyy"
showOn="button">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueTime">
<div class="dynaFormLabel">
<p:outputLabel for="time" value="#data.label" />
</div>
<p:calendar id="time" value="#data.value"
required="#data.required" showOn="button">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
</pe:fluidGrid>
<p:separator />
<p:commandButton value="Download" ajax="false" process="fluidGrid"
actionListener="#reportJasperExecute.onSave()"
onclick="PrimeFaces.monitorDownload(start, stop);"
icon="ui-icon-arrowthick-1-s">
<p:fileDownload value="#reportJasperExecute.file" />
</p:commandButton>
</div>
</div>
</div>
</h:form>
</ui:define>
</ui:composition>
Backing bean code
package com.mobilitysol.uy.sfe.view.reports;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.model.SelectItem;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.primefaces.event.SelectEvent;
import org.primefaces.extensions.model.fluidgrid.FluidGridItem;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import com.jaspersoft.jasperserver.dto.reports.inputcontrols.InputControlState;
import com.jaspersoft.jasperserver.dto.reports.inputcontrols.ReportInputControl;
import com.jaspersoft.jasperserver.dto.resources.ClientResourceLookup;
import com.mobilitysol.uy.sfe.annotations.CompanySelected;
import com.mobilitysol.uy.sfe.components.companies.constants.Rol;
import com.mobilitysol.uy.sfe.components.companies.datatypes.GenericClientLigthVO;
import com.mobilitysol.uy.sfe.components.companies.datatypes.MainCompanyVO;
import com.mobilitysol.uy.sfe.components.products.datatypes.product.ProductLigthVO;
import com.mobilitysol.uy.sfe.components.products.factories.ProductCmpFactory;
import com.mobilitysol.uy.sfe.components.reports.interfaces.ReportJasperMgt;
import com.mobilitysol.uy.sfe.components.warehouses.datatypes.WarehouseVO;
import com.mobilitysol.uy.sfe.components.warehouses.factories.WarehouseCmpFactory;
import com.mobilitysol.uy.sfe.datatypes.report.FluidItemCostum;
import com.mobilitysol.uy.sfe.view.ViewConfiguration;
@Named
@ViewScoped
public class ReportJasperExecute extends ViewConfiguration
private static final long serialVersionUID = 1763411949418803308L;
@EJB
private ReportJasperMgt report;
private StreamedContent file;
@Inject
@CompanySelected
private MainCompanyVO companySelected;
private ClientResourceLookup reportSelected;
private List<ReportInputControl> controls;
private Map<String, ReportInputControl> mapControls;
private List<FluidGridItem> items;
private GenericClientLigthVO client;
private boolean init;
private ProductLigthVO product;
private WarehouseVO warehouseVO;
@Inject
private ProductCmpFactory productFactory;
@Inject
private WarehouseCmpFactory warehouseFactory;
public ReportJasperExecute()
// TODO Auto-generated constructor stub
@PostConstruct
public void init()
init = false;
public void onLoad()
if (!init)
init = true;
System.out.println("arranco el load " + reportSelected.getUri());
controls = report.findInputControls(companySelected.getCompanyId(), reportSelected);
items = new ArrayList<FluidGridItem>();
ReportInputControl companyControl = null;
mapControls = new HashMap<>();
for (ReportInputControl oReportInputControl : controls)
mapControls.put(oReportInputControl.getId(), oReportInputControl);
companyControl = mapControls.get("companyid");
if (companyControl != null)
companyControl.getState().setValue(companySelected.getCompanyId());
companyControl.getState().setError("");
mapControls.put("companyid", companyControl);
companyControl = mapControls.get("logoURL");
if (companyControl != null)
companyControl.getState().setValue(
"http://localhost:8080/mobility-sfe/rest/report/image/logo/" + companySelected.getCompanyId());
companyControl.getState().setError("");
mapControls.put("logoURL", companyControl);
for (Map.Entry<String, ReportInputControl> oRepInpCotrl : mapControls.entrySet())
creatItem(oRepInpCotrl.getValue());
/**
*
* @param id del imputcontrol a actualizar
* @param trigger si fue el item que disparo el actualizar, al ser llamada la
* operacion su valor debe ser true!
*/
public void refreshItems(String id, Boolean trigger)
ReportInputControl oReportInputControl = mapControls.get(id);
oReportInputControl.getSlaveDependencies().forEach(slave ->
refreshItems(slave, false);
);
if (!trigger)
Iterator<FluidGridItem> oIterator = items.iterator();
FluidGridItem it;
for (; oIterator.hasNext();)
it = oIterator.next();
FluidItemCostum data = (FluidItemCostum) it.getData();
if (data.getId().equals(id))
oIterator.remove();
break;
creatItem(oReportInputControl);
public List<ProductLigthVO> productComplete(String sProductCode)
List<ProductLigthVO> colProducts;
colProducts = productFactory.getProductMgt().findAllByCode(companySelected.getCompanyId(), sProductCode);
Iterator<ProductLigthVO> oProductIterator = colProducts.iterator();
for (; oProductIterator.hasNext();)
if (!oProductIterator.next().isEnablesForSale())
oProductIterator.remove();
return colProducts;
public List<ProductLigthVO> product2Complete(String sProductCode)
List<ProductLigthVO> colProducts;
colProducts = productFactory.getProductMgt().findAllByCode(companySelected.getCompanyId(), sProductCode);
Iterator<ProductLigthVO> oProductIterator = colProducts.iterator();
for (; oProductIterator.hasNext();)
if (oProductIterator.next().isEnablesForSale())
oProductIterator.remove();
return colProducts;
public List<WarehouseVO> warehouseComplete(String sWarehouseName)
List<WarehouseVO> colWarehouses;
colWarehouses = warehouseFactory.getWarehouseMgt().findAllByName(companySelected.getCompanyId(),
sWarehouseName);
return colWarehouses;
/*
* Getters and Setters
*/
public ClientResourceLookup getReportSelected()
return reportSelected;
public void setReportSelected(ClientResourceLookup reportSelected)
this.reportSelected = reportSelected;
public List<ReportInputControl> getControls()
return controls;
public void setControls(List<ReportInputControl> controls)
this.controls = controls;
public List<FluidGridItem> getItems()
return items;
public void setItems(List<FluidGridItem> items)
this.items = items;
public WarehouseVO getWarehouseVO()
return warehouseVO;
public void setWarehouseVO(WarehouseVO warehouseVO)
this.warehouseVO = warehouseVO;
@Override
public boolean onSave()
try
SimpleDateFormat oDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sFileName;
controls.clear();
items.forEach(it ->
FluidItemCostum data = (FluidItemCostum) it.getData();
ReportInputControl param = mapControls.get(data.getId());
if (data.getId().equals("clientUUID"))
if (client != null)
param.getState().setValue(client.getUuid());
else if (data.getId().equals("clientName"))
if (client != null)
param.getState().setValue(client.getName());
else if (data.getId().equals("productUUID"))
if (product != null)
param.getState().setValue(product.getUuid());
else if (data.getId().equals("product2UUID"))
if (product != null)
param.getState().setValue(product.getUuid());
else if (data.getId().equals("warehouseUUID"))
if (warehouseVO != null)
param.getState().setValue(warehouseVO.getUuid());
else if (data.getId().equals("productName"))
if (product != null)
param.getState().setValue(product.getName());
else if (data.getId().equals("machineTypes"))
String[] colMachineTypes = (String[]) data.getValue();
if (colMachineTypes != null)
for (String type : colMachineTypes)
if (param.getState().getValue() != null && !param.getState().getValue().isEmpty())
param.getState().setValue(param.getState().getValue() + "," + type);
else
param.getState().setValue(type);
else it.getType().equals("singleValueDatetime"))
param.getState().setValue(oDateFormat.format((Date) data.getValue()));
else
param.getState().setValue(data.getValue().toString());
System.out.println(data.getValue().toString());
controls.add(param);
);
System.err.println("Obtaining input stream report");
InputStream stream = report.getReport(companySelected.getCompanyId(), ".pdf", controls, reportSelected);
sFileName = reportSelected.getLabel();
if (client != null)
sFileName = sFileName + " - " + client.getName();
sFileName = sFileName + ".pdf";
file = new DefaultStreamedContent(stream, "application/pdf", sFileName);
System.err.println("Report completed");
init = false;
return true;
catch (Throwable ex)
ex.printStackTrace();
return false;
public StreamedContent getFile()
return file;
public boolean isCompanyId(String sComponent)
String sCompare = "companyid";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isClientUUID(String sComponent)
String sCompare = "clientUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isProductUUID(String sComponent)
String sCompare = "productUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isProduct2UUID(String sComponent)
String sCompare = "product2UUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isWarehouseUUID(String sComponent)
String sCompare = "warehouseUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public void onClientChosen(SelectEvent event)
client = (GenericClientLigthVO) event.getObject();
public GenericClientLigthVO getClient()
return client;
public void setClient(GenericClientLigthVO client)
this.client = client;
public ProductLigthVO getProduct()
return product;
public void setProduct(ProductLigthVO product)
this.product = product;
// PRIVATE METHODS
private void creatItem(ReportInputControl oReportInputControl)
System.out.println(oReportInputControl.getLabel() + " " + oReportInputControl.getType());
oReportInputControl.setState(this.getValues(oReportInputControl));
mapControls.put(oReportInputControl.getId(), oReportInputControl);
List<SelectItem> selectItems = new ArrayList<SelectItem>();
if (oReportInputControl.getState().getOptions() != null)
oReportInputControl.getState().getOptions().forEach(op ->
if (op.getValue() == null)
selectItems.add(new SelectItem(op.getValue(), "Seleccione " + oReportInputControl.getLabel()));
else
selectItems.add(new SelectItem(op.getValue(), op.getLabel()));
);
Object value;
if (oReportInputControl.getType().contains("Date"))
value = new Date();
else
value = oReportInputControl.getState().getValue();
System.out.println(oReportInputControl.getId() + " " + oReportInputControl.getVisible());
items.add(new FluidGridItem(
new FluidItemCostum(oReportInputControl.getId(), oReportInputControl.getLabel(), value,
oReportInputControl.getMandatory(), oReportInputControl.getVisible(), selectItems),
oReportInputControl.getType()));
private InputControlState getValues(ReportInputControl oReportInputControl)
if (oReportInputControl.getMasterDependencies().size() > 0)
List<InputControlState> colMasterDependencies = new ArrayList<>();
oReportInputControl.getMasterDependencies().forEach(dep ->
ReportInputControl masterDep = mapControls.get(dep);
colMasterDependencies.add(masterDep.getState());
);
InputControlState response = report.getControlValues(companySelected.getCompanyId(), oReportInputControl,
colMasterDependencies, reportSelected);
return response;
// FIXME chequear dependencies
return oReportInputControl.getState();
@Override
public Rol getRolView()
return Rol.USER;
java-ee jsf-2
New contributor
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Minimal, Complete, and Verifiable example please...
– Kukeltje
Mar 6 at 20:03
add a comment |
I'm current working with JSF 2.0 and JEE 7.0 web application deployed in wildfly 10
I have one view with 2 p:calendar components and p:commandButton with p:fileDownload that process jasper report.
When i execute this report from http protocol, everything works normally
and pdf file is downloaded, but when i execute from https connection, google chrome show me blank page with ERR_SPDY_PROTOCOL_ERROR, and pdf file is never downloaded.
Firefox show me blank page with nothing of information
Reading server.log in wildfly, everything works normally and no errors are logged.
The onSave() backing bean method prepare stream content file and works normally and finish without errors
If i try others jasper reports without p:calendar component under https connection, works normally and report file is downloaded normally.
I see that the problem is https connection and p:calendar component but i dont know how to repair it..
This is the xhtml view code
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"
xmlns:of="http://omnifaces.org/functions"
xmlns:pe="http://primefaces.org/ui/extensions"
template="/WEB-INF/template.xhtml">
<script type="text/javascript">
function start()
PF('statusDialog').show();
function stop()
PF('statusDialog').hide();
</script>
<ui:define name="content">
<f:metadata>
<o:viewParam id="id" name="report"
value="#reportJasperExecute.reportSelected"
converter="reportClientResourceLookupConverter" />
<f:event type="preRenderView"
listener="#reportJasperExecute.onLoad()" />
</f:metadata>
<h:form>
<div class="layout-portlets-box">
<div class="Container100">
<div class="ContainerIndent TexAlCenter">
<h1 class="BigTopic TexAlCenter">Ejecutar Reporte</h1>
<span class="gray">#reportJasperExecute.reportSelected.getLabel()</span>
<pe:fluidGrid id="fluidGrid" value="#reportJasperExecute.items"
var="data" resizeBound="true" hGutter="20"
widgetVar="fluidGridWdgt">
<pe:fluidGridItem type="bool">
<div class="dynaFormLabel">
<h:outputText for="boolC" value="#data.label" />
</div>
<p:selectBooleanCheckbox id="boolC" value="#data.value"
required="#data.required">
<p:ajax process="fluidGrid" update="fluidGrid"
listener="#reportJasperExecute.refreshItems(data.id, true)" />
</p:selectBooleanCheckbox>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueNumber">
<div class="dynaFormLabel">
<p:outputLabel for="numValue" value="#data.label" />
</div>
<p:inputText id="numValue" value="#data.value"
required="#data.required">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueText">
<div class="dynaFormLabel">
<p:outputLabel for="txtValue" value="#data.label"
rendered="#data.visible and !reportJasperExecute.isClientUUID(data.id)" />
</div>
<p:inputText id="txtValue" value="#data.value"
required="#data.required"
rendered="#data.visible and !reportJasperExecute.isClientUUID(data.id) and !reportJasperExecute.isProductUUID(data.id)">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
<div class="dynaFormLabel">
<p:outputLabel for="chooseClient" value="#data.label"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
</div>
<p:commandButton value="Cliente" icon="ui-icon-extlink"
id="chooseClient"
actionListener="#dialogFrameworkView.chooseClient('', '', 'false')"
process="@this"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)">
<p:ajax event="dialogReturn"
listener="#reportJasperExecute.onClientChosen"
update="fluidGrid panelGeneric" />
</p:commandButton>
<p:panelGrid columns="4" layout="grid" id="panelGeneric"
style="border:0px !important; background:none;"
styleClass="FormContent TexAlLeft">
<p:outputLabel value="Nombre:"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="#reportJasperExecute.client.name"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="Rut:"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="#reportJasperExecute.client.companyId"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
</p:panelGrid>
<p:autoComplete id="productCustom" minQueryLength="2"
value="#reportJasperExecute.product" effect="fade"
completeMethod="#reportJasperExecute.productComplete"
var="product" itemLabel="#product.code.concat(' '.concat(product.name))"
itemValue="#product" converter="productConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isProductUUID(data.id)">
<p:column>
<h:outputText value="#product.code" />
</p:column>
<p:column>
<h:outputText value="#product.name" />
</p:column>
</p:autoComplete>
<p:autoComplete id="product2Custom" minQueryLength="2"
value="#reportJasperExecute.product" effect="fade"
completeMethod="#reportJasperExecute.product2Complete"
var="product" itemLabel="#product.code.concat(' '.concat(product.name))"
itemValue="#product" converter="productConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isProduct2UUID(data.id)">
<p:column>
<h:outputText value="#product.code" />
</p:column>
<p:column>
<h:outputText value="#product.name" />
</p:column>
</p:autoComplete>
<p:autoComplete id="warehouseCustom" minQueryLength="2"
value="#reportJasperExecute.warehouseVO" effect="fade"
completeMethod="#reportJasperExecute.warehouseComplete"
var="warehouse" itemLabel="#warehouse.name"
itemValue="#warehouse" converter="warehouseConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isWarehouseUUID(data.id)">
<p:column>
<h:outputText value="#warehouse.name" />
</p:column>
</p:autoComplete>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValue">
<div class="dynaFormLabel">
<p:outputLabel for="txt" value="#data.label" />
</div>
<p:inputText id="txt" value="#data.value"
required="#data.required">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleSelectRadio">
<div class="dynaFormLabel">
<p:outputLabel for="menuRadio" value="#data.label" />
</div>
<p:selectOneMenu id="menuRadio" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="multiSelectCheckbox">
<div class="dynaFormLabel">
<p:outputLabel for="menuMultiCheck" value="#data.label" />
</div>
<p:selectOneMenu id="menuMultiCheck" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="multiSelect">
<div class="dynaFormLabel">
<p:outputLabel for="menuMulti" value="#data.label" />
</div>
<p:selectCheckboxMenu multiple="true" id="menuMulti" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid @this" update="fluidGrid" />
</p:selectCheckboxMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleSelect">
<div class="dynaFormLabel">
<p:outputLabel for="menu" value="#data.label" />
</div>
<p:selectOneMenu id="menu" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueDate">
<div class="dynaFormLabel">
<p:outputLabel for="cal" value="#data.label" />
</div>
<p:calendar id="cal" value="#data.value"
required="#data.required" showOn="button"
pattern="dd/MM/yyyy">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueDatetime">
<div class="dynaFormLabel">
<p:outputLabel for="calTime" value="#data.label" />
</div>
<p:calendar id="calTime" value="#data.value"
required="#data.required" pattern="dd/MM/yyyy"
showOn="button">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueTime">
<div class="dynaFormLabel">
<p:outputLabel for="time" value="#data.label" />
</div>
<p:calendar id="time" value="#data.value"
required="#data.required" showOn="button">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
</pe:fluidGrid>
<p:separator />
<p:commandButton value="Download" ajax="false" process="fluidGrid"
actionListener="#reportJasperExecute.onSave()"
onclick="PrimeFaces.monitorDownload(start, stop);"
icon="ui-icon-arrowthick-1-s">
<p:fileDownload value="#reportJasperExecute.file" />
</p:commandButton>
</div>
</div>
</div>
</h:form>
</ui:define>
</ui:composition>
Backing bean code
package com.mobilitysol.uy.sfe.view.reports;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.model.SelectItem;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.primefaces.event.SelectEvent;
import org.primefaces.extensions.model.fluidgrid.FluidGridItem;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import com.jaspersoft.jasperserver.dto.reports.inputcontrols.InputControlState;
import com.jaspersoft.jasperserver.dto.reports.inputcontrols.ReportInputControl;
import com.jaspersoft.jasperserver.dto.resources.ClientResourceLookup;
import com.mobilitysol.uy.sfe.annotations.CompanySelected;
import com.mobilitysol.uy.sfe.components.companies.constants.Rol;
import com.mobilitysol.uy.sfe.components.companies.datatypes.GenericClientLigthVO;
import com.mobilitysol.uy.sfe.components.companies.datatypes.MainCompanyVO;
import com.mobilitysol.uy.sfe.components.products.datatypes.product.ProductLigthVO;
import com.mobilitysol.uy.sfe.components.products.factories.ProductCmpFactory;
import com.mobilitysol.uy.sfe.components.reports.interfaces.ReportJasperMgt;
import com.mobilitysol.uy.sfe.components.warehouses.datatypes.WarehouseVO;
import com.mobilitysol.uy.sfe.components.warehouses.factories.WarehouseCmpFactory;
import com.mobilitysol.uy.sfe.datatypes.report.FluidItemCostum;
import com.mobilitysol.uy.sfe.view.ViewConfiguration;
@Named
@ViewScoped
public class ReportJasperExecute extends ViewConfiguration
private static final long serialVersionUID = 1763411949418803308L;
@EJB
private ReportJasperMgt report;
private StreamedContent file;
@Inject
@CompanySelected
private MainCompanyVO companySelected;
private ClientResourceLookup reportSelected;
private List<ReportInputControl> controls;
private Map<String, ReportInputControl> mapControls;
private List<FluidGridItem> items;
private GenericClientLigthVO client;
private boolean init;
private ProductLigthVO product;
private WarehouseVO warehouseVO;
@Inject
private ProductCmpFactory productFactory;
@Inject
private WarehouseCmpFactory warehouseFactory;
public ReportJasperExecute()
// TODO Auto-generated constructor stub
@PostConstruct
public void init()
init = false;
public void onLoad()
if (!init)
init = true;
System.out.println("arranco el load " + reportSelected.getUri());
controls = report.findInputControls(companySelected.getCompanyId(), reportSelected);
items = new ArrayList<FluidGridItem>();
ReportInputControl companyControl = null;
mapControls = new HashMap<>();
for (ReportInputControl oReportInputControl : controls)
mapControls.put(oReportInputControl.getId(), oReportInputControl);
companyControl = mapControls.get("companyid");
if (companyControl != null)
companyControl.getState().setValue(companySelected.getCompanyId());
companyControl.getState().setError("");
mapControls.put("companyid", companyControl);
companyControl = mapControls.get("logoURL");
if (companyControl != null)
companyControl.getState().setValue(
"http://localhost:8080/mobility-sfe/rest/report/image/logo/" + companySelected.getCompanyId());
companyControl.getState().setError("");
mapControls.put("logoURL", companyControl);
for (Map.Entry<String, ReportInputControl> oRepInpCotrl : mapControls.entrySet())
creatItem(oRepInpCotrl.getValue());
/**
*
* @param id del imputcontrol a actualizar
* @param trigger si fue el item que disparo el actualizar, al ser llamada la
* operacion su valor debe ser true!
*/
public void refreshItems(String id, Boolean trigger)
ReportInputControl oReportInputControl = mapControls.get(id);
oReportInputControl.getSlaveDependencies().forEach(slave ->
refreshItems(slave, false);
);
if (!trigger)
Iterator<FluidGridItem> oIterator = items.iterator();
FluidGridItem it;
for (; oIterator.hasNext();)
it = oIterator.next();
FluidItemCostum data = (FluidItemCostum) it.getData();
if (data.getId().equals(id))
oIterator.remove();
break;
creatItem(oReportInputControl);
public List<ProductLigthVO> productComplete(String sProductCode)
List<ProductLigthVO> colProducts;
colProducts = productFactory.getProductMgt().findAllByCode(companySelected.getCompanyId(), sProductCode);
Iterator<ProductLigthVO> oProductIterator = colProducts.iterator();
for (; oProductIterator.hasNext();)
if (!oProductIterator.next().isEnablesForSale())
oProductIterator.remove();
return colProducts;
public List<ProductLigthVO> product2Complete(String sProductCode)
List<ProductLigthVO> colProducts;
colProducts = productFactory.getProductMgt().findAllByCode(companySelected.getCompanyId(), sProductCode);
Iterator<ProductLigthVO> oProductIterator = colProducts.iterator();
for (; oProductIterator.hasNext();)
if (oProductIterator.next().isEnablesForSale())
oProductIterator.remove();
return colProducts;
public List<WarehouseVO> warehouseComplete(String sWarehouseName)
List<WarehouseVO> colWarehouses;
colWarehouses = warehouseFactory.getWarehouseMgt().findAllByName(companySelected.getCompanyId(),
sWarehouseName);
return colWarehouses;
/*
* Getters and Setters
*/
public ClientResourceLookup getReportSelected()
return reportSelected;
public void setReportSelected(ClientResourceLookup reportSelected)
this.reportSelected = reportSelected;
public List<ReportInputControl> getControls()
return controls;
public void setControls(List<ReportInputControl> controls)
this.controls = controls;
public List<FluidGridItem> getItems()
return items;
public void setItems(List<FluidGridItem> items)
this.items = items;
public WarehouseVO getWarehouseVO()
return warehouseVO;
public void setWarehouseVO(WarehouseVO warehouseVO)
this.warehouseVO = warehouseVO;
@Override
public boolean onSave()
try
SimpleDateFormat oDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sFileName;
controls.clear();
items.forEach(it ->
FluidItemCostum data = (FluidItemCostum) it.getData();
ReportInputControl param = mapControls.get(data.getId());
if (data.getId().equals("clientUUID"))
if (client != null)
param.getState().setValue(client.getUuid());
else if (data.getId().equals("clientName"))
if (client != null)
param.getState().setValue(client.getName());
else if (data.getId().equals("productUUID"))
if (product != null)
param.getState().setValue(product.getUuid());
else if (data.getId().equals("product2UUID"))
if (product != null)
param.getState().setValue(product.getUuid());
else if (data.getId().equals("warehouseUUID"))
if (warehouseVO != null)
param.getState().setValue(warehouseVO.getUuid());
else if (data.getId().equals("productName"))
if (product != null)
param.getState().setValue(product.getName());
else if (data.getId().equals("machineTypes"))
String[] colMachineTypes = (String[]) data.getValue();
if (colMachineTypes != null)
for (String type : colMachineTypes)
if (param.getState().getValue() != null && !param.getState().getValue().isEmpty())
param.getState().setValue(param.getState().getValue() + "," + type);
else
param.getState().setValue(type);
else it.getType().equals("singleValueDatetime"))
param.getState().setValue(oDateFormat.format((Date) data.getValue()));
else
param.getState().setValue(data.getValue().toString());
System.out.println(data.getValue().toString());
controls.add(param);
);
System.err.println("Obtaining input stream report");
InputStream stream = report.getReport(companySelected.getCompanyId(), ".pdf", controls, reportSelected);
sFileName = reportSelected.getLabel();
if (client != null)
sFileName = sFileName + " - " + client.getName();
sFileName = sFileName + ".pdf";
file = new DefaultStreamedContent(stream, "application/pdf", sFileName);
System.err.println("Report completed");
init = false;
return true;
catch (Throwable ex)
ex.printStackTrace();
return false;
public StreamedContent getFile()
return file;
public boolean isCompanyId(String sComponent)
String sCompare = "companyid";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isClientUUID(String sComponent)
String sCompare = "clientUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isProductUUID(String sComponent)
String sCompare = "productUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isProduct2UUID(String sComponent)
String sCompare = "product2UUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isWarehouseUUID(String sComponent)
String sCompare = "warehouseUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public void onClientChosen(SelectEvent event)
client = (GenericClientLigthVO) event.getObject();
public GenericClientLigthVO getClient()
return client;
public void setClient(GenericClientLigthVO client)
this.client = client;
public ProductLigthVO getProduct()
return product;
public void setProduct(ProductLigthVO product)
this.product = product;
// PRIVATE METHODS
private void creatItem(ReportInputControl oReportInputControl)
System.out.println(oReportInputControl.getLabel() + " " + oReportInputControl.getType());
oReportInputControl.setState(this.getValues(oReportInputControl));
mapControls.put(oReportInputControl.getId(), oReportInputControl);
List<SelectItem> selectItems = new ArrayList<SelectItem>();
if (oReportInputControl.getState().getOptions() != null)
oReportInputControl.getState().getOptions().forEach(op ->
if (op.getValue() == null)
selectItems.add(new SelectItem(op.getValue(), "Seleccione " + oReportInputControl.getLabel()));
else
selectItems.add(new SelectItem(op.getValue(), op.getLabel()));
);
Object value;
if (oReportInputControl.getType().contains("Date"))
value = new Date();
else
value = oReportInputControl.getState().getValue();
System.out.println(oReportInputControl.getId() + " " + oReportInputControl.getVisible());
items.add(new FluidGridItem(
new FluidItemCostum(oReportInputControl.getId(), oReportInputControl.getLabel(), value,
oReportInputControl.getMandatory(), oReportInputControl.getVisible(), selectItems),
oReportInputControl.getType()));
private InputControlState getValues(ReportInputControl oReportInputControl)
if (oReportInputControl.getMasterDependencies().size() > 0)
List<InputControlState> colMasterDependencies = new ArrayList<>();
oReportInputControl.getMasterDependencies().forEach(dep ->
ReportInputControl masterDep = mapControls.get(dep);
colMasterDependencies.add(masterDep.getState());
);
InputControlState response = report.getControlValues(companySelected.getCompanyId(), oReportInputControl,
colMasterDependencies, reportSelected);
return response;
// FIXME chequear dependencies
return oReportInputControl.getState();
@Override
public Rol getRolView()
return Rol.USER;
java-ee jsf-2
New contributor
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm current working with JSF 2.0 and JEE 7.0 web application deployed in wildfly 10
I have one view with 2 p:calendar components and p:commandButton with p:fileDownload that process jasper report.
When i execute this report from http protocol, everything works normally
and pdf file is downloaded, but when i execute from https connection, google chrome show me blank page with ERR_SPDY_PROTOCOL_ERROR, and pdf file is never downloaded.
Firefox show me blank page with nothing of information
Reading server.log in wildfly, everything works normally and no errors are logged.
The onSave() backing bean method prepare stream content file and works normally and finish without errors
If i try others jasper reports without p:calendar component under https connection, works normally and report file is downloaded normally.
I see that the problem is https connection and p:calendar component but i dont know how to repair it..
This is the xhtml view code
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"
xmlns:of="http://omnifaces.org/functions"
xmlns:pe="http://primefaces.org/ui/extensions"
template="/WEB-INF/template.xhtml">
<script type="text/javascript">
function start()
PF('statusDialog').show();
function stop()
PF('statusDialog').hide();
</script>
<ui:define name="content">
<f:metadata>
<o:viewParam id="id" name="report"
value="#reportJasperExecute.reportSelected"
converter="reportClientResourceLookupConverter" />
<f:event type="preRenderView"
listener="#reportJasperExecute.onLoad()" />
</f:metadata>
<h:form>
<div class="layout-portlets-box">
<div class="Container100">
<div class="ContainerIndent TexAlCenter">
<h1 class="BigTopic TexAlCenter">Ejecutar Reporte</h1>
<span class="gray">#reportJasperExecute.reportSelected.getLabel()</span>
<pe:fluidGrid id="fluidGrid" value="#reportJasperExecute.items"
var="data" resizeBound="true" hGutter="20"
widgetVar="fluidGridWdgt">
<pe:fluidGridItem type="bool">
<div class="dynaFormLabel">
<h:outputText for="boolC" value="#data.label" />
</div>
<p:selectBooleanCheckbox id="boolC" value="#data.value"
required="#data.required">
<p:ajax process="fluidGrid" update="fluidGrid"
listener="#reportJasperExecute.refreshItems(data.id, true)" />
</p:selectBooleanCheckbox>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueNumber">
<div class="dynaFormLabel">
<p:outputLabel for="numValue" value="#data.label" />
</div>
<p:inputText id="numValue" value="#data.value"
required="#data.required">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueText">
<div class="dynaFormLabel">
<p:outputLabel for="txtValue" value="#data.label"
rendered="#data.visible and !reportJasperExecute.isClientUUID(data.id)" />
</div>
<p:inputText id="txtValue" value="#data.value"
required="#data.required"
rendered="#data.visible and !reportJasperExecute.isClientUUID(data.id) and !reportJasperExecute.isProductUUID(data.id)">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
<div class="dynaFormLabel">
<p:outputLabel for="chooseClient" value="#data.label"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
</div>
<p:commandButton value="Cliente" icon="ui-icon-extlink"
id="chooseClient"
actionListener="#dialogFrameworkView.chooseClient('', '', 'false')"
process="@this"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)">
<p:ajax event="dialogReturn"
listener="#reportJasperExecute.onClientChosen"
update="fluidGrid panelGeneric" />
</p:commandButton>
<p:panelGrid columns="4" layout="grid" id="panelGeneric"
style="border:0px !important; background:none;"
styleClass="FormContent TexAlLeft">
<p:outputLabel value="Nombre:"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="#reportJasperExecute.client.name"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="Rut:"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
<p:outputLabel value="#reportJasperExecute.client.companyId"
rendered="#data.visible and reportJasperExecute.isClientUUID(data.id)" />
</p:panelGrid>
<p:autoComplete id="productCustom" minQueryLength="2"
value="#reportJasperExecute.product" effect="fade"
completeMethod="#reportJasperExecute.productComplete"
var="product" itemLabel="#product.code.concat(' '.concat(product.name))"
itemValue="#product" converter="productConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isProductUUID(data.id)">
<p:column>
<h:outputText value="#product.code" />
</p:column>
<p:column>
<h:outputText value="#product.name" />
</p:column>
</p:autoComplete>
<p:autoComplete id="product2Custom" minQueryLength="2"
value="#reportJasperExecute.product" effect="fade"
completeMethod="#reportJasperExecute.product2Complete"
var="product" itemLabel="#product.code.concat(' '.concat(product.name))"
itemValue="#product" converter="productConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isProduct2UUID(data.id)">
<p:column>
<h:outputText value="#product.code" />
</p:column>
<p:column>
<h:outputText value="#product.name" />
</p:column>
</p:autoComplete>
<p:autoComplete id="warehouseCustom" minQueryLength="2"
value="#reportJasperExecute.warehouseVO" effect="fade"
completeMethod="#reportJasperExecute.warehouseComplete"
var="warehouse" itemLabel="#warehouse.name"
itemValue="#warehouse" converter="warehouseConverter"
forceSelection="true"
rendered="#data.visible and reportJasperExecute.isWarehouseUUID(data.id)">
<p:column>
<h:outputText value="#warehouse.name" />
</p:column>
</p:autoComplete>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValue">
<div class="dynaFormLabel">
<p:outputLabel for="txt" value="#data.label" />
</div>
<p:inputText id="txt" value="#data.value"
required="#data.required">
<p:ajax event="blur"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:inputText>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleSelectRadio">
<div class="dynaFormLabel">
<p:outputLabel for="menuRadio" value="#data.label" />
</div>
<p:selectOneMenu id="menuRadio" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="multiSelectCheckbox">
<div class="dynaFormLabel">
<p:outputLabel for="menuMultiCheck" value="#data.label" />
</div>
<p:selectOneMenu id="menuMultiCheck" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="multiSelect">
<div class="dynaFormLabel">
<p:outputLabel for="menuMulti" value="#data.label" />
</div>
<p:selectCheckboxMenu multiple="true" id="menuMulti" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid @this" update="fluidGrid" />
</p:selectCheckboxMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleSelect">
<div class="dynaFormLabel">
<p:outputLabel for="menu" value="#data.label" />
</div>
<p:selectOneMenu id="menu" value="#data.value"
required="#data.required">
<f:selectItems value="#data.selectItems" />
<p:ajax
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:selectOneMenu>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueDate">
<div class="dynaFormLabel">
<p:outputLabel for="cal" value="#data.label" />
</div>
<p:calendar id="cal" value="#data.value"
required="#data.required" showOn="button"
pattern="dd/MM/yyyy">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueDatetime">
<div class="dynaFormLabel">
<p:outputLabel for="calTime" value="#data.label" />
</div>
<p:calendar id="calTime" value="#data.value"
required="#data.required" pattern="dd/MM/yyyy"
showOn="button">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
<pe:fluidGridItem type="singleValueTime">
<div class="dynaFormLabel">
<p:outputLabel for="time" value="#data.label" />
</div>
<p:calendar id="time" value="#data.value"
required="#data.required" showOn="button">
<p:ajax event="change"
listener="#reportJasperExecute.refreshItems(data.id, true)"
process="fluidGrid" update="fluidGrid" />
</p:calendar>
</pe:fluidGridItem>
</pe:fluidGrid>
<p:separator />
<p:commandButton value="Download" ajax="false" process="fluidGrid"
actionListener="#reportJasperExecute.onSave()"
onclick="PrimeFaces.monitorDownload(start, stop);"
icon="ui-icon-arrowthick-1-s">
<p:fileDownload value="#reportJasperExecute.file" />
</p:commandButton>
</div>
</div>
</div>
</h:form>
</ui:define>
</ui:composition>
Backing bean code
package com.mobilitysol.uy.sfe.view.reports;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.model.SelectItem;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.primefaces.event.SelectEvent;
import org.primefaces.extensions.model.fluidgrid.FluidGridItem;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import com.jaspersoft.jasperserver.dto.reports.inputcontrols.InputControlState;
import com.jaspersoft.jasperserver.dto.reports.inputcontrols.ReportInputControl;
import com.jaspersoft.jasperserver.dto.resources.ClientResourceLookup;
import com.mobilitysol.uy.sfe.annotations.CompanySelected;
import com.mobilitysol.uy.sfe.components.companies.constants.Rol;
import com.mobilitysol.uy.sfe.components.companies.datatypes.GenericClientLigthVO;
import com.mobilitysol.uy.sfe.components.companies.datatypes.MainCompanyVO;
import com.mobilitysol.uy.sfe.components.products.datatypes.product.ProductLigthVO;
import com.mobilitysol.uy.sfe.components.products.factories.ProductCmpFactory;
import com.mobilitysol.uy.sfe.components.reports.interfaces.ReportJasperMgt;
import com.mobilitysol.uy.sfe.components.warehouses.datatypes.WarehouseVO;
import com.mobilitysol.uy.sfe.components.warehouses.factories.WarehouseCmpFactory;
import com.mobilitysol.uy.sfe.datatypes.report.FluidItemCostum;
import com.mobilitysol.uy.sfe.view.ViewConfiguration;
@Named
@ViewScoped
public class ReportJasperExecute extends ViewConfiguration
private static final long serialVersionUID = 1763411949418803308L;
@EJB
private ReportJasperMgt report;
private StreamedContent file;
@Inject
@CompanySelected
private MainCompanyVO companySelected;
private ClientResourceLookup reportSelected;
private List<ReportInputControl> controls;
private Map<String, ReportInputControl> mapControls;
private List<FluidGridItem> items;
private GenericClientLigthVO client;
private boolean init;
private ProductLigthVO product;
private WarehouseVO warehouseVO;
@Inject
private ProductCmpFactory productFactory;
@Inject
private WarehouseCmpFactory warehouseFactory;
public ReportJasperExecute()
// TODO Auto-generated constructor stub
@PostConstruct
public void init()
init = false;
public void onLoad()
if (!init)
init = true;
System.out.println("arranco el load " + reportSelected.getUri());
controls = report.findInputControls(companySelected.getCompanyId(), reportSelected);
items = new ArrayList<FluidGridItem>();
ReportInputControl companyControl = null;
mapControls = new HashMap<>();
for (ReportInputControl oReportInputControl : controls)
mapControls.put(oReportInputControl.getId(), oReportInputControl);
companyControl = mapControls.get("companyid");
if (companyControl != null)
companyControl.getState().setValue(companySelected.getCompanyId());
companyControl.getState().setError("");
mapControls.put("companyid", companyControl);
companyControl = mapControls.get("logoURL");
if (companyControl != null)
companyControl.getState().setValue(
"http://localhost:8080/mobility-sfe/rest/report/image/logo/" + companySelected.getCompanyId());
companyControl.getState().setError("");
mapControls.put("logoURL", companyControl);
for (Map.Entry<String, ReportInputControl> oRepInpCotrl : mapControls.entrySet())
creatItem(oRepInpCotrl.getValue());
/**
*
* @param id del imputcontrol a actualizar
* @param trigger si fue el item que disparo el actualizar, al ser llamada la
* operacion su valor debe ser true!
*/
public void refreshItems(String id, Boolean trigger)
ReportInputControl oReportInputControl = mapControls.get(id);
oReportInputControl.getSlaveDependencies().forEach(slave ->
refreshItems(slave, false);
);
if (!trigger)
Iterator<FluidGridItem> oIterator = items.iterator();
FluidGridItem it;
for (; oIterator.hasNext();)
it = oIterator.next();
FluidItemCostum data = (FluidItemCostum) it.getData();
if (data.getId().equals(id))
oIterator.remove();
break;
creatItem(oReportInputControl);
public List<ProductLigthVO> productComplete(String sProductCode)
List<ProductLigthVO> colProducts;
colProducts = productFactory.getProductMgt().findAllByCode(companySelected.getCompanyId(), sProductCode);
Iterator<ProductLigthVO> oProductIterator = colProducts.iterator();
for (; oProductIterator.hasNext();)
if (!oProductIterator.next().isEnablesForSale())
oProductIterator.remove();
return colProducts;
public List<ProductLigthVO> product2Complete(String sProductCode)
List<ProductLigthVO> colProducts;
colProducts = productFactory.getProductMgt().findAllByCode(companySelected.getCompanyId(), sProductCode);
Iterator<ProductLigthVO> oProductIterator = colProducts.iterator();
for (; oProductIterator.hasNext();)
if (oProductIterator.next().isEnablesForSale())
oProductIterator.remove();
return colProducts;
public List<WarehouseVO> warehouseComplete(String sWarehouseName)
List<WarehouseVO> colWarehouses;
colWarehouses = warehouseFactory.getWarehouseMgt().findAllByName(companySelected.getCompanyId(),
sWarehouseName);
return colWarehouses;
/*
* Getters and Setters
*/
public ClientResourceLookup getReportSelected()
return reportSelected;
public void setReportSelected(ClientResourceLookup reportSelected)
this.reportSelected = reportSelected;
public List<ReportInputControl> getControls()
return controls;
public void setControls(List<ReportInputControl> controls)
this.controls = controls;
public List<FluidGridItem> getItems()
return items;
public void setItems(List<FluidGridItem> items)
this.items = items;
public WarehouseVO getWarehouseVO()
return warehouseVO;
public void setWarehouseVO(WarehouseVO warehouseVO)
this.warehouseVO = warehouseVO;
@Override
public boolean onSave()
try
SimpleDateFormat oDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sFileName;
controls.clear();
items.forEach(it ->
FluidItemCostum data = (FluidItemCostum) it.getData();
ReportInputControl param = mapControls.get(data.getId());
if (data.getId().equals("clientUUID"))
if (client != null)
param.getState().setValue(client.getUuid());
else if (data.getId().equals("clientName"))
if (client != null)
param.getState().setValue(client.getName());
else if (data.getId().equals("productUUID"))
if (product != null)
param.getState().setValue(product.getUuid());
else if (data.getId().equals("product2UUID"))
if (product != null)
param.getState().setValue(product.getUuid());
else if (data.getId().equals("warehouseUUID"))
if (warehouseVO != null)
param.getState().setValue(warehouseVO.getUuid());
else if (data.getId().equals("productName"))
if (product != null)
param.getState().setValue(product.getName());
else if (data.getId().equals("machineTypes"))
String[] colMachineTypes = (String[]) data.getValue();
if (colMachineTypes != null)
for (String type : colMachineTypes)
if (param.getState().getValue() != null && !param.getState().getValue().isEmpty())
param.getState().setValue(param.getState().getValue() + "," + type);
else
param.getState().setValue(type);
else it.getType().equals("singleValueDatetime"))
param.getState().setValue(oDateFormat.format((Date) data.getValue()));
else
param.getState().setValue(data.getValue().toString());
System.out.println(data.getValue().toString());
controls.add(param);
);
System.err.println("Obtaining input stream report");
InputStream stream = report.getReport(companySelected.getCompanyId(), ".pdf", controls, reportSelected);
sFileName = reportSelected.getLabel();
if (client != null)
sFileName = sFileName + " - " + client.getName();
sFileName = sFileName + ".pdf";
file = new DefaultStreamedContent(stream, "application/pdf", sFileName);
System.err.println("Report completed");
init = false;
return true;
catch (Throwable ex)
ex.printStackTrace();
return false;
public StreamedContent getFile()
return file;
public boolean isCompanyId(String sComponent)
String sCompare = "companyid";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isClientUUID(String sComponent)
String sCompare = "clientUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isProductUUID(String sComponent)
String sCompare = "productUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isProduct2UUID(String sComponent)
String sCompare = "product2UUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public boolean isWarehouseUUID(String sComponent)
String sCompare = "warehouseUUID";
if (sComponent != null && sComponent.equals(sCompare))
return true;
else
return false;
public void onClientChosen(SelectEvent event)
client = (GenericClientLigthVO) event.getObject();
public GenericClientLigthVO getClient()
return client;
public void setClient(GenericClientLigthVO client)
this.client = client;
public ProductLigthVO getProduct()
return product;
public void setProduct(ProductLigthVO product)
this.product = product;
// PRIVATE METHODS
private void creatItem(ReportInputControl oReportInputControl)
System.out.println(oReportInputControl.getLabel() + " " + oReportInputControl.getType());
oReportInputControl.setState(this.getValues(oReportInputControl));
mapControls.put(oReportInputControl.getId(), oReportInputControl);
List<SelectItem> selectItems = new ArrayList<SelectItem>();
if (oReportInputControl.getState().getOptions() != null)
oReportInputControl.getState().getOptions().forEach(op ->
if (op.getValue() == null)
selectItems.add(new SelectItem(op.getValue(), "Seleccione " + oReportInputControl.getLabel()));
else
selectItems.add(new SelectItem(op.getValue(), op.getLabel()));
);
Object value;
if (oReportInputControl.getType().contains("Date"))
value = new Date();
else
value = oReportInputControl.getState().getValue();
System.out.println(oReportInputControl.getId() + " " + oReportInputControl.getVisible());
items.add(new FluidGridItem(
new FluidItemCostum(oReportInputControl.getId(), oReportInputControl.getLabel(), value,
oReportInputControl.getMandatory(), oReportInputControl.getVisible(), selectItems),
oReportInputControl.getType()));
private InputControlState getValues(ReportInputControl oReportInputControl)
if (oReportInputControl.getMasterDependencies().size() > 0)
List<InputControlState> colMasterDependencies = new ArrayList<>();
oReportInputControl.getMasterDependencies().forEach(dep ->
ReportInputControl masterDep = mapControls.get(dep);
colMasterDependencies.add(masterDep.getState());
);
InputControlState response = report.getControlValues(companySelected.getCompanyId(), oReportInputControl,
colMasterDependencies, reportSelected);
return response;
// FIXME chequear dependencies
return oReportInputControl.getState();
@Override
public Rol getRolView()
return Rol.USER;
java-ee jsf-2
java-ee jsf-2
New contributor
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Mar 6 at 16:14
Andres LopezAndres Lopez
1
1
New contributor
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Andres Lopez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Minimal, Complete, and Verifiable example please...
– Kukeltje
Mar 6 at 20:03
add a comment |
Minimal, Complete, and Verifiable example please...
– Kukeltje
Mar 6 at 20:03
Minimal, Complete, and Verifiable example please...
– Kukeltje
Mar 6 at 20:03
Minimal, Complete, and Verifiable example please...
– Kukeltje
Mar 6 at 20:03
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
);
);
Andres Lopez is a new contributor. Be nice, and check out our Code of Conduct.
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%2f55027608%2fjsf-2-0-err-spdy-protocol-error-executing-jasper-report-with-date-type-param%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
Andres Lopez is a new contributor. Be nice, and check out our Code of Conduct.
Andres Lopez is a new contributor. Be nice, and check out our Code of Conduct.
Andres Lopez is a new contributor. Be nice, and check out our Code of Conduct.
Andres Lopez is a new contributor. Be nice, and check out our Code of Conduct.
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%2f55027608%2fjsf-2-0-err-spdy-protocol-error-executing-jasper-report-with-date-type-param%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
Minimal, Complete, and Verifiable example please...
– Kukeltje
Mar 6 at 20:03