tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 43557] New: - JK and servlet binary response
Date Thu, 04 Oct 2007 20:55:08 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43557>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43557

           Summary: JK and servlet binary response
           Product: Tomcat 5
           Version: 5.5.20
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P1
         Component: Native:JK
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: castocolina@gmail.com


I have a servlet MyServlet mapped as /servlet/MyServlet/*, this reade a source 
depend relative url before /* and write out binary data, so:

URL url = new URL(urlString);
URLConnection urlc = url.openConnection();
String contentType = urlc.getContentType();

// write headers to response
Map<String, List<String>> headers = urlc.getHeaderFields();
Iterator<String> it = headers.keySet().iterator();
while (it.hasNext()) {
	String key = it.next();
	List<String> value = headers.get(key);
	if (key != null && value != null)
		for (Iterator<String> it2 = value.iterator(); it2.hasNext();) {
			String element = it2.next();
			if (element != null)
				response.addHeader(key, element);
		}
}
response.setContentType(contentType);

// write data to response stream
InputStream in = urlc.getInputStream();
OutputStream out = response.getOutputStream();
int c = 0;
while ((c = in.read()) != -1) {
	out.write(c);
}
in.close();
out.flush();
out.close();

I test this in tomcat with port and work successfully, I have mapped my 
application in apache where my jsps work fine, but when I try MyServlet from 
apache this send me a error (page not found).
I observed putting a System.out.println(any string) in my servlet class and 
this print in the output. I assume the request arrive to the servlet but no 
return the response or Jk no wait, for why?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message