• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

using servlet to generate png image file

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As the title suggest, could anyone give me hints and pointers to get me started?



I've tried yahoo and google search with no concrete tutorial/examples in sight.
[ August 29, 2006: Message edited by: Alan Yap ]
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This link might be useful for you: Generating images with JSP/Servlet
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch Alan Yap

There some links to generate image file with example of source code
it might be helpful for you..

Create dynamic images in Java servlets
Using Servlets to Generate JPEG Images
Creating a Buffered Image from an image
Images - BufferedImage
[ August 29, 2006: Message edited by: Saif Uddin ]
 
Alan Yap
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks guys,

going through those links now.

Found some tutorials earlier on this too, using JSP. Tweaked their code a bit and it works in my machine (Resin 2.1 + J2SDK1.4.0).

But when uploaded into my hosting server to be tested, this exception pops up:
java.security.AccessControlException: access denied (java.io.FilePermission
/tut/z.png delete)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkDelete(SecurityManager.java:990)
at java.io.File.delete(File.java:869)
at javax.imageio.ImageIO.write(ImageIO.java:1482)
at _pngwrite__jsp._jspService(/tut/pngwrite.jsp:19)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:595)

While waiting for the hosting to get back to me on this issue, I was wondering if this is caused by the restriction imposed by the hosting, or should I tweak my code a bit more to fix it ?
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a hosted environment you won't have access to the complete file system, just to your personal space or web app directory. That most likely does not include a top-level directory called "/tut". You'll need to save the image in a directory that's part of your environment there.
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic