Hello again,
I have another question.
With the new version (2.1), what are some possibilities of accessing the repository directories externally?
How would you gain access to the repository from outside of the JasperServer application itself?
Any ideas are appreciated.
Thanks again.
Post edited by: codyjasperForge, at: 2007/11/14 17:22
I have another question.
With the new version (2.1), what are some possibilities of accessing the repository directories externally?
How would you gain access to the repository from outside of the JasperServer application itself?
Any ideas are appreciated.
Thanks again.
Post edited by: codyjasperForge, at: 2007/11/14 17:22
18 Answers:
Posted on November 14, 2007 at 9:14pm
I'm new to Jasper, but I think it provides WebDAV folders which means you can access the repository from anything -- even M$ Office.
Take a look at the JasperServer plug-in that comes with iReport. When you create a new connection to a JasperServer repository, it shows a URL in there by default -- I think that's how you access the repository.
Take a look at the JasperServer plug-in that comes with iReport. When you create a new connection to a JasperServer repository, it shows a URL in there by default -- I think that's how you access the repository.
Posted on November 15, 2007 at 8:15am
gabrielinux wrote:
It's not exactly WebDAV, it's a custom SOAP web service. The service is described in the JasperServer web services guide.
Regards,
Lucian
I'm new to Jasper, but I think it provides WebDAV folders which means you can access the repository from anything -- even M$ Office. |
It's not exactly WebDAV, it's a custom SOAP web service. The service is described in the JasperServer web services guide.
Regards,
Lucian
Posted on November 15, 2007 at 8:28pm
New scenario:
I am scheduling jobs using the new web services...
However, for some unexplained reason, a method being called by the 'ReportSchedulerFacade' is now returning 'null' when earlier it was returning actual results. I have only made minor changes to my code, yet I can't seem to find out what would be causing this.
The method(s) is/are:
.getReportJobs(String reportURI);
and
.getAllJobs();
The only changes that I have made were to my custom code, so what are some possibilities?
Thanks in advance.
:pinch:
I am scheduling jobs using the new web services...
However, for some unexplained reason, a method being called by the 'ReportSchedulerFacade' is now returning 'null' when earlier it was returning actual results. I have only made minor changes to my code, yet I can't seem to find out what would be causing this.
The method(s) is/are:
.getReportJobs(String reportURI);
and
.getAllJobs();
The only changes that I have made were to my custom code, so what are some possibilities?
Thanks in advance.
:pinch:
Posted on November 16, 2007 at 5:09pm
How is it that you are able to bypass the Security to the repository?
I understand that it uses BASIC authentication, however, I have supplied the necessary parameters to my connection object, and I still get re-directed to the login page.
Any help?
Post edited by: codyjasperForge, at: 2007/11/16 19:09
I understand that it uses BASIC authentication, however, I have supplied the necessary parameters to my connection object, and I still get re-directed to the login page.
Any help?
Post edited by: codyjasperForge, at: 2007/11/16 19:09
Posted on November 20, 2007 at 1:53pm
codyjasperForge wrote:
Is this about JasperServer web services? If so, how exactly are you getting redirected to the login page? Web services are usually called from application code, and not from a browser.
What "connection" object are you using and how are you supplying authentication parameters?
Regards,
Lucian
How is it that you are able to bypass the Security to the repository? I understand that it uses BASIC authentication, however, I have supplied the necessary parameters to my connection object, and I still get re-directed to the login page. |
Is this about JasperServer web services? If so, how exactly are you getting redirected to the login page? Web services are usually called from application code, and not from a browser.
What "connection" object are you using and how are you supplying authentication parameters?
Regards,
Lucian
Posted on November 20, 2007 at 2:52pm
Ok,
I am scheduling jobs via the newly added web service(s). Once the jobs complete, the output files are stored in the JasperServer repository under the '/ContentFiles/' directory.
The client of my web application is polling the status of the job, when it is 'COMPLETE' then I wish to direct them to the output file. (under /ContentFiles)
Up to now, everything is functional, with the exception that when I try to direct them to the repository, the login page is what I get.
I have a utility class in my web application that creates a java.net.HttpURLConnection object with the BASIC authentication header.
The username and password are gathered from the WSClient's getUserName & getPassword methods. I encode the username and password using sun.misc.BASE64Encoder().
I am able to access the output files from within my utility class and I can create an InputStream and read in the content of the output file. (e.g. reportOutput.html)
What I wish to do is simply direct the client to that output file, whether it be a .pdf, .html, or the other formats.
I have read through the JasperForge forums, and everyone is stating that the login page can be bypassed, yet I can't see to find out how...
Do you have any suggestions?
:)
I am scheduling jobs via the newly added web service(s). Once the jobs complete, the output files are stored in the JasperServer repository under the '/ContentFiles/' directory.
The client of my web application is polling the status of the job, when it is 'COMPLETE' then I wish to direct them to the output file. (under /ContentFiles)
Up to now, everything is functional, with the exception that when I try to direct them to the repository, the login page is what I get.
I have a utility class in my web application that creates a java.net.HttpURLConnection object with the BASIC authentication header.
The username and password are gathered from the WSClient's getUserName & getPassword methods. I encode the username and password using sun.misc.BASE64Encoder().
I am able to access the output files from within my utility class and I can create an InputStream and read in the content of the output file. (e.g. reportOutput.html)
What I wish to do is simply direct the client to that output file, whether it be a .pdf, .html, or the other formats.
I have read through the JasperForge forums, and everyone is stating that the login page can be bypassed, yet I can't see to find out how...
Do you have any suggestions?
:)
Posted on November 20, 2007 at 3:11pm
Another idea that I had was to use the web service api from my utility class to do a 'get' on the output file.
The problem with this solution is that I do not see a way to display the output file by getting it as a 'ResourceDescriptor' object.
I need a direct link into the repository that bypasses the security model. All of our users will have the necessary credentials to login to JasperServer.
Is this possible?
Thank you once again Lucianc.
The problem with this solution is that I do not see a way to display the output file by getting it as a 'ResourceDescriptor' object.
I need a direct link into the repository that bypasses the security model. All of our users will have the necessary credentials to login to JasperServer.
Is this possible?
Thank you once again Lucianc.
Posted on November 20, 2007 at 3:23pm
codyjasperForge wrote:
Take a look at the java-webapp-sample application (in particular to ContentResourceDataServlet.java).
I'm not sure about this, I'll have to research it.
Regards,
Lucian
Another idea that I had was to use the web service api from my utility class to do a 'get' on the output file. The problem with this solution is that I do not see a way to display the output file by getting it as a 'ResourceDescriptor' object. |
Take a look at the java-webapp-sample application (in particular to ContentResourceDataServlet.java).
I need a direct link into the repository that bypasses the security model. All of our users will have the necessary credentials to login to JasperServer. Is this possible? |
I'm not sure about this, I'll have to research it.
Regards,
Lucian
Posted on November 20, 2007 at 3:38pm
I have implemented the necessary changes to my code.
But I am unable to display html formatted reports. All I see on the forwarded page is byte code. I have set the response content-Type and encoding values to those of the ContentResourceDataServlet. What else needs to be done?
What would cause this to happen?
The .pdf format works fine. As does the others, so I know the problem lies in the html formatting...
Ideas?
Post edited by: codyjasperForge, at: 2007/11/20 18:56
But I am unable to display html formatted reports. All I see on the forwarded page is byte code. I have set the response content-Type and encoding values to those of the ContentResourceDataServlet. What else needs to be done?
What would cause this to happen?
The .pdf format works fine. As does the others, so I know the problem lies in the html formatting...
Ideas?
Post edited by: codyjasperForge, at: 2007/11/20 18:56
Posted on November 26, 2007 at 1:45pm
Thanks for the reply...
Here are the two functions I am using...
Could you post the code that writes HTML and the resulting output? |
Here are the two functions I am using...
Code: |
public void retrieveReport(HttpServletRequest req, HttpServletResponse response){<br /> java.io.File tmp = (File) req.getSession().getServletContext().getAttribute("javax.servlet.context.tempdir"«»);<br /> File tmpFile = null;<br /> try {<br /> tmpFile = File.createTempFile("contentResource", ".data", tmp);<br /> WSClient client = (WSClient) req.getSession().getAttribute("client"«»);<br /> ResourceDescriptor outputFile = new ResourceDescriptor();<br /> outputFile.setUriString("/ContentFiles/" + req.getParameter("reportName"«»)+ "." + req.getParameter("format"«»));<br /> outputFile.setName(req.getParameter("reportName"«»));<br /> outputFile.setWsType("UNKNOW"«»);<br /> ResourceDescriptor result = client.get(outputFile, tmpFile);<br /> String contentType = result.getResourcePropertyValue(ResourceDescriptor.PROP_CONTENT_RESOURCE_TYPE);<br /> if (contentType.equals("html"«»)) {<br /> response.setContentType("text/html; charset=UTF-8"«»);//charset=UTF-8 charset=ISO-8859-1 pageEncoding=ISO-8859-1<br /> } else if (contentType.equals("pdf"«»)) {<br /> response.setContentType("application/pdf"«»);<br /> response.setHeader("Content-Disposition", "inline; filename=\"" + result.getName() + "\""«»);<br /> } else if (contentType.equals("xls"«»)) {<br /> response.setContentType("application/xls"«»);<br /> response.setHeader("Content-Disposition", "inline; filename=\"" + result.getName() + "\""«»);<br /> } else if (contentType.equals("rtf"«»)) {<br /> response.setContentType("application/rtf"«»);<br /> response.setHeader("Content-Disposition", "inline; filename=\"" + result.getName() + "\""«»);<br /> } else if (contentType.equals("csv"«»)) {<br /> response.setContentType("text/csv"«»);<br /> response.setHeader("Content-Disposition", "inline; filename=\"" + result.getName() + "\""«»);<br /> }<br /> response.setContentLength((int)tmpFile.length());<br /> <br /> writeFileContent(response, tmpFile);<br /> }catch(Exception e){<br /> e.printStackTrace();<br /> }finally{<br /> tmpFile.delete();<br /> }<br /> }<br /> <br /> public void writeFileContent(HttpServletResponse response, File file){<br /> try{<br /> javax.servlet.ServletOutputStream out = response.getOutputStream();<br /> java.io.FileInputStream fileIn = new java.io.FileInputStream(file);<br /> try {<br /> byte[] buf = new byte[BUFFER_SIZE];<br /> int read;<br /> while((read = fileIn.read(buf)) > 0) {<br /> out.write(buf, 0, read);<br /> }<br /> } finally {<br /> fileIn.close();<br /> }<br /> out.flush();<br /> out.close();<br /> }catch(java.io.IOException ioe){<br /> ioe.printStackTrace();<br /> }catch(Exception e){<br /> e.printStackTrace();<br /> } <br /> <br /> }<br /> <br /> }</td></tr></tbody></table><br /> <br /> Here is what the output looks like for html files...<br /> <br /> <table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"><tbody><tr><td><b>Code:</b></td></tr><tr><td><pre>GIF89a b w wi w *! w t \B w x dB w b $ d w w w C l w h b 4 w w P x w x t x X O | x d b w ~n N | + b O | + N | O | j x b XK ? ON|| [ b N ׮ NN ||lW o N ( N , O | x w P Nw | x ܺ O T 0 N | wn F w ! , H *\Ȱ Ç H ŋ3j ȑ†C I ɓ(? 1 K 0cVLI ͚+eRt@ O 7 4 ϣH1 ]z M :yN )u*՞^R y jW ~ 8 ̲gŒ k $T R ƕۓn] Y % qo۾ " s & W ֗ #Gދ 2e 1O le˄c qq䪦S? vܓ ή n < g !8 hƨW .kٞ3 ~ ye Nm [ aҌ+nݪ [ < y gM r` U ?_ v 3q y # ֖[ I | yuxrI l! y }Va QĞH<@ a Yt q q Մ m "H ] aH! H á d `y1>G 0 7 J7 </td></tr></tbody></table><br /> <br /> Its virtually the same as the code in the ContentResourceDataServlet.<br /> <br /> Thanks for you help... |
Posted on November 26, 2007 at 1:51pm
Once again thank you for your suggestions.
A thread in another forum states that the source of the .gif image that is included is causing this to appear.
After testing this theory, I set the Content-Type to "image/gif" and the result was the JasperReport logo.
Do you have any other suggestions for directing the user to the actual output file location? (in the repository)
Would it possible to manually prompt the user for their credentials before they are redirected to the JasperServer login page?
Post edited by: codyjasperForge, at: 2007/11/26 14:53
A thread in another forum states that the source of the .gif image that is included is causing this to appear.
After testing this theory, I set the Content-Type to "image/gif" and the result was the JasperReport logo.
Do you have any other suggestions for directing the user to the actual output file location? (in the repository)
Would it possible to manually prompt the user for their credentials before they are redirected to the JasperServer login page?
Post edited by: codyjasperForge, at: 2007/11/26 14:53
Posted on November 26, 2007 at 8:27pm
I should change my screen name to "GuyWith2ManyQuestions" :lol:
================================================
I have yet another question, this time it is NOT concerning the web services API...
Is it possible to have JasperServer running in a cluster?
If so, what are JasperServers capabilities as far as fail-over and session-replication?
Where might I find more information on this topic? (specifically)
Thanks Lucianc, you've been a great help.
================================================
I have yet another question, this time it is NOT concerning the web services API...
Is it possible to have JasperServer running in a cluster?
If so, what are JasperServers capabilities as far as fail-over and session-replication?
Where might I find more information on this topic? (specifically)
Thanks Lucianc, you've been a great help.
Posted on November 26, 2007 at 10:52pm
Answered in another thread at http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&catid=10&id=33645#33645
Sherman
JasperSoft
Sherman
JasperSoft
Posted on March 17, 2009 at 7:06am
Hello,
I am also want to the same way as you have done . Can I get the code please... I am using Adobe Air with Jasperserver reports.. I get the jasperserver ui page in that Adobe air properly. But as soon as I click on pdf, csv, excel it gives me a blank page with no errors.. so it's not helping me. So I am looking for different options now. I already have generated url like :http://hq1svrdev001/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/DierTracts/Contracts&ContractID=512&ContractID=512 and now this should go ahead and run the report which will be saved in the repository. Once completed then it should go to that repository and get that file in whatever user wants ie. pdf,csv,or excel. And what you have mentioned is doing the same, so can you please provide more help in that. Please contact me at vsoneta@yahoo.com and one more small request is there any way you can share the code.
My thing is : I have the url to the report generated. Now I want to run that url, will create the report and get that report and save it on user's local machine or direcyly access that file whether it's pdf, csv or excel and then open those files direcly from the available softwares.