Content « Header « JSP-Servlet Q&A

1. Java webapp: adding a content-disposition header to force browsers "save as" behavior

Even though it's not part of HTTP 1.1/RFC2616 webapps that wish to force a resource to be downloaded (rather than displayed) in a browser can use the Content-Disposition header like this:

Content-Disposition: ...

2. Java (JSP): repeating the contentType header in a "sub-jsp"

What happens when headers are repeated in a .jsp you include in another .jsp? For example if example.jsp starts with this:

<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="2.0" xmlns:jsp="">
< contentType="text/html; charset=UTF-8" />

<div class="content">

<jsp:include page="support.jsp"/>
(it includes support.jsp) And ...

3. Setting the margins in a MS Word file for a HTTP response that has word content

I've got the follow code that sets up the HTTPServletResponse in a Jira plugin

    private void setupResponseHeader() {
    String filename = "AuditReport";

4. How can I read the content of the content-disposition header?

TEMPORARY SOLVED: InputStream closed in Apache FileUpload API

I want to read the content of the content-disposition header but request.getHeader ("content-disposition") always return null and request.getHeader ("content-type") only returns the first ...