[ 
https://issues.apache.org/jira/browse/ISIS-869?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood updated ISIS-869:
-----------------------------
    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();
    }

}

> Domain service (probably isisaddons) to wrap HttpSession.
> ---------------------------------------------------------
>
>                 Key: ISIS-869
>                 URL: https://issues.apache.org/jira/browse/ISIS-869
>             Project: Isis
>          Issue Type: New Feature
>          Components: Add-ons
>    Affects Versions: core-1.6.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>            Priority: Minor
>             Fix For: core-1.7.0
>
>
> 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();
>     }
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to