Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 12th, 2005, 03:48 AM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
refreshing the BLOB

I've made a small web application about movies. For those interested
to see it work : go to http://www.gertcuppens.org/servlet/cluif.
The web app works with servlets and JSP's.

Now the problem is this : in the local version, I can select on the first
page the letter "B" to get all movies starting with a B. When I select
, say, "Bad Santa" in thsi list, I can see the detail screen containing
the poster of the movie (a BLOB).
If I go back to the list and select "the Blob" from 1958, I see the poster
with the photo of Steve Mc QUeen. If I go back to the list once more,
I can select "the Blob" from 1988, and I see the poster from this movie.

So locally, everything is OK. Then I published the web application on my
web site, and this still keeps on working.
But when I go to the office, and try to go to my web application at work,
whichever poster I see first, this is the poster that will be shown on all
the other detail screens.
So, for instance, with the above scenarion, I see the data from "bad santa"
and its poster. If I go to the blob, I see the data of the blob (title, year)
but still the poster of "bad santa".

So, at work, I can only view the first poster, even though I select other
movies. Can anyone tell me where the error is ?

Reply With Quote
  #2  
Old March 14th, 2005, 12:26 PM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
The error has been found : it was due to the caching of
the proxyserver at work. The fact that I wrote
Code:
 
<img src="/gco/cluifimg" width="150" height="200">

made the proxyserver think he already had done that when I asked him
for a second poster. So, he always kept on showing the first poster .

What is the solution ? Well, a very simple one : add a parameter
so the proxyserver thinks he has to do something different.
The most simple thing is to add a parameter equal to date + time.

So, writing the following lines did the trick :

Code:
 
<img src="/gco/cluifimg?nocache=<%=new java.util.Date()%>" width="150" height="200">


With this line I fooled the proxyserver and got every poster I asked for.
I thought this might interest some other members of this forum.

Reply With Quote
  #3  
Old March 14th, 2005, 02:05 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
This isn't directly related to your question [in fact, I haven't finished reading your posts], but I clicked the link in your first post, and it displayed the HTML tags as plain text.

Reply With Quote
  #4  
Old March 14th, 2005, 02:12 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
how does /gco/cluifimg know which image to return?

what happens if i were to just access http://domain/gco/cluifimg ?

Myself, I would have added a parameter to the image... perhaps movie id or something.
This way, the proxy CAN cache if it knows it's already returned that certain image.

Example: <img src="/gco/cluifimg?id=100">

<picky-observation>Where's your ALT text? </picky-observation>

Reply With Quote
  #5  
Old March 17th, 2005, 02:27 AM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
I have a javabean to know which image should be displayed.
Inside the cluifFilmDetail.jsp I have added

Code:
<jsp:useBean id="film" class="org.gertcuppens.cluif.Film" scope="session"/>


this javabean contains the filmposter found in the database.
With/gco/cluifimg I refer to the web.xml inside the gco folder of the webapps folder
of Tomcat. This web.xml contains the following lines

Code:
 <servlet> 
<servlet-name>org.gertcuppens.controller.ImageServlet</servlet-name>
<servlet-class>org.gertcuppens.controller.ImageServlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>org.gertcuppens.controller.ImageServlet</servlet-name>
<url-pattern>/cluifimg</url-pattern>
</servlet-mapping>


And so I refer to a servlet who does nothing else than accepting a blob and writing it
down as an array of bytes. How does this servlet get the film javabean ?
Well, this javabean is inside the session. So, all the servlet has to do is grab the session,
unpack the film javabean and look for the blob of the film.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > refreshing the BLOB


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT