struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Newfield <d...@newfield.org>
Subject Re: Bizarre sporadic problem with streaming a stylesheet.
Date Tue, 21 Sep 2010 15:29:02 GMT
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 .css...you could either add 
css as an action extension or maybe use urlrewrite to make a .css url 
actually result in your .action request.

> public void getConfiguredStylesheet() throws IOException, Exception {

Shouldn't all action methods return String?  What's the action mapping 
associated with this?

> 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.

> 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:
http://struts.apache.org/2.2.1/docs/stream-result.html

-Dale

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


Mime
View raw message