#78 page header failure

closed-invalid
nobody
PSP (7)
5
2005-03-14
2005-03-12
Anonymous
No

i am ibrahim HIDIR from Turkey, Ankara
E-Mail : hipoxi@gmail.com
mobile : +905364422860

i atried to populate a svg image on the fly with PSP with
code like
'''
<embed src="svg_pre.psp?act=2&stid=%s" width="50"
height="50" align="top"
type="image/svg+xml"></embed>....
'''

but in first i just see the codes of SVG not a svg image,
so i closed some lines to get svg image in page.py file
about the header of py or psp files which i generated
i attached page.py file my changes...
thankyou

Discussion

  • Nobody/Anonymous

    pagepy file

     
  • Anonymous - 2005-03-14

    Logged In: YES
    user_id=1238667

    The file you attached, Page.py appears to be part of Webkit.
    How are you subclassing Webkit.Page?

     
  • Jason Hildebrand

    Logged In: YES
    user_id=173690

    it appears that the Page.py has changed writeHTML to call
    _only_ writeContent (not writeHead, writeBodyParts, etc.).

    If you want to serve an image, I recommend using a servlet,
    not PSP.
    Write a servlet which subclasses Page, and override
    writeHTML. Don't use writeContent().

    Example:

    from WebKit.Page import Page

    class MyServlet(Page):
    def writeHTML(self):
    # generate the image and write it out
    data, filename = generateMyImage()
    response = self.response()
    response.setHeader('Content-type', 'image/png')
    response.setHeader('Content-Encoding', 'binary')
    response.setHeader('Content-Length', str(len(data))
    response.setHeader('Content-Disposition', 'inline;
    filename=%s' % filename)
    response.write(data)
    response.streamOut().flush()

    This can also be done from PSP (if you insist). You'd need
    to use the "method" directive to tell PSP you want to
    generate writeHTML instead of writeContent:
    <%@ page method="writeHTML"%>

    hope this helps,
    Jason

     
  • Jason Hildebrand

    • status: open --> closed-invalid
     
  • Nobody/Anonymous

    Logged In: NO

    ibrahim HIDIR
    Hi
    response.setHeader("Content-type", "text/svg") may work i'll
    try it
    thanks

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks