You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by gonzalomp87 <go...@gmail.com> on 2012/09/26 17:28:26 UTC

Re: BufferedImage in Tapestry

Hi! Up the thread because I have a problem.

I was working with Jetty and the above code worked perfectly but  in tomcat
not showing the image and nor give any error .Anyone know what could be the
cause?



--
View this message in context: http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5716512.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: BufferedImage in Tapestry

Posted by gonzalomp87 <go...@gmail.com>.
Solved!!!!! 

I solved it adding a few lines to the server.xml file in tomcat / conf
Add appContextProtection="false" inside the tag
 <Listener
className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>



<Listener
className="org.apache.catalina.core.JreMemoryLeakPreventionListener" 
		appContextProtection="false"/>





--
View this message in context: http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5716734.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: BufferedImage in Tapestry

Posted by gonzalomp87 <go...@gmail.com>.
I look the headers that tomcat return. 

[18:05:12.747] GET
http://localhost:8080/dicom-1.0.0/mostrarimagenpage/1.3.6.1.4.1.9328.50.3.10887
[HTTP/1.1 500 Error Interno del Servidor 424ms]

and inside show 2 fields where I think is the problem

x-Tapestry-ErrorMessage:
org.apache.tapestry5.ioc.internal.OperationException
Content-Type: text/html;charset=UTF-8

In my code I tried change the content-type with this lines:

@Meta("tapestry.response-content-type=image/JPEG")
@AuthenticationPolicy(AuthenticationPolicyType.AUTHENTICATED_USERS)
public class MostrarImagenPage 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5716694.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: BufferedImage in Tapestry

Posted by Lance Java <la...@googlemail.com>.
As I said before, use firebug or a similar tool to inspect the HTTP response
for the image. Are there any differences between the Jetty response and the
Tomcat response? Take note of the response headers.

Also, have you tried setting the content length header?



--
View this message in context: http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5716536.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: BufferedImage in Tapestry

Posted by gonzalomp87 <go...@gmail.com>.
I post the problem on another forum and an user told me that I need put the
contentType for the browser know that is an image.
 

I add this line but doesn`t work yet

public void prepareResponse(Response response) {

response.setHeader("Content-type","image/jpeg");
response.setHeader("Content-Disposition", "inline;filename=" + filename+
((extension == null) ? "" : ("." +extension)));
}



--
View this message in context: http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5716533.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: BufferedImage in Tapestry

Posted by Lance Java <la...@googlemail.com>.
Some disadvantages worth considering when using data URLs for images:
http://en.wikipedia.org/wiki/Data_URI_scheme#Disadvantages



--
View this message in context: http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5716529.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: BufferedImage in Tapestry

Posted by Giulio Micali <gi...@gmail.com>.
for such kind of jobs, i use the following method:

<img src="data:image/gif;base64,<here the base64 encoded stream>"
width="80" height="15" />


Returning the entire tag, so I can include it even in ajax responses.

I hope it can be helpful,
Giulio

Re: BufferedImage in Tapestry

Posted by Lance Java <la...@googlemail.com>.
Using firebug or similar, can you inspect the response from the image
request? What headers are included?

Perhaps setting the "Content-Length" header on the image response will help.
This should be the byte count (inputStream.available() or file.length()
etc).



--
View this message in context: http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5716515.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org