Servlet that produces thumbnails

Hi there,
Does anyone know how to create thumnails and display them in a results page?
I ve created a search servlet that enables you to search documents and images on a server and then displays the results in a webpage.
I ve basically been stuck trying to create thumbnails of the images and displaying them within the HTML.
however i found a thumbnail class that creates thumnails of the image and outputs the thumbnail to a file using the fileoutput stream.
what someone else suggested is that i write a class that takes the location of the file and
returns an outputstream with the image info to the servlet.
I am not exactly sure how to do this. Do I pass a HttpServletResponse object to the new class and then return it to the main servlet somehow?
Or another suggestion was to create the HTML with the url to a tumbnail servlet in an image tag????????
ie <img SRC="/servlets/Serlvetlocation?location="blah.txt">
I doubt this would work!
Anyone have any ideas?
Thanks a million
Dave

<img SRC="/servlets/Serlvetlocation?location="blah.txt">
I doubt this would work!Actually, that works just fine. :-)
The only requirement is that the servlet sets content-type to "image/gif", "image/png" or whatever.

Similar Messages

  • Why does it take I movie 6 hours to produce thumbnail for a new project

    why does it take I movie 6 hours to produce thumbnail for a new project

    Hi
    Seems very long time.
    When my Mac starts to get into a slow-motion in action eg encoding DVDs or alike - it's nearly always due to that free space on Start-Up (Mac OS) hard disk is to low.
    • I try to never have less than 25Gb free space
    • 10Gb - might work but slows down
    • 5Gb - slow and instable
    • less - incredibly slow, instable and if DVD is produced - it usually doesn't work
    This space can not be utilized on other hard disks - Neither for Mac OS or iMovie or iDVDs temp. files - Has to be stored here. No-where else.
    Yours Bengt W

  • Using a class or servlet that implements Serializable

    Hello everyone,
    Can someone please help me. I need to make a program that uses a class or servlet that implements Serializable and then use the values of the variables in servlets.
    The first is using it to validate login. then changing the color of the background, header and footer of each servlet.
    the variables in the Serialized file are all Strings for color, username, password, header text and footer text.
    I tried using the applet tag to run the class in the servlet but it is not working.

    It's not working because you seem to be making random guesses what servlets, serialization and files are

  • Access EJB from Servlet that in different archive?

    <font class="mediumtxt">package kyro.ejb.session;
    import javax.ejb.*;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless(name="StandAlone")
    @Remote(StandAlone.class)
    public class StandAloneBean
    implements StandAlone, StandAloneLocal
    public StandAloneBean() {
    public String sayHello() {     
    return "sayHello";
    I want to access ejb from servlet that .war and .jar not in single .ear. I want to try that just with annotation not xml descriptor cause is easy to understand for me. I use Glassfish. But i can't lookup that ejb. How can i lookup that ejb with jndi? Can't you give me example of servlet to access that? I not use JNDI.properties, are that caused i can't access my ejb? I just thing .war and.jar in one server, are i have to used JNDI.properties. can you explain how to use JNDI.properties in servlet or separate file?
    </font>

    But i can't lookup that ejb. How are you trying and what exception is occurring?
    How can i lookup that ejb with jndi? [https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html|https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html]
    m

  • Problem with Servlet that generates HTML

    Hello,
    I have a servlet that connects to a database to get some information which it displays in a HTML file generated by the same servlet.
    For each line that I want to display from the Database I create the following in my servlet:
    <input type="hidden" value="Ajax-Chelsea" name="bet_1_choice"/>
    However, when I test it in Tomcat it doesn't work, and I realised in Firefox that it gets the above line as follows with the bold part added:
    <input type="hidden" )="" value="Ajax-Chelsea" name="bet_1_choice"/>
    I also use a javascript to add the DB information in another area of the HTML page, another table, but I don't know if this is relevant.
    I don't understand what is wrong. Can someone help me please?

    Thanks for your responses.
    Actually the problem was my javascript. Now it is sorted out.

  • Dng converter not producing thumbnails, set to do so

    My conversions are not producing thumbnails, despite me setting it to do so. I don't know what is going on.

    Hi Robert,
    Thanks for the question.
    Based on my test, please try to following configurations.
    In addition, please let us know if you have RD Connection Broker installed in your domain.
    Hope this helps.
    Best Regards
    Jeremy Wu

  • Servlet that contains native metrhods

              Hi,
              I'm getting an error of unstatisfied link error whenever I call a servlet that
              containes a native methods.
              Does anyone know how to do this? The Weblogic Frequently Asked Questions:(S-side
              java servlet) page
              it has the following at the end :-
              "if you choose to use WebLogic Server to serve your servlets, note that servlets
              using native methods that are not part of the WebLogic
              software will fail with an "Unsatisfied Link" error if they are placed in the
              servlet CLASSPATH. Be sure not to put classes containing
              native methods in the servlet CLASSPATH. Instead, put these servlets in the
              regular CLASSPATH of the WebLogic Server.
              For more information, see Setting up WebLogic Server as an HTTP server, or the
              Java WebServer FAQ at JavaSoft.
              

    Hi,
              A Unsatisfied link basically informs that a shared library could not be
              found in
              1)System path
              2) or the current path.
              Make sure that the shared library is in either of the above
              --Naggi
              "Amin Fakira" <[email protected]> wrote in message
              news:3ac3b70d$[email protected]..
              >
              > Hi,
              >
              > I'm getting an error of unstatisfied link error whenever I call a servlet
              that
              > containes a native methods.
              > Does anyone know how to do this? The Weblogic Frequently Asked
              Questions:(S-side
              > java servlet) page
              > it has the following at the end :-
              > "if you choose to use WebLogic Server to serve your servlets, note that
              servlets
              > using native methods that are not part of the WebLogic
              > software will fail with an "Unsatisfied Link" error if they are placed
              in the
              > servlet CLASSPATH. Be sure not to put classes containing
              > native methods in the servlet CLASSPATH. Instead, put these servlets in
              the
              > regular CLASSPATH of the WebLogic Server.
              > For more information, see Setting up WebLogic Server as an HTTP server,
              or the
              > Java WebServer FAQ at JavaSoft.
              

  • Servlet that never stops...

    Hi,
    Is possible to do a threaded servlet that never finishes to response? something like a servlet that, when called, connect to a database and send the results of a query to client, update the database and try the query again ... like:
    while(true)
    rs = stmt.executeQuery("select * from table where flag = 1");
    while(rs.next())
    os.writeChars(rs.getString(1));
    stmt.executeUpdate("update table set flag = 2")
    os.flush();
    In another place, somebody will insert data in the database, with the flag set to 1 ... so the servlet will ever try to select data that are not sent to client .... then send the new data to client ...
    Is this possible? I tried to do something like this, but when I put the thread.sleep() the servlet stopped ... May I do this? I don't know if the server memory will crashes if I do this ... but I really want to try ....
    If someone have an example .... to send text, for example .... while(true){out.println("text")} ...
    Thanks ....
    LMMJ

    Allright ... in other words ....
    I made a servlet that works ... in the browser it is stopped ... but its thread is already running ... If I insert another registry on my database ... with the flag set up to 1 ... after 5 seconds the flag is changed to 2 by the servlet .... the servlet IS RUNNING .... but I can�t response to browser after the first loop on my thread ... I lost the connection to the browser when I sleeps the thread ... how can I send data to the browser .... make another thing ... and send data again .... without lost the connection? or .... send data to the browser in parts .... this could solve my problem ....
    thanks
    LMMJ

  • Compiling a Servlet that uses JavaBean

    I have a servlet that will get data from a JavaBean which is created before in a jsp file. While I trying to compile the servlet I am getting this message:
    --------------------Configuration: JDK version 1.3 <Default>--------------------
    Command : "C:\jdk1.3\bin\javac.exe" -d "C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes" C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java
    Directory : C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\TasitKayitGirisi.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean = (SimpleBean) session.getAttribute
    ^
    ("simpleBean");
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean= (SimpleBean) session.getAttribute("simpleBean");
    ^
    2 errors
    Process completed.
    Where is the problem. SimpleBean is successfully being initializing in my jsp file. But I couldn't compile my servlet that will get data from that bean. Both my servlet and bean are in the same package. I am using JCreator to compile servlets. I think the problem is the compile string that JCreator uses. Can you help me. Thx in advance.

    Looks like an import Problem.
    The Compiler is not able to "see" the SimpleBean Class.
    Take care of the Classpath and your imports.
    Happy Coding. :-)

  • *** Example of JSF Image servlet that can write image to network drive ??

    Hi Guys,
    Does anyone have an example of a of JSF Image servlet that can Write image to network drive ??
    I can write an image to my local drive on my tomcat app server. But when I try to map to a network drive with IP or Mapped drive it fails.
    Any help out there ??
    Thanks
    Phil

    Hi,
    The drive I am trying to access is on a box 45.65.111.115 ip
    I have mapped the box and drive to M:
    Setting sharing on...
    I have tried a few new ways...
    imageDrive2=M:\\test_images\\
    gives this errror
                java.io.FileNotFoundException: M:\test_images\first250k\16Sep0857_Phil_Tucson.JPG (The system cannot find the path specified)
         at java.io.RandomAccessFile.open(Native Method)
         at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
         at javax.imageio.stream.FileImageOutputStream.<init>(FileImageOutputStream.java:44)=============================================
    imageDrive3=\\\\45.65.111.115\\first250k\\test3.jpg
    gives this errror
    java.io.FileNotFoundException: \\45.65.111.115\first250k\test3.jpg (Access is denied)
         at java.io.RandomAccessFile.open(Native Method)
         at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
         at javax.imageio.stream.FileImageOutputStream.<init>(FileImageOutputStream.java:44)
         at com.sun.imageio.spi.FileImageOutputStreamSpi.createOutputStreamInstance(FileImageOutputStreamSpi.java:37)========================================================
    imageDrive4=\\\\45.73.111.115\\test_images\\test4.jpg
    gives this errror
    java.io.FileNotFoundException: \\45.73.111.115\test_images\test4.jpg (Access is denied)
         at java.io.RandomAccessFile.open(Native Method)
         at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
         at javax.imageio.stream.FileImageOutputStream.<init>(FileImageOutputStream.java:44)
         at com.sun.imageio.spi.FileImageOutputStreamSpi.createOutputStreamInstance(FileImageOutputStreamSpi.java:37)
         at javax.imageio.ImageIO.createImageOutputStream(ImageIO.java:391)
         at javax.imageio.ImageIO.write(ImageIO.java:1483)=============================================================================
    Any help out there??
    Phil

  • Name of domain that produced error

    Hi,
    How can I find out the name of the domain that produced the error?
    Thanks,
    Malini.

    Hi,
    When the ABAP short dump is displayed, choose "Debugger" and then, using the call stack display, select the program ZGUIXT16. Now you can display the value of the field "DOM". This is the name of the domain that produced the error.
    If you have no possibility to invoke the debugger, only the ABAP short dump, then please look at the value of table DD04L. It contains the data element at the time of the breakdown.
    For example, the entry could look as follows:
    DD04L |RESADSGDEMAND  A0000RESA
    The data element in this case  is RESADSGDEMAND. Using the repository information system, you can now find the domain name, which in this case is also RESADSGDEMAND.
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • Adding a Button a Servlet that calls a JSP

    How would one put a Button in a Servlet that directs to a JSP.
    ... I have created a servlet that displays records from a database, but I would like to add a button that returns to a JSP page.
    I thought something like this would help...
    out.println("<input type='submit' value='Return to Main Page' name='response.sendRedirect ('MainPage.jsp');'/>");Help...
    Edited by: Gusha on 11-Oct-2008 13:23

    You edited your message with a code snippet:
    Gusha wrote:
    out.println("<input type='submit' value='Return to Main Page' name='response.sendRedirect ('MainPage.jsp');'/>");
    Couple of things:
    1) Presentation logic belongs in JSP, not in Servlet. Using out.print in either JSP or Servlet is a bad practice.
    2) Java runs at server side, not at client side.

  • Servlet that executes at specific time intervals ?

    Hi
    I need to have my Servlet that is loaded onto the webserver, run at specific time intrevals, say every 10 minutes.
    How do I do that ?
    Thanx in advance
    Aragorn

    I have trouble with this concept.
    HTTP is a request/response protocol. Usually a servlet runs when it receives an HTTP request and sends back an HTTP response.
    If you want the servlet to wake up and do something at a fixed interval, it's not responding to an HTTP request anymore. What does it do with the HTTP response that's generated? What happens if it receives an HTTP request from an external client after waking up and starting the timed process? Have you made sure that your servlet is thread-safe in that case?
    This feels less like a servlet and more like something else (e.g., an RMI service, EJB, or multi-threaded server). It sounds like you're using the servlet engine/container as a convenient service container, but I don't think servlets were meant to be used that way.
    I'll be happy to take instruction on this if I'm incorrect. I just thought I'd disagree to see what the response might be. Thanks - MOD

  • Servlet that prints off XML to screen

    Hi all.
    I'm wondering if anyone here has ever out.print a xml document from a servlet. I'm writing a servlet that reads in an object in XML format and then prints it off as HTML. How do you do to make the browser NOT ignore all the XML tags? I would like to display the XML as it is, with all the tags.
    Thanks in advance for any suggestions.

    I had a similar situation working a while ago.
    I think you can use the response header variable content-type set to text/xml. That would tell the browser to treat the document as xml document. If the browser supports XML display (like IE5 which has a built-in stylesheet that renders the XML document as a tree), it would display it.
    I am not sure if that answers your question.
    Anyway, I hope that helps.

  • How to notify servlet that the external process is ended?

    In my servlet, i got a process which runs a c++ program
    How do I notify the servlet that the process is ended?
    Process abc;
    Runtime rt = Runtime.getRuntime();
    String inputline =("c:/windows/system32/cmd.exe /c c:/ws/qb.exe");
                   try {
                     abc = rt.exec(inputline);
                 } catch (Exception ex) {     
                     out.println(ex.getMessage());
                 }                   

    Use Process#waitFor(). Read the API docs.

Maybe you are looking for