diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-20 08:38:54 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-20 08:38:54 +0000 |
commit | e0b4977c26901a8fba08d6da551bd6f36e3a7ffa (patch) | |
tree | db330af83645d71023f0a7912e0fd9bc6771da14 /sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org | |
parent | 4f7f10f97d60a5e7083f9a5b190c2818de7359a1 (diff) |
Properly setting contentType for known files, to avoid issues with htmlUnit
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@912093 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java b/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java index 80881f7859..3e8e396927 100644 --- a/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java +++ b/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java @@ -26,13 +26,13 @@ import java.net.URLDecoder; import java.text.ParseException; import javax.servlet.ServletException; -import javax.servlet.ServletResponse; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.http.HTTPCacheContext; +import org.apache.tuscany.sca.common.http.HTTPContentTypeMapper; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; @@ -124,6 +124,14 @@ public class HTTPBindingListenerServlet extends HttpServlet { throw new ServletException((Throwable)responseMessage.getBody()); } + if(response.getContentType() == null || response.getContentType().length() == 0){ + // Calculate content-type based on extension + String contentType = HTTPContentTypeMapper.getContentType(id); + if(contentType != null && contentType.length() >0) { + response.setContentType(contentType); + } + } + // Write the response from the service implementation to the response // output stream InputStream is = (InputStream)responseMessage.getBody(); |