Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

The content type of page directive in jsp code is ignored. #83

Open
mvcbot opened this issue Jan 5, 2016 · 3 comments
Open

The content type of page directive in jsp code is ignored. #83

mvcbot opened this issue Jan 5, 2016 · 3 comments
Labels

Comments

@mvcbot
Copy link

mvcbot commented Jan 5, 2016

Original issue OZARK-67 created by kogawa88:

When fowarding the following jsp page via Ozark, the response always writes the body content with UTF-8 encoding.

<%@ page contentType="text/html; charset=Shift_JIS" pageEncoding="UTF-8" session="false" %>
<html>
..... (snip) .....
</html>

This jsp returns the response with Shift_JIS charset encoding.
The issue can be avoided using JAX-RS api, but it means duplicate declaration of the content type concurrently.
|| How to declare page uri || ||
| @view annotation | Declare @produces("text/html; charset=Shift_JIS"). |
| Return of uri string | Declare @produces("text/html; charset=Shift_JIS"). |
| Return of JAX-RS response | Set the MediaType.TEXTHTML_TYPE with ShiftJIS charset to the response. |

There is no problem if using servlet based MVC framework (like Struts).

@mvcbot
Copy link
Author

mvcbot commented Mar 12, 2016

Comment by lefloh:

Thanks for reporting. I started a discussion in the (https://java.net/projects/mvc-spec/lists/users/archive/2016-03/message/15).

@mvcbot mvcbot added the bug label Apr 26, 2017
@chkal
Copy link
Contributor

chkal commented Feb 26, 2018

A few thoughts on this one:

The pull request mvc-spec/mvc-spec#132 will change how view engines write the result of processing the view to the client. So handling of content type and charset is much more explicit.

IMHO the content type and encoding negotiation should be done by JAX-RS. That's how it works for all other JAX-RS responses.

Perhaps we could simply prevent that the JSP directives do any harm by modifying HttpServletResponse.setContentType() in our wrapper so that calling the method actually doesn't modify the content type? Perhaps it could emit a warning?

@chkal
Copy link
Contributor

chkal commented Feb 26, 2018

@kogawa88: Did you file this issue back then?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants