Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-869

Domain service (probably isisaddons) to wrap HttpSession.

    XMLWordPrintableJSON

Details

    Description

      as per mailing list discussion:http://markmail.org/message/l4yh5cfu7dz2kn33

      ~~~~~~~~~~~~~

      1. Assuming you want to access the ServletContext from your domain model:

      add to dom/pom.xml (so that ServletContext is on classpath):

      <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-servlet_2.5_spec</artifactId>
      <optional>true</optional>
      </dependency>

      2. in dom project, define interface:

      package dom;

      import javax.servlet.ServletContext;
      import org.apache.isis.applib.annotation.Programmatic;

      public interface ServletContextProvider

      { @Programmatic public ServletContext getServletContext(); }

      3. in webapp project, define implementation:

      package webapp;

      import dom.ServletContextProvider;

      import javax.servlet.ServletContext;
      import org.apache.wicket.protocol.http.WebApplication;
      import org.apache.isis.applib.annotation.DomainService;
      import org.apache.isis.applib.annotation.Programmatic;

      @DomainService
      public class ServletContextService implements ServletContextProvider {

      @Programmatic
      public ServletContext getServletContext()

      { return WebApplication.get().getServletContext(); }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: