Ashish Sarin wrote:Hi Jimi,
I think switching between servlet and portlet can be tricky, but this is where you can only choose to go the servlet way. I would suggest that you use portlet to render form and use AJAX for uploading files , which'll save the effort to switch between portlets and servlets. You may some details in this Liferay Wiki article (which also contains the source code):http://www.liferay.com/community/wiki/-/wiki/Main/Spring-Hibernate-DWR
Marco Ehrentreich wrote:Hi Jimi,
as I said it's hard to decide what would be a good solution in your specific case without knowing all details. So I can only come up with some (hopefully) useful advices...
For the size of your tasks I agree that it doesn't make much sense to make it smaller than one POST request at a time. Of course it doesn't make much sense to split one request and risk timeouts etc.
I'm still not sure what's the big deal with the delay you want to specify as late as possible. If you would use such a DelayQueue I don't see why it should be a problem to prepare a collection of task and built and populate the queue just when you know what the delay should be. You could even destroy the queue and build a new one if the delay changes in-between.
But I've found a specific ExecutorService in the JDK's concurrent util package which looks even more promising than the DelayQueue: ScheduledExecutorService
It's in general better and more high-level not to take care of the thread handling yourself but to use the ExecutorService facility for this. I just didn't know about this specific executor before. But it seems to do pretty much what you need.
There's a small example in the API doc, too. You'd basically have to encapsulate your working tasks (of sending a POST request) inside a Runnable or Future and enqueue it into the ExecutorService as soon as you know the delay between jobs.
The only other more flexible but also more complex solution for scheduling of jobs I know of, would be the Quartz framework. But for my understanding of what you're trying to achieve this would be overkill.
Hope this one is more helpful
Marco Ehrentreich wrote:Hi Jimi,
mabey Java's DelayQueue is of any help for you. Another interesting library I've found with a quick Google search seems to be this Task Queue API although I must admit that I haven't yet used neither the DelayQueue nor this API.
Anyway, I think no matter which solution or API you use there will be some work to be done on your side. You can't just simply slow down the execution of your Java code. So you have to define some kind of "steps" you want to be executed with a delay. I don't know the details of your project but I'm pretty sure that there will be no API available which can in a magical way figure out which steps of your program to slow down in a reasonable way.
Perhaps you should dissect the whole work to be done in smaller "working packages" or however you want to name it an use something like the DelayQueue to enqueue these tasks and execute them with some delay between each task.
David Newton wrote:Sure, it could be done with Jetty, why not? Or any other container in which you could write a servlet (or whatever).
I'm not convinced yet you'd *need* to, though--if you construct a request and want to unit-test that request, aren't you basically unit testing HttpClient?
You should post the feed using enctype="multipart/form-data". Although the search appliance supports uploads using enctype="application/x-www-form-urlencoded", this encoding type is not recommended for large amounts of data.
abalfazl hossein wrote:
Can't we write our own method to return a string?If it is all about return a string....
May someone explain more about this:
a string representation of the object
amrita singhal wrote:
Anand Sivathanu wrote:let us see this example
here vector's elements() will return a enumeration
then see e.nextElement() which give each object during iteration.
We already know that Enumeration is an interface ,
here how the nextElement() works
How it is possible?