Juggy Obhi

Ranch Hand
+ Follow
since Jul 02, 2007
Merit badge: grant badges
For More
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Juggy Obhi

Many thanks Mark. Words of wisdom. big help

Jagpreet Singh
10 years ago

I have a enum property editor like:

I have registered it in my Spring MVC controller like:

Whenever i make an AJAX call to this controller the setAsText() method gets called and works fine. The problem is with getAsText() method which is not getting called when the server responds with a JSON string.

Please guide. What am i missing?

Jagpreet Singh
10 years ago

I need help to understand what exactly is wrong with my logic as per JPA2.0 (Hibernate 3.5).

My problem is that i see em.merge() firing only select statements. I could not see any update statements. I know i am doing some basics wrong but i have not been able to get it. Please guide.

Jagpreet Singh
Many thanks for the guidance.

There really isn't much difference. After all, that's exactly what the server is doing when you hit the file via its path.

That's exactly what i think. I had checked the response using web sniffer for both of these two and found no difference However i learned in one of the forum that it is no a java issue...

This isn't a java issue, JW Player only supports HTTP Psuedo Streaming and RTMP Streaming. They're both their own protocols


It seems that when the path is provided JW player knows how to stream it and handles it well whereas when done manually using a servlet, JW player fails as in this case the streaming is not done in manner JW player can handle and process.

I will try to learn and implement JW player supported streaming.

11 years ago
Hi All,

I have a flash file (.flv) which i want to display as a video in JW player. It is very strange to know that when i keep that FLV file on some path in the server and let the user get it with a simple url e.g. http://mysite/mycontext/myflv.flv, the video appears on the screen whereas when i use a servet and write the flv file in the HttpServletResponse with proper headers like content length, content type, content disposition, the file do not play on the browser however if i manually put the URL (direct url to the file OR servlet url which writes the file to the response object), the result is same, i get a SAVE AS window on the browser.

I really need to understand the difference between Writing file to Response VS serving file using the context path.

Thanks in Advance.

11 years ago
Hi Tim, Thanks for your guidance. Great help! Esp. the tip for caching files i will look into this. Thanks. I hope the design is ok
11 years ago
Hi All,

In my web application i need to display some audio/video and image files to the user. I have a folder containing original media files which i don't want to deliver directly. Whenever i get a request for some audio/video/image, i use FFMPEG utility to convert the original files to the standard FLV format (with a watermark logo) and i save this converted and required to be temporary file to server temp directory -

which gives me something like - D:\tomcat7\work\Catalina\localhost\easycontext

I write my converted file on this path in a hope that this will be managed/cleaned automatically by Tomcat/Operating System. Please correct me here if my assumption is wrong.

I am quite a beginner with Tomcat. The way i am thinking of serving these files to the client is by the way of writing contex path in the server.xml.

and now if i run my tomcat server, i get an exception like -

I believe that there is a lot i am doing wrong. My requirement is very simple and i request you all to please guide me on this. What should be the best design for this? I do not want to manage the converted media folder myself and at the same time i read that mentioning context path in server.xml is not good. What should i do?

With thanks in Advance,
11 years ago
Thanks ntumba lobo!

I agree that option A is a better approach but can i deploy an EAR to Tomcat? I read somewhere that it is not possible.

I tried option B, i placed my persistence jar in Tomcat/lib but then i got ClassNotFoundExceptions.

I am still stuck

Juggy Obhi wrote:
Note: I am Using TOMCAT 7 as the Server so i doubt if EAR is an option for me.

I really need help. I can see big issues with the way my apps are, alomost every thing is common with these three apps, but at this times, unwillingly i have to duplicate all my jars in all three apps along with the duplication of persistence context at three places. I see same persistence context loading 3 times when i start my tomcat server. Please guide me.

Hi All,

I need your help to know a good structure for the 3 Web Applications i am working on...

core - Web Application to serve a Mobile Phone Application (Consists mainly Servlets)
front - Front End Web Application for the Users (Struts/Spring based)
back - Back End Web Application for the Admin(Struts/Spring based)

All of these Apps uses following JARS -

commons - Project containing common Util classes, Exceptions etc - JAR
persistence - Project containing the JPA entity classes and the persistenceContext.xml under /META-INF - JAR

At present, I copy paste these two JARS in the /lib folder of my Web Apps and as a result, 3 different Persistence Contexts gets created despite it is the same, I want to share both of these jars among my Web Apps. I want a single shared Persistence Context to exist. How can i achieve this?? Please guide.

Thanks and Regards,
Jagpreet Singh
Hi Reza,

Thanks for your advice and at the same time for your book EJB 3 in Action it helped me in getting 91%.
What should be a good design pattern/Structure for an EJB based Enterprise Project.

Currently i follow the following pattern:

An EAR with EJB Module and Web Module.

I make Web Module dependent on EJB module's Client Module. (Through Buildpath)

Can this be improved? I mean is it good to have dependency among Projects. should i export EJB Module's Client Module as a JAR then put it in Web Module. Will it improve the Design?
Hi Ranchers,

It took me 2 months. I had 2/10 level in EJB 2.0, 4/10 level in Spring 2.5.5 and 4/10 level in Hibernate.

EJB 2.0 knowledge gave me the start i needed. Spring helped me a lot as i experienced 1:1 mapping of fundamental concepts e.g. Transactions, AOP, IOC etc. Hibernate helped me in getting JPA in just a week or two.

I refered Following :

1) EJB 3.0 in Action

It took me 1 Chapter Per Day. This book is easy. Simple and interesting language. Mastering EJB 3.0 is also good very conceptual but i went with EJB 3.0

2) EJB 3.0 Spec (JSR 220)

Must Read. You will feel bored in the starting but soon you will find it very informative. You will be underlining every 2nd 3rd line. EJB 3.0 Spec will clear Concepts. Its a MUST READ.

3) Enthuware

Worth Buying. I found 4-5 questions straight out of Enthuware. And many other with the same Concepts emphasized by Enthuware Team.

Wanted to go through MZ Notes but it was too much and too late already.

Visit JavaRanch ! Get Help And Help Others !

I want to thank every Rancher for making Java Ranch such a wonderful place to share and Learn.

Cheers !!! Good Luck.
14 years ago