[opencms-dev] Setting manual Content-Type header from a jsp
Mike Dikan
dikeman at gmail.com
Tue Jun 16 00:06:08 CEST 2009
The property change worked like a charm, thanks Stephan. However,
since as I mentioned before, these files are coming over as a result
of the built in synchronization process, and that process doesn't have
support for properties, I'd like to try the approach you mention later
in your message. I see that the request/response are wrapped using
CmsFlexRequest/CmsFlexResponse, but what i don't see is how to get at
the flex controller using the request/response... Can you provide a
little more detail on this step, and how it can be used to get at the
top-level response to set the headers properly?
-Mike
On Jun 15, 2009, at 5:01 PM, Stephan Hartmann wrote:
> Hi Mike,
>
> the reason why your attempts for setting the content type by either
> using the response object or the contentType attribute in the page
> directive is that the JSP is usually embedded by using the include
> dispatcher of the request. From within an included webapp resource
> (either servlet or JSP or filter) there is no way to modify response
> headers, as defined in the servlet spec.
> For your case, it would be sufficent to set the cache property of your
> JSP to "bypass" which will lead to a forward instead of an include,
> what
> will give you control over your response headers as well. Note that
> you
> will lose flex cache functionality with that property set.
> Another way to set response headers from an included JSP would be to
> get
> hold of the top response object through the CmsFlexController object
> of
> your request.
>
> Regards,
> Stephan
>
> Mike Dikan schrieb:
>> I have need for a jsp that spits out dynamic javascript called
>> something like javascript_dynamic_variable_init.jsp. In opencms, if
>> you have a file on the vfs that has extension .js, the content-type
>> header that is returned is of type 'application/x-javascript', and if
>> you have a file that ends in extension .jsp, the content-type header
>> is 'text/html'. I need to change the content-type header returned
>> for
>> a file ending in .jsp to the .js header, but any attempts to do so
>> either by using the <%@page contentType="" %> tag, or operating on
>> the
>> response directly is clobbered by opencms. Does anyone know how to
>> do
>> this in opencms 7.0.5?
>>
>> And to head off any questions, i can't rename the file to .js,
>> because
>> the file needs to be brought in as a jsp opencms 'type' via the
>> synchronize functionality, which will only create types based on file
>> extensions, as far as I know.
>>
>> Thanks!
>> -Mike
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list,
>> please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
> visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list