Helen,
You can only set the contentType of a response once. The last
setContentType method call will be the value that is used.
Hence your code:
response.setContentType("text/vnd.wap.com");
response.setContentType("text/vnd.wap.wml");
response.setContentType("image/vnd.wap.wbmp");
will result in the content type being sent to image/vnd.wap.wbmp which is
NOT what you want.
Set the content type of your document to
text/vnd.wap.wml")
You can treat your wbmp file just like any other image file on your server
and put it either in the web application root directory or in some subdir
such as images. If you've set up your server's web.xml file with the
additional mime types, your server will return the image file just like it
would for any other static file request.
Why don't you just start out with a static .wml file instead of using a
servlet to output the same wml output? It will reduce a level of complexity
and enable you to debug this problem a bit easier. Once you get the wbmp
anchor reference working, you can go back to using the servlet.
Regards,
Richard
At 09:15 PM 4/22/2002 +0100, you wrote:
>Dear people,
>How do I incorprate WBMP images in a java servlet so that it will be output
>on the nokia toolkit 2.0 emulator? It works fine in WML BUT I can't get it
>to work in the java servlet, here is my code as below:
>
>import java.io.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>
>//Realm0 extends HttpServlet (inherits HttpServlet class)
>public class Image1 extends HttpServlet
>{
> public void doGet(HttpServletRequest request, HttpServletResponse response)
> throws ServletException, IOException
> {
>
> PrintWriter out;
>
> response.setContentType("text/vnd.wap.com");
> response.setContentType("text/vnd.wap.wml");
> response.setContentType("image/vnd.wap.wbmp");
>
> out = response.getWriter();
>
> out.println("<?xml version=\"1.0\"?>");
> out.println("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML");
> out.println("1.1//EN\"");
> out.println("\"http://www.wapforum.org/DTD/wml_1.1.xml\">");
>
> out.println("<wml>\n<card id=\"myCard\" title=\"Image Example\">");
> out.println("<p>");
> out.println("Test Test Test");
> out.println("<br/>");
> out.println("<img src=\"Sword1.wbmp\" alt=\"Logo\" hspace=\"6\"
>vspace=\"6\"/>");
> out.println("</p>");
>
> out.println("</card>");
> out.println("</wml>");
>
> out.close();
>
> }
>}
>
>I am using TOmcat as a servlet engine and web server aswell, where do I
>place the image aswell?
>
>Can someone please please help - thanks in advance.
>
>Regards
>
>Helen
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html