You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> on 2008/10/17 14:57:23 UTC

FilterDispatcher - ContentType not set, how to set in to text/html?

Hi.
You can configure the action to set the result type to e.g. plain text ( 
http://struts.apache.org/2.x/docs/result-types.html).

How to tell the action, its content type is text/html?
I am calling my action 

<action name="registerStatic" class="com.opensymphony.xwork2.ActionSupport">
	<result name="success">/WEB-INF/view/consumer/register.jsp</result>
	<result name="input">/WEB-INF/view/consumer/register.jsp</result>
</action>

and the http header misses the contentType.
I am using struts-2.0.11.2.

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
	-- Linus Torvalds

Re: FilterDispatcher - ContentType not set, how to set in to text/html?

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Am Freitag, 17. Oktober 2008 16:18:27 schrieb Martin Gainty:
> you can configure fileUpload Interceptor to allow these predefined types

Its not a upload problem. I am delivering a simple jsp page with more or less 
static html and there is no content type set.
I don't want a method at the FilterDispatcher to set it, but i wonder why it 
gets not set (maybe some portlet - servlet problem, as it seems people who 
are using only the FilterDispatcher does not have this problem ... ).

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
	-- Linus Torvalds

RE: FilterDispatcher - ContentType not set, how to set in to text/html?

Posted by Martin Gainty <mg...@hotmail.com>.
you can configure fileUpload Interceptor to allow these predefined types
http://cwiki.apache.org/WW/file-upload-interceptor.html

<interceptor-ref name="fileUpload">
  <param name="allowedTypes">
     image/png,image/gif,image/jpeg
  </param>
</interceptor-ref>
http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/dispatcher/FilterDispatcher.html
If there is a reason for supporting setContentType method in FilterDispatcher then suggest the reasons in JIRA
https://issues.apache.org/struts/secure/IssueNavigator.jspa?reset=true&pid=10030&fixfor=21861

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Date: Fri, 17 Oct 2008 06:33:24 -0700
> From: newton.dave@yahoo.com
> Subject: Re: FilterDispatcher - ContentType not set, how to set in to text/html?
> To: user@struts.apache.org
> 
> --- On Fri, 10/17/08, Torsten Krah wrote:
> > Answering to myself - although i am confused that this is
> > not the default when delivering jsps:
> 
> AFAIK it is; I've never had to set the content type.
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Stay organized with simple drag and drop from Windows Live Hotmail.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_102008

Re: FilterDispatcher - ContentType not set, how to set in to text/html?

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Am Freitag, 17. Oktober 2008 15:33:24 schrieb Dave Newton:
> AFAIK it is; I've never had to set the content type.

I am running my struts2 war in Pluto 1.1.6 (Tomcat 5.5.x) and Liferay 5.1.x 
(JBoss 4).
Portlet Actions are working fine (because the container sets the stuff).
But running Actions through the FilterDispatcher results in a missing 
contentType header.

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
	-- Linus Torvalds

Re: FilterDispatcher - ContentType not set, how to set in to text/html?

Posted by Dave Newton <ne...@yahoo.com>.
--- On Fri, 10/17/08, Torsten Krah wrote:
> Answering to myself - although i am confused that this is
> not the default when delivering jsps:

AFAIK it is; I've never had to set the content type.

Dave


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


Re: FilterDispatcher - ContentType not set, how to set in to text/html?

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Am Freitag, 17. Oktober 2008 14:57:23 schrieb Torsten Krah:
> How to tell the action, its content type is text/html?

Answering to myself - although i am confused that this is not the default when 
delivering jsps:

... extends ActionSupport implements ServletResponseAware ...
...
response.setContentType("text/html");
...


-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
	-- Linus Torvalds