Elizabeth Wilson

Greenhorn
+ Follow
since Apr 17, 2009
Merit badge: grant badges
For More
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 Elizabeth Wilson

Update:

Thanks to N. Alex Rupp and this article: http://today.java.net/pub/a/today/2003/08/06/multithreadedTests.html,
I believe my problem is that junit does not work properly in a multithreaded environment. It didn't wait for results like it should have (though I still don't understand why subsequent statements were never executed and it decided that nothing was wrong).

I have rewritten the code to run sequentially, and now it runs just fine under junit.

But, I want to test my server code in an asynchronous fashion. The above article recommends GroboUtils, though the article is now dated. Can anyone recommend a unit testing framework that works in a multithreaded environment?

Thanks!

Liz
14 years ago

Btw, here is my junit task in my build.xml:



I'm developing on a Mac Leopard, FWIW.

Liz
14 years ago

Hi,

I have some code that calls HttpClient.executeMethod(method), where method is a GetMethod. The code runs fine from the command line or from within an Eclipse 'run' configuration - I get back a response body that I can store as a file.

But, it does not run correctly when I call it from within a junit task in an ant script. Instead, it gets to the executeMethod() call then seems to just quit without executing subsequent statements. It does not throw an error and indicates that the test was run with no failures. I get these results whether invoking ant from the command line or from within Eclipse.

Any thoughts as to why this would happen? TIA!

Liz
14 years ago

Actually, it's best to let the DB worry about it. Why pull data out of the DB that's not going to be viewed? See the JSP FAQ for a discussion of paging.



Good point. Will check out that page.

Same deal. You create a link in the JSP. Sending the binary to the JSP is useless -- there's nothing to do with it there. Whether it's an image or a link, it references a servlet that will stream the binary data in the appropriate format.



Yup, okay, got it.

It's what the Ranch is here for!



This has been very helpful! Thanks a bunch!!
14 years ago
Yeah, I agree about viewing large data tables, though that's the way it has been done around here and there's a
comfort factor for some in seeing it continue to be available that way.

Though, I like the idea of paging, wish I'd thought of that myself. Any clues on how to go about that? Seems like
caching would be needed to allow paging back and forth.

Thanks for the point about the image tag. How about the case where I want to allow the user to click on a link to
download binary data resding in some servlet's memory somewhere?

Okay, will not try to send large amounts of data to JSP. Thank you for the guidance!
14 years ago
Thinking further about the binary download use case, perhaps HTML would not be involved in that. I should focus on the passage of the ascii data.
14 years ago
Say, rendering ascii data as a table in HTML or as a plot created via a visualization tool called from Javascript.

Or, possibly a download of binary data generated on the fly.

14 years ago
hi!

This would both binary and ascii on the order of hundreds of megabytes.
14 years ago
Hi,

I have a web application that allows a browser client to request data then render it in the browser. Rendering could take a variety of forms.

For this, I have a servlet that on receipt of a request:
1) reads a data file into an object that contains a byte buffer, then
2) adds that object as an attribute to the HttpServletRequest object, then
3) forwards the request to a JSP file for rendering.

This works, but now I want to handle large data volumes. I'm not sure how to go about this.

I considered streaming, but I'm not sure about adding a stream as an attribute to a request. And my stream needs to be an OutputStream for the servlet and an InputStream for the JSP. Would adding a PipedOutputStream attribute to the request allow my JSP to read from it using a PipedInputStream? I understand this is generally used for inter-thread communication, but would it work between servlets?

Or should I go about this completely differently? Should I use a URLConnection to the JSP? But, then I don't see how the JSP would be able to send response back to the browser.

Or??? Any tips or insights would be greatly appreciated! TIA!
14 years ago