I will start like a goofy: this is my first post:) Description: I hava app written 4years ago. It was based on GWT 1.2, and it was 100% client side app. The GWT app developer is gone from company (crisis or lets call this multitasking:) and i have to add servlet that will generate pdf with some data from the from on the www page. The pdf has to be open in new tab, and be ganerated on fly. I started with simplest possible idea, am trying to generate just empty pdf, i have it ready and compiled to *.jasper format.
This is what i have made so far: Added two interfaces on client side: _______________________________________________ package com.progmac.kkk.client; public interface DataService extends RemoteService{ public String getData(); } _______________________________________________ package com.progmac.kkk.client; import com.google.gwt.user.client.rpc.AsyncCallback; public interface DataServiceAsync { public void getData(AsyncCallback callback); } _______________________________________________ server side servlet implementation (don't lough please:) package com.progmac.kkk.server; public class DataServiceImpl extends RemoteServiceServlet implements DataService{ byte[] data; public String getData() { GWT.log("START... " ,null); GWT.log("Documents: failed getting report: KKK_REP.jasper",null); RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, /*!!!!!! HERE I GET ERROR!!!!!*/ "KKK_REP.jasper"); try { requestBuilder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { GWT.log("Documents: failed getting report: KKK_REP.jasper", exception); } public void onResponseReceived(Request request, Response response) { Map<Object, Object> map = new HashMap<Object, Object>(); map.put("logo", "logo"); try { //file.jasper path final String reportPath = "com/progmac/kkk/ public/KKK_REP.jasper"; URL url = ClassLoader.getSystemResource(reportPath); File file = new File(url.toURI()); InputStream inputStream = new FileInputStream(file); JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream,map); data = JasperExportManager.exportReportToPdf(jasperPrint); /*response.setContentLength(report.length); ServletOutputStream out = response.getOutputStream(); out.write(report); out.flush(); out.close();*/ } catch (Exception e) { e.printStackTrace(); } } }); } catch (RequestException e) { GWT.log("failed getting documents list", e); } String token = new Long(Calendar.getInstance().getTimeInMillis()).toString(); HttpServletRequest request = this.getThreadLocalRequest(); HttpSession session = request.getSession(); session.setAttribute(token, data); return data.toString(); } } _______________________________________________ Widget where i call the sevlet button listener private class ButtonClickListener implements ClickListener { public void onClick(Widget sender) { // call servlet to get data service.getData(new AsyncCallback() { public void onFailure(Throwable e) { label.setText("Server call failed"); } public void onSuccess(Object obj) { if (obj != null) { label.setText(obj.toString()); String token = (String) obj; Window.open("DataServiceImpl?token=" + token, "_blank", "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"); } else { label.setText("Server call returned nothing"); } } }); ______________________________________________________________ 1. The problem is in line: RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, /*!!!!!! HERE I GET ERROR!!!!!*/ where am trying to read the compiled file from publci folder. 2. Do you have any idea, how to read the compiled *.jasper file(code example...) and how to grab in buttons listener? 3. Maybe my idea with requestBuilder is completly wrong... 4.Thanks in advance for any explenations, or any code examples... -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.