chaitanya karthikk

Ranch Hand
+ Follow
since Sep 15, 2009
chaitanya likes ...
Java MySQL Database Spring
Noida, India
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by chaitanya karthikk

Hi Jaikiran, I did a search in my server root folder and got this location for the temporary files C:\opt\jboss\jboss-eap-6.1\standalone\tmp\work\jboss.web\default-host\file-upload. Thanks for the help.
3 years ago

Jaikiran Pai wrote:

It will default to the value that's set for the javax.servlet.context.tempdir context attribute, which is set by the server.

Thanks for the quick response Jaikiran. Is javax.servlet.context.tempdir context attribute set in every application server by default? I use jboss eap 6.x. I my server I dont any such attribute.
3 years ago
I am trying to upload very big files greater than 1gb. I am using MultipartConfig and HttpServletRequest.getPart(String) from servlet api. I deployed in my server and tried uploading a file and its working like a charm.

Then I went on reading about MultipartConfig in I understood that when large files are uploaded it writes parts of the file to a temporary location when the threshold is reached. And later on we have to delete the temporary files using part.delete().

What if I don't want to mention the temporary location? Will something bad happen to my application while uploading big files? I don't want to mention a temporary location becasue we cant gurantee about the production environment.
3 years ago
Hi all,

I would like to know the details about how a server handles a multipart request. I know that a webserver comprises of a HTTP adapter(which is responsible for receiving http requests and sending http responses) and a container(which is responsible for handling dynamic requests).

So, when a client sends a request, the HTTP adapter receives it. Then transfers the request to the container if the http adapter cannot handle it(jsps, servlets for example).

Suppose, a client sends a multipart request which has an avi file of size upto 100mb. For example, lets assume that the client takes 5 minutes to upload the file.

Lets also assume that my application is only interested in flv files. Is there any way to stop/terminate the multipart request before the file is transferred to the server? So that the client's time will not be wasted?

I think that the HTTP adapter will transfer the request to the container only after receiving the entire request, i.e. the servlet will be called only after the file is transferred to the server from client. Is it right?

If its right then there is no easy way to terminate the multipart request unless the entire file is transferred to the server. Is this right?

Thank you all.
3 years ago

Maneesh Godbole wrote:Do you wish to validate the file extension(s) of the file being uploaded (tar.gz/zip) or the file extension(s) of the file(s) inside the compressed file being uploaded?

I wish to validate the extension of the file being uploaded.
3 years ago
I am trying to write a webservice class which actually handles multipart requests. T client will try to upload zip or tar.gz files which may be upto 1GB in size.

I dont want to validate the extension i client side.

I want to validate the file extension in server side and discard the request before the file is uploaded.

How can I do this?

Thanks all in advance.
3 years ago
we have a table called job which has a self referencing key. We are using JPA and eclipselink as the JPA provider. Sometimes we are getting the following exception

We have an action in our UI which when performed a JSM message will go to some external component and a record will be created in our job table and then the job id will be sent to client and he will be redirected to the jobs view which lists all jobs in the table. After he is redirected the client will send an ajax request to list all jobs. While this operation is going we will receive notifications from external components and then we update the jobs table records.

I strongly believe that while the select operation is going we are trying to update the table and this is happening. Can anyone please tell me how to solve this problem.

Thank you all in advance good day.

Ulf Dittmer wrote:There may be something that gets logged, but is not visible due to the logging level being set too high. You can find out what happens be stepping through the servlet container's code in your debugger.

Thank you. I will do that. Thanks for your patience and help.
4 years ago

Ulf Dittmer wrote:Note that I said "The most likely scenario". It's perfectly possible that something else happens - I've never tried to find out, especially as this is likely dependent on the server you're using. So whatever happens on the server you're using may not be what happens on some other server.

Yeah, this is also right. I agree with you.

Ulf Dittmer wrote:So your code writes (and flushes) an OutputStream that is connected to a connection that is no longer valid, and the servlet code finishes without an exception? That's interesting, and not what I would have expected. Of course, servlets operate on a higher level than sockets, and need not necessarily be aware what happens underneath.

Yes, the servlet finishes without any exception. So you mean to say that after the servlet's execution finishes the control is transferred to some other lower level class which might throw an exception but is not being logged. Am I right?
4 years ago
Hi Dittmer, I wrote a sample servlet, introduced a break point, then requested the servlet and when the break point had hit I closed my browser and then tried to debug. I dint see any exceptions in the logs.

Why is the server log not showing the IO exceptions?
4 years ago

Ulf Dittmer wrote:The most likely scenario is that the connection gets closed, which the server will notice (possibly by an exception being thrown) when trying to send a response. Before that

If the server throws an exception definitely it will be logged in the log files and I don't see one in my logs.

Ulf Dittmer wrote:the processing of the request will continue as it normally would.

If the processing of the request continues then definitely it is a serious issue. Why is the design like this. Any guess.
4 years ago
Hi all,

For instance I made a request to a server by clicking a link or typing the url manually, later I press escape key on my keyboard or I simply close the browser or I refresh the page which will spawn a new request. In all these cases the server is processing a request and the client has changed his options. How will the server come to know that the client has disconnected or cancelled the request.

What I think is whenever a client sends a request a http connection is made and the connection will be open until the request is served. In any case the client interrupts the request, either the request or the connection will be closed. Can anyone please comment on this.

Thank you all in advance. Good day.
4 years ago

It seems to me that when you are thinking "list" you are really thinking array

No I was speaking about java List not and array.

Okay I now understand why I should return an array instead of List.

But I have one question here. Even though I am returning a java List jersey converts it into json (key : value pair) and sends it right. At last the client will receive strings itself right. Then what is the problem in using List?
4 years ago
Sorry!! I just came to know that only in post construct I can do that. The issue is resolved now
4 years ago

Ulf Dittmer wrote:No, Bill is suggesting an array: Employee[]

What? An array? But why? I mean I want to know the advantage and how returning a List is bad. What if I want to return list of employees, their count, start index, end index for example.

Besides I have to even initialize the array and then start adding the employees. If its a List I need not bother about the initialization.
4 years ago