-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kimberly,
Kimberly Begley wrote:
| I might have messed it up when getting it to compile - I was having
| problems with the getMimeType method with messages like this:
Oops. It looks like I gave you some bad code, too.
| /usr/local/jdk1.5.0_14/bin/javac -d ../../classes/ OpenFile.java
| OpenFile.java:35: cannot find symbol
| symbol : method getServletContext()
| location: interface javax.servlet.http.HttpServletRequest
| ServletContext application = request.getServletContext();
Obviously, that should have been:
ServletContext application =
~ super.getServletConfix().getServletContext();
| OpenFile.java:38: incompatible types
| found : java.lang.String
| required: java.io.File
| return application.getMimeType(file.getName());
And it looks like this should have been
protected String getMimeType(HttpServletRequest request, File file)
{
~ // This is a reasonable default implementation.
~ // Feel free to change it.
~ ServletContext application = request.getServletContext();
~ return application.getMimeType(file.getName());
}
...which will also fix this problem:
| OpenFile.java:92: setContentType(java.lang.String) in
| javax.servlet.ServletResponse cannot be applied to (java.io.File)
| response.setContentType(getMimeType(request, file));
Try my fixes and see what happens.
If the image does not appear, try using LiveHTTPHeaders or some other
tool to watch the HTTP request/response for the image and see what
status code is returned. Feel free to add debug logging statements to
the class to give yourself more information.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkfntJQACgkQ9CaO5/Lv0PBudwCgqOgUD3S9+GAePwQRAJpRNSHQ
NqgAoKuqx54kAqfzGaO+MbaWDMbySgCe
=yuDp
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]