src/share/classes/com/sun/net/httpserver/HttpContext.java

Print this page




  23  * questions.
  24  */
  25 
  26 package com.sun.net.httpserver;
  27 import java.net.*;
  28 import java.io.*;
  29 import java.util.*;
  30 
  31 /**
  32  * HttpContext represents a mapping between the root URI path of an application
  33  * to a {@link HttpHandler} which is invoked to handle requests destined
  34  * for that path on the associated HttpServer or HttpsServer.
  35  * <p>
  36  * HttpContext instances are created by the create methods in HttpServer
  37  * and HttpsServer
  38  * <p>
  39  * A chain of {@link Filter} objects can be added to a HttpContext. All exchanges processed by the
  40  * context can be pre- and post-processed by each Filter in the chain.
  41  * @since 1.6
  42  */

  43 public abstract class HttpContext {
  44 
  45     protected HttpContext () {
  46     }
  47 
  48     /**
  49      * returns the handler for this context
  50      * @return the HttpHandler for this context
  51      */
  52     public abstract HttpHandler getHandler () ;
  53 
  54     /**
  55      * Sets the handler for this context, if not already set.
  56      * @param h the handler to set for this context
  57      * @throws IllegalArgumentException if this context's handler is already set.
  58      * @throws NullPointerException if handler is <code>null</code>
  59      */
  60     public abstract void setHandler (HttpHandler h) ;
  61 
  62     /**




  23  * questions.
  24  */
  25 
  26 package com.sun.net.httpserver;
  27 import java.net.*;
  28 import java.io.*;
  29 import java.util.*;
  30 
  31 /**
  32  * HttpContext represents a mapping between the root URI path of an application
  33  * to a {@link HttpHandler} which is invoked to handle requests destined
  34  * for that path on the associated HttpServer or HttpsServer.
  35  * <p>
  36  * HttpContext instances are created by the create methods in HttpServer
  37  * and HttpsServer
  38  * <p>
  39  * A chain of {@link Filter} objects can be added to a HttpContext. All exchanges processed by the
  40  * context can be pre- and post-processed by each Filter in the chain.
  41  * @since 1.6
  42  */
  43 @jdk.Supported
  44 public abstract class HttpContext {
  45 
  46     protected HttpContext () {
  47     }
  48 
  49     /**
  50      * returns the handler for this context
  51      * @return the HttpHandler for this context
  52      */
  53     public abstract HttpHandler getHandler () ;
  54 
  55     /**
  56      * Sets the handler for this context, if not already set.
  57      * @param h the handler to set for this context
  58      * @throws IllegalArgumentException if this context's handler is already set.
  59      * @throws NullPointerException if handler is <code>null</code>
  60      */
  61     public abstract void setHandler (HttpHandler h) ;
  62 
  63     /**