WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

examples.servlets
Class ErrorServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--examples.servlets.ErrorServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ErrorServlet
extends javax.servlet.http.HttpServlet

This simple servlet sends back an HTTP error response. The type of HTTP error response is based on the HTTP error code number that is passed as a query string.

Build the Example

  1. Open a new command shell.

  2. Set up your development shell as described in Setting up your environment.

  3. Compile the servlet using the following command line:
      $ javac -d %EX_WEBAPP_CLASSES% ErrorServlet.java

  4. Start WebLogic Server with the examples configuration.

Configure the Server

Make sure that the examplesWebApp is deployed on your server.

Run the example

Use a web browser to load the following URL:
http://localhost:7001/examplesWebApp/ErrorServlet?code=XXX
Where XXX is a valid HTTP error code.

Notes

If you do not include the ?code=XXX portion of the URL, this example will display a message asking you to do so.

There's More...

For more information on servlets, see Programming WebLogic HTTP Servlets.

Author:
Copyright (c) 1996-98 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
ErrorServlet()
           
 
Method Summary
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Implements the servlet service method.
 
Methods inherited from class javax.servlet.http.HttpServlet
, doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorServlet

public ErrorServlet()
Method Detail

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
             throws javax.servlet.ServletException,
                    java.io.IOException
Implements the servlet service method.
Overrides:
service in class javax.servlet.http.HttpServlet

Documentation is available at
http://e-docs.bea.com/wls/docs60

Copyright © 2000 BEA Systems, Inc. All Rights Reserved.