# com.bea.p13n.mail.servlets
MailPreviewServlet Class

public class MailPreviewServlet
extends `HttpServlet`

Servlet to provide a preview of a JSP-generated mail message. This servlet expects at least one parameter, called "uri", that contains the URI for it to call. Any other parameters will be passed on to that URI.

This servlet requires the MailService to be at java:comp/env/ejb/MailService.

Hierarchy
  `Object`
  `GenericServlet`
  `HttpServlet`
  `MailPreviewServlet`

All Implemented Interfaces
  `Serializable`, `Servlet`, `ServletConfig`

## Constructor Summary

MailPreviewServlet()

## Method Summary

`protected `MailService`` | `getMailService`() Get the mail service to use.
`public void` | `init`()
`public void` | `service`(`HttpServletRequest` req, `HttpServletResponse` res)
`protected void` | `showError`(`String` error, `Throwable` ex, `HttpServletResponse` resp) Print an error message to the output stream.

Methods from `javax.servlet.http.`HttpServlet``
`doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service`

Methods from `javax.servlet.`GenericServlet``
`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log, service`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.servlet.`Servlet``
`destroy, getServletConfig, getServletInfo, init, service`

Methods from interface `javax.servlet.`ServletConfig``
`getInitParameter, getInitParameterNames, getServletContext, getServletName`

## Constructor Detail

### MailPreviewServlet

    public MailPreviewServlet()

## Method Detail

### getMailService() Method

    protected MailService getMailService()
         throws CreateException, RemoteException

Get the mail service to use.

#### Exceptions

``CreateException``
``RemoteException``

### init() Method

    public void init()
         throws ServletException

Overrides
  `GenericServlet.init()`

#### Exceptions

``ServletException``

### service(HttpServletRequest, HttpServletResponse) Method

    public void service(HttpServletRequest req,
                        HttpServletResponse res)
         throws IOException, ServletException

Overrides
  `HttpServlet.service(HttpServletRequest, HttpServletResponse)`

#### Exceptions

``IOException``
``ServletException``

### showError(String, Throwable, HttpServletResponse) Method

    protected void showError(String error,
                             Throwable ex,
                             HttpServletResponse resp)
         throws ServletException, IOException

Print an error message to the output stream.

This assumes that nothing has been put on the response yet.

#### Parameters

error
  the error message.

ex
  a possible exception.

resp
  the response to output to.

#### Exceptions

``ServletException``
``IOException``