Menu

call StreamingServlet via Hyperlink

NikiG
2008-03-10
2013-04-24
  • NikiG

    NikiG - 2008-03-10

    Hello!

    I tried to open a Servlet with Hyperlink.openLocation("/pdfstream?filename=Test.pdf") but it doesn't work. The Servlet definition looks like this:
        <servlet>
            <servlet-name>PdfStream</servlet-name>
            <display-name>Pdf-Streaming Servlet</display-name>
            <servlet-class>servlets.PdfStreamingServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>PdfStream</servlet-name>
            <url-pattern>/pdfstream/*</url-pattern>
        </servlet-mapping>

    What do I have to do to call a Servlet within my Thinwire application? I just want to stream the file from the Server to the browser/client.

    Thanks for help

     
    • al0

      al0 - 2008-03-10

      location is open location is calculated as if it was typed in client browser, so it shall be "http://yourhost:8080/yourapplication/pdfstream?filename=Test.pdf"

       
      • NikiG

        NikiG - 2008-03-10

        Ok, I thought it cannot be called relative to the webapps root dir. I put the path in a configfile, so it can get changed dynamically.
        Thanks for the fast answer.

         
        • al0

          al0 - 2008-03-10

          Really, you even need not it in the config - it can be calculated dynamically - host may be obtained from the parameters of main method of the main class of your TW application and then combined with Application.current().getBaseFolder()

           
          • NikiG

            NikiG - 2008-03-10

            Thank you, I will check it.

             

Log in to post a comment.

MongoDB Logo MongoDB