You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ar...@EASTPOINT.COM on 2003/08/26 01:19:07 UTC

Setting content-type

Hello,

I am VERY new to Tapestry, working on my first Tapestry application. For
this application I need to set the content-type header to "application/hta".
The actual content is just HTML - only the header changes. I found some
references in the archive to implementing an IMarkupWriter, but these were
for Excel or PDF content. I am hoping that to just change the content-type
header there is a simpler solution, like an attribute somewhere in one of
the parameter files. Is there such a simple solution?

Thank You,
Art

RE: Setting content-type

Posted by John Meredith <ps...@t-online.de>.
My bad. Thanks for the clarification :-)

  - John

On Tue, 2003-08-26 at 12:25, Mind Bridge wrote:
> Hi John,
> 
> The method that you show is definitely a good way to add headers to the
> Shell.
> 
> I want to mention, though, that in 3.0 the Shell component automatically
> adds an http-equiv="content-type" header with the content type defined in
> the MarkupWriter (you can turn this off if necessary).
> 
> Thus, it is probably better to change the content type using the method
> described in my previous message and the Shell will take care of the
> http-equiv part.
> 
> Best regards,
> -mb
> 
> -----Original Message-----
> From: John Meredith [mailto:psynix@t-online.de]
> Sent: Tuesday, August 26, 2003 12:11 PM
> To: Tapestry users
> Subject: Re: Setting content-type
> 
> 
> Morning,
> 
> The easiest way is to use the Shell component and use it's delegate
> parameter e.g.:
> 
> <html jwcid="shell">
>   <span jwcid="meta@Block">
>     <meta http-equiv="Content-Type" content="application/hta"/>
>     ... any other meta tags
>   </span>
> 
>   <body jwcid="@Body">
>     ... whatever
>   </body>
> </html>
> 
> <component id="shell" type="Shell">
>   <static-binding name="title" expression="PageTitleString"/>
>   <binding name="delegate" expression='new
> org.apache.tapestry.components.BlockRenderer(getComponent("metaBlock"))'/>
> </component>
> 
> It seems like a lot of overhead, but there's method in the madness as it
> allows you define your own delegate (which implements the IRender
> interface) which could, for example, generate the meta tags dynamically.
> 
> You could also extend the Shell component (see Shell.java for what I
> mean) - but this would be overkill in your case I think.
> 
> Hope this helps.
> 
>   - John
> 
> On Tue, 2003-08-26 at 01:19, art_w@EASTPOINT.COM wrote:
> > Hello,
> >
> > I am VERY new to Tapestry, working on my first Tapestry application. For
> > this application I need to set the content-type header to
> "application/hta".
> > The actual content is just HTML - only the header changes. I found some
> > references in the archive to implementing an IMarkupWriter, but these were
> > for Excel or PDF content. I am hoping that to just change the content-type
> > header there is a simpler solution, like an attribute somewhere in one of
> > the parameter files. Is there such a simple solution?
> >
> > Thank You,
> > Art
> --
> John Meredith <ps...@t-online.de>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
John Meredith <ps...@t-online.de>

RE: Setting content-type

Posted by Mind Bridge <mi...@yahoo.com>.
Hi John,

The method that you show is definitely a good way to add headers to the
Shell.

I want to mention, though, that in 3.0 the Shell component automatically
adds an http-equiv="content-type" header with the content type defined in
the MarkupWriter (you can turn this off if necessary).

Thus, it is probably better to change the content type using the method
described in my previous message and the Shell will take care of the
http-equiv part.

Best regards,
-mb

-----Original Message-----
From: John Meredith [mailto:psynix@t-online.de]
Sent: Tuesday, August 26, 2003 12:11 PM
To: Tapestry users
Subject: Re: Setting content-type


Morning,

The easiest way is to use the Shell component and use it's delegate
parameter e.g.:

<html jwcid="shell">
  <span jwcid="meta@Block">
    <meta http-equiv="Content-Type" content="application/hta"/>
    ... any other meta tags
  </span>

  <body jwcid="@Body">
    ... whatever
  </body>
</html>

<component id="shell" type="Shell">
  <static-binding name="title" expression="PageTitleString"/>
  <binding name="delegate" expression='new
org.apache.tapestry.components.BlockRenderer(getComponent("metaBlock"))'/>
</component>

It seems like a lot of overhead, but there's method in the madness as it
allows you define your own delegate (which implements the IRender
interface) which could, for example, generate the meta tags dynamically.

You could also extend the Shell component (see Shell.java for what I
mean) - but this would be overkill in your case I think.

Hope this helps.

  - John

On Tue, 2003-08-26 at 01:19, art_w@EASTPOINT.COM wrote:
> Hello,
>
> I am VERY new to Tapestry, working on my first Tapestry application. For
> this application I need to set the content-type header to
"application/hta".
> The actual content is just HTML - only the header changes. I found some
> references in the archive to implementing an IMarkupWriter, but these were
> for Excel or PDF content. I am hoping that to just change the content-type
> header there is a simpler solution, like an attribute somewhere in one of
> the parameter files. Is there such a simple solution?
>
> Thank You,
> Art
--
John Meredith <ps...@t-online.de>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Setting content-type

Posted by John Meredith <ps...@t-online.de>.
Morning,

The easiest way is to use the Shell component and use it's delegate
parameter e.g.:

<html jwcid="shell">
  <span jwcid="meta@Block">
    <meta http-equiv="Content-Type" content="application/hta"/>
    ... any other meta tags
  </span>

  <body jwcid="@Body">
    ... whatever
  </body>
</html>

<component id="shell" type="Shell">
  <static-binding name="title" expression="PageTitleString"/>
  <binding name="delegate" expression='new
org.apache.tapestry.components.BlockRenderer(getComponent("metaBlock"))'/>
</component>

It seems like a lot of overhead, but there's method in the madness as it
allows you define your own delegate (which implements the IRender
interface) which could, for example, generate the meta tags dynamically.

You could also extend the Shell component (see Shell.java for what I
mean) - but this would be overkill in your case I think.

Hope this helps.

  - John

On Tue, 2003-08-26 at 01:19, art_w@EASTPOINT.COM wrote:
> Hello,
> 
> I am VERY new to Tapestry, working on my first Tapestry application. For
> this application I need to set the content-type header to "application/hta".
> The actual content is just HTML - only the header changes. I found some
> references in the archive to implementing an IMarkupWriter, but these were
> for Excel or PDF content. I am hoping that to just change the content-type
> header there is a simpler solution, like an attribute somewhere in one of
> the parameter files. Is there such a simple solution?
> 
> Thank You,
> Art
-- 
John Meredith <ps...@t-online.de>


RE: Setting content-type

Posted by Mind Bridge <mi...@yahoo.com>.
Hi Laurent,

With 3.0 it is best to do:

    public IMarkupWriter getResponseWriter(OutputStream out)
    {
        return new HTMLWriter("application/hta", getOutputEncoding(), out);
    }

The output encoding can be manipulated using a property, but usually there
is no need to do so.

-mb


-----Original Message-----
From: Laurent Cornelis [mailto:laurent@ubiquity.be]
Sent: Tuesday, August 26, 2003 11:23 AM
To: Tapestry users
Subject: Re: Setting content-type


Someone correct me if I'm wrong, but I think you have to override the
getResponseWriter() method of your IPage with something like :

public IMarkupWriter getResponseWriter(OutputStream out) {
    return new net.sf.tapestry.html.HTMLWriter("application/hta",out);
}

Regards,

Laurent Cornelis

----- Original Message -----
From: <ar...@EASTPOINT.COM>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, August 26, 2003 1:19 AM
Subject: Setting content-type


> Hello,
>
> I am VERY new to Tapestry, working on my first Tapestry application. For
> this application I need to set the content-type header to
"application/hta".
> The actual content is just HTML - only the header changes. I found some
> references in the archive to implementing an IMarkupWriter, but these were
> for Excel or PDF content. I am hoping that to just change the content-type
> header there is a simpler solution, like an attribute somewhere in one of
> the parameter files. Is there such a simple solution?
>
> Thank You,
> Art
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Setting content-type

Posted by Laurent Cornelis <la...@ubiquity.be>.
Someone correct me if I'm wrong, but I think you have to override the
getResponseWriter() method of your IPage with something like :

public IMarkupWriter getResponseWriter(OutputStream out) {
    return new net.sf.tapestry.html.HTMLWriter("application/hta",out);
}

Regards,

Laurent Cornelis

----- Original Message -----
From: <ar...@EASTPOINT.COM>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, August 26, 2003 1:19 AM
Subject: Setting content-type


> Hello,
>
> I am VERY new to Tapestry, working on my first Tapestry application. For
> this application I need to set the content-type header to
"application/hta".
> The actual content is just HTML - only the header changes. I found some
> references in the archive to implementing an IMarkupWriter, but these were
> for Excel or PDF content. I am hoping that to just change the content-type
> header there is a simpler solution, like an attribute somewhere in one of
> the parameter files. Is there such a simple solution?
>
> Thank You,
> Art
>


RE: Setting content-type

Posted by Adam Greene <ag...@romulin.com>.
What we do to change the HTMLWriter is create a new class that subclasses
BasePage and make all of our pages use the Subclass instead of BasePage.
See attached.

-----Original Message-----
From: art_w@EASTPOINT.COM [mailto:art_w@EASTPOINT.COM]
Sent: Monday, August 25, 2003 8:19 PM
To: tapestry-user@jakarta.apache.org
Subject: Setting content-type


Hello,

I am VERY new to Tapestry, working on my first Tapestry application. For
this application I need to set the content-type header to "application/hta".
The actual content is just HTML - only the header changes. I found some
references in the archive to implementing an IMarkupWriter, but these were
for Excel or PDF content. I am hoping that to just change the content-type
header there is a simpler solution, like an attribute somewhere in one of
the parameter files. Is there such a simple solution?

Thank You,
Art