Skip navigation

RequestCycle#scheduleRequestHandlerAfterCurrent() is used to hand over the request to different handler.

For example, if you figure out in some ajax-handling code that you want to serve the user a file.


Here's a link to provide an excel file, spotted at :


            final Link lnkExport = new Link("export") { 

                        public void onClick() { 
                                        getRequestCycle().scheduleRequestHandlerAfterCurrent(new IRequestHandler() { 
                                                public void detach(IRequestCycle requestCycle) { 

                                                public void respond(IRequestCycle requestCycle) { 
                                                        try { 
                                                                JxlExportOrderList jxlExportOrderList = new JxlExportOrderList(dataProvider.getOrderIds(), coOrderService); 
                                                                String fileName = String.format("118114life_%s.xls", new Object[]{DateUtils.format(Calendar.getInstance().getTime(), "yyMMddHHmm")}); 
                                                                HttpServletResponse httpResponse = (HttpServletResponse)requestCycle.getResponse().getContainerResponse(); 
                                                                httpResponse.setContentType( "application/" ); 
                                                                httpResponse.setHeader("Content-disposition", "attachment; filename=" + fileName ); 
                                                        } catch (Exception e) { 
                                                                throw new RuntimeException(e); 

Filter Blog

By date:
By tag: