az ziz

Ranch Hand
+ Follow
since Dec 17, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by az ziz

yes, all the images are in images folder only. but the problem is with the relative path the old developers has given, ../../images now the context path is changing, so as the request uri changes the images in the jsp and their paths changes

if
my_project/transaction/a.jsp was the request
../images/img1.jpg will work
if the same was changed to my_project/a.jsp
../images/img1.jpg wont work

said above,
../images/img1.jpg will work were mapped in the message properties file of struts.
how to append the context path with the path than ../../

V
12 years ago
please note this,
`<img src=<bean:message arg0="<%=request.getContextPath()%>" key="image1"/>>` works. but i cant change in 100s of jsp files which uses html:image.

thanks
V
12 years ago
i use images in the jsp using the html:image tag with the srcKey="imageurl", the value of the key contains the image resource location. how to include the context path in the resource than using like this, ../../images/image1.gif?
12 years ago
more info on the above,

the images inside the pages are struts html:image tag with the image url loaded using the message.property file of the struts, using the srcKey attribute. in the message.properties file the values uses the ../../ for locating the resources. can i include the context path in the properties file? how do i do?
12 years ago
in the html i have a link "<contextpath>/transaction/product.do". this link will take to an action motorproduct. but for web search and other reasons the client has asked to change this url to "<contextpath>/car-product".
in web.xml


where CustomActionServlet is sub classesed from ActionServlet for session maintenance and other our own specific reasons. it will call the super class operation after doing small preliminary things with the request.
I duplicated this with

now with the above i can access the action even without ".do".

i duplicated the action mapping in the struts-config.xml like

this worked.

the problem i am now facing is with the resources. the images are not loaded properly. the url links inside that page loaded are not loading properly. any other solution to get around this?

V
12 years ago
thanks for all your replies.
the jvm inside which the WAS runs has 1024 MB memory.
as Mr. Jeanne suggests, i am trying with other libraries such as pdfbox and PJX.


thanks
V
12 years ago
for your reference, please find the below codes that does the said work.

unnecessary codes are removed

pdfPrintList is the List containing the FileInputStream of the files to be sent to the client.



below code will join the list of pdfs, this will use the itext lib.



thanks
V
12 years ago
i have few pdf files in the file server. This pdf may vary in sizes. i need to let the client download them though the servlet. i receive the file name from the request and read the file using FileInputStream. i write them to the ServletOutputStream.
during this operation i receive OutOfMemoryError.

kindly reply for any other clarification.

V
12 years ago
can this be solved using the multi-part response? how about the browser compatibility? i read somewhere long back that IE do not understand this response ?

V
12 years ago
dear all,

If i have to download a large file, say > 200 mb, from the servlet if i use fileinputsream to read and write to the servletoutputstream i get outofmemory error. how do i split this file into various chunks and write them to the stream?
does using
response.setContentType("application/octet-stream");
solve the problem?
although i tried
outputStream = new GZIPOutputStream(response.getOutputStream(), 10240);
it didnt solve the problem.

thanks
V
12 years ago
ok let me try to explain it again.

I have a scheduler which runs periodically and generate reports in the form of pdf, fetching data from the database and save it to the file server. This part is separate.

Now in the web interface of the project the end user searches for a/few "policy(ies)", ie the report, an application in the web module will find the corresponding reports in the file server. as more reports are found the results of the search fetches few files. As the user requirement is to view these reports in a single pdf file, i merge all the found pdf report files using itext library and write them to the ServletOutputStream. the avg size of a pdf file will be around 300kb. say for example i have 30 - 40 reports searched, i combine them into a single pdf file using the itext and write the bytes into the stream. in this scenario while i merge the pdf, say in between 25th or 30th pdf, the server throwing the OutOfMemory exception.
i felt its due to the size of the combined file?

hope i had explained things clearly

thanks
V
12 years ago
thanks for your replies.

I cannot combine the pdfs offline as the requested reports may be random, each time. but I can only combine the list of reports requested runtime, no matter how old it is.

thanks
V
12 years ago
hei there,

In my web application, the user searches for a policy though the web interface, which i will find in the file server, the policy is in the form of pdf file, and respond them. there is also an option to search multiple policies, find them and print them in single attempt. in this case, i find those policy pdf files from a file server and combine them into one single pdf and write the bytes to the servlet output stream. in this case OutOfMemoryError is raised if more files are attempted to print. the combined single pdf file may run to hundreds of pages. i use itext to combine the pdfs.

FYI
I combine all the pdf
I am using clustered WAS server in AIX environment.

how do i solve this memory problem, as the client is specific in improving the speed and number of report printed?
Does increasing the JVM size may improve the situation, if so what if more files are combined and printed?
does data compression improve this situation? or is it an overhead?


thanks
V
12 years ago
Thanks for your reply Mr. Dittmer. The remote server supports SAMBA. The system from which i connect remote, that is the WAS, is running RHEL. In production WAS runs on AIX.

thanks
V
12 years ago
dear all,

ours is a big web app which uses jasper reports. I have written a scheduler that generates reports in pdf format, stores it to a file server, indexes it using lucene framework. From the web application the end-user searches for the report and if found he prints it. All i need to do now is search the index present in the remote file server. the search returns an array for files found with its paths. il read the file using the path and send data to the browser. I got this working if it got to be in local file system. how about a remote file server which has access credentials? are there any frameworks apis specially developed for remote file access? i haven't tried with the regular File class.

Thanks

V
12 years ago