View Javadoc

1   /*
2    * Copyright (c) 2005-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.danube.http;
14  
15  import org.abstracthorizon.danube.connection.Connection;
16  
17  /**
18   * This class marks start of "web application" by setting
19   * context path. All, potential, session handling will be done using
20   * context path - path this component is defined on.
21   *
22   * @author Daniel Sendula
23   */
24  public class HTTPContext extends Selector {
25  
26      /** Constructor */
27      public HTTPContext() {
28      }
29  
30      /**
31       * This method creates sets context path to be same as context path
32       * up to here plus this component's path. Component's path is reset
33       * to &quot;<code>/<code>&quot;
34       *
35       * @param connection socket connection
36       */
37      public void handleConnection(Connection connection) {
38          HTTPConnection httpConnection = (HTTPConnection)connection.adapt(HTTPConnection.class);
39          httpConnection.addComponentPathToContextPath();
40  //      httpConnection.addToContextPath(httpConnection.getComponentPath());
41  //      httpConnection.setComponentPath("/");
42  
43          super.handleConnection(connection);
44  
45      }
46  }