use of javax.servlet.ServletConfig in project atmosphere by Atmosphere.
the class AtmosphereFilter method init.
/**
* Initialize the {@link Filter}.
*
* @param filterConfig The {@link javax.servlet.FilterConfig}
* @throws ServletException
*/
public void init(final FilterConfig filterConfig) throws ServletException {
logger.info("AtmosphereServlet running as a Filter");
as.init(new ServletConfig() {
@Override
public String getServletName() {
return filterConfig.getFilterName();
}
@Override
public ServletContext getServletContext() {
return filterConfig.getServletContext();
}
@Override
public String getInitParameter(String name) {
return filterConfig.getInitParameter(name);
}
@Override
public Enumeration<String> getInitParameterNames() {
return filterConfig.getInitParameterNames();
}
});
String s = filterConfig.getInitParameter(ApplicationConfig.ATMOSPHERE_EXCLUDED_FILE);
if (s != null) {
excluded = s;
}
}
use of javax.servlet.ServletConfig in project atmosphere by Atmosphere.
the class SSEAtmosphereInterceptorTest method setup.
@BeforeMethod
public void setup() throws Exception {
framework = new AtmosphereFramework();
framework.setAsyncSupport(Mockito.mock(AsyncSupport.class));
framework.init(new ServletConfig() {
@Override
public String getServletName() {
return "void";
}
@Override
public ServletContext getServletContext() {
return Mockito.mock(ServletContext.class);
}
@Override
public String getInitParameter(String name) {
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return null;
}
});
config = framework.getAtmosphereConfig();
}
use of javax.servlet.ServletConfig in project atmosphere by Atmosphere.
the class ManagedAtmosphereHandlerTest method create.
@BeforeMethod
public void create() throws Throwable {
framework = new AtmosphereFramework();
framework.setDefaultBroadcasterClassName(SimpleBroadcaster.class.getName());
framework.addAnnotationPackage(ManagedGet.class);
framework.setAsyncSupport(new AsynchronousProcessor(framework.getAtmosphereConfig()) {
@Override
public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException {
return suspended(req, res);
}
public void action(AtmosphereResourceImpl r) {
try {
resumed(r.getRequest(), r.getResponse());
} catch (IOException e) {
e.printStackTrace();
} catch (ServletException e) {
e.printStackTrace();
}
}
}).init(new ServletConfig() {
@Override
public String getServletName() {
return "void";
}
@Override
public ServletContext getServletContext() {
return mock(ServletContext.class);
}
@Override
public String getInitParameter(String name) {
return ApplicationConfig.CLIENT_HEARTBEAT_INTERVAL_IN_SECONDS.equals(name) ? "10" : null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return null;
}
});
}
use of javax.servlet.ServletConfig in project atmosphere by Atmosphere.
the class AtmosphereResourceFactoryTest method create.
@BeforeMethod
public void create() throws Throwable {
framework = new AtmosphereFramework();
framework.setAsyncSupport(mock(AsyncSupport.class));
framework.init(new ServletConfig() {
@Override
public String getServletName() {
return "void";
}
@Override
public ServletContext getServletContext() {
return mock(ServletContext.class);
}
@Override
public String getInitParameter(String name) {
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return null;
}
});
}
use of javax.servlet.ServletConfig in project atmosphere by Atmosphere.
the class AtmosphereResourceListenerTest method create.
@BeforeMethod
public void create() throws Throwable {
framework = new AtmosphereFramework();
framework.setAsyncSupport(new BlockingIOCometSupport(framework.getAtmosphereConfig()));
framework.init(new ServletConfig() {
@Override
public String getServletName() {
return "void";
}
@Override
public ServletContext getServletContext() {
return mock(ServletContext.class);
}
@Override
public String getInitParameter(String name) {
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return null;
}
});
}
Aggregations