struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Belfer-Shevett <>
Subject Re: Bizarre sporadic problem with streaming a stylesheet.
Date Tue, 21 Sep 2010 17:00:42 GMT
On Tue, 21 Sep 2010, Dale Newfield wrote:
> On 9/21/10 12:36 AM, Dave Belfer-Shevett wrote:
>> <LINK REL="StyleSheet" href="getConfiguredStylesheet.action"
>> type="text/css">
> It shouldn't matter, but the browser might be deciding something wonky based 
> on the fact that that url doesn't end could either add css as an 
> action extension or maybe use urlrewrite to make a .css url actually result 
> in your .action request.

Tried it both ways -one as an action class, one as a css.  The headers 
didnt' vary enormously (or relevantly).

>> public void getConfiguredStylesheet() throws IOException, Exception {
> Shouldn't all action methods return String?  What's the action mapping 
> associated with this?

-should-, but all this class is doing is writing to the 
HttpServletResponse object.

>> resp.getWriter().write(sb.toString());
>> resp.getWriter().flush();
>> resp.getWriter().close();
> The appropriate return value for actions that generate their own output is 
> null.  This is rarely the best solution, though, as there's more to the http 
> protocol than the content of the response.  You're returning no header 
> information.

That's not the case actually - the http headers are there (curl -i shows 

>> curl http://localhost:8080/congo/public/getConfiguredStylesheet.action
> try curl -i to see the header info.  Compare that output to a curl -i request 
> for a .css file delivered by your web app through more conventional methods.
>> resp.setContentType("text/css");
> I believe that since you're generating the response yourself this has no 
> effect.
> If you want to return a stream, there is a stream result type that'll help 
> you out:

It's not -really- a stream.  I perhaps used the wrong name there.  See 
other comments in this thread (or comments taht'll be there in a few 
minutes :)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message