本文整理汇总了Java中org.eclipse.jetty.plus.annotation.ContainerInitializer类的典型用法代码示例。如果您正苦于以下问题:Java ContainerInitializer类的具体用法?Java ContainerInitializer怎么用?Java ContainerInitializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContainerInitializer类属于org.eclipse.jetty.plus.annotation包,在下文中一共展示了ContainerInitializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newWebAppContext
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
static WebAppContext newWebAppContext() throws MalformedURLException {
final WebAppContext handler = new WebAppContext();
handler.setContextPath("/");
handler.setBaseResource(Resource.newResource(webAppRoot()));
handler.setClassLoader(new URLClassLoader(
new URL[] {
Resource.newResource(new File(webAppRoot(),
"WEB-INF" + File.separatorChar +
"lib" + File.separatorChar +
"hello.jar")).getURI().toURL()
},
JettyService.class.getClassLoader()));
handler.addBean(new ServletContainerInitializersStarter(handler), true);
handler.setAttribute(
"org.eclipse.jetty.containerInitializers",
Collections.singletonList(new ContainerInitializer(new JettyJasperInitializer(), null)));
return handler;
}
示例2: createCrossDomainHandler
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
/**
* Creates a Jetty context handler that can be used to expose the cross-domain functionality as implemented by
* {@link FlashCrossDomainServlet}.
*
* Note that an invocation of this method will not register the handler (and thus make the related functionality
* available to the end user). Instead, the created handler is returned by this method, and will need to be
* registered with the embedded Jetty webserver by the caller.
*
* @return A Jetty context handler (never null).
*/
protected Handler createCrossDomainHandler()
{
final ServletContextHandler context = new ServletContextHandler( null, "/crossdomain.xml", ServletContextHandler.SESSIONS );
// Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add( new ContainerInitializer( new JasperInitializer(), null ) );
context.setAttribute( "org.eclipse.jetty.containerInitializers", initializers );
context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager() );
// Generic configuration of the context.
context.setAllowNullPathInfo( true );
// Add the functionality-providers.
context.addServlet( new ServletHolder( new FlashCrossDomainServlet() ), "" );
return context;
}
示例3: initializePlugin
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
@Override
public void initializePlugin( PluginManager manager, File pluginDirectory )
{
for ( final String publicResource : publicResources )
{
AuthCheckFilter.addExclude( publicResource );
}
// Add the Webchat sources to the same context as the one that's providing the BOSH interface.
context = new WebAppContext( null, pluginDirectory.getPath() + File.separator + "classes/", "/inverse" );
context.setClassLoader( this.getClass().getClassLoader() );
// Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add( new ContainerInitializer( new JettyJasperInitializer(), null ) );
context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager());
HttpBindManager.getInstance().addJettyHandler( context );
}
示例4: initializePlugin
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
@Override
public void initializePlugin( PluginManager manager, File pluginDirectory )
{
for ( final String publicResource : publicResources )
{
AuthCheckFilter.addExclude( publicResource );
}
// Add the Webchat sources to the same context as the one that's providing the BOSH interface.
context = new WebAppContext( null, pluginDirectory.getPath() + File.separator + "classes", "/candy" );
context.setClassLoader( this.getClass().getClassLoader() );
// Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add( new ContainerInitializer( new JettyJasperInitializer(), null ) );
context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager());
HttpBindManager.getInstance().addJettyHandler( context );
}
示例5: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
private static List<ContainerInitializer> jspInitializers() {
JettyJasperInitializer sci = new JettyJasperInitializer();
ContainerInitializer initializer = new ContainerInitializer(sci, null);
List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(initializer);
return initializers;
}
示例6: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
/**
* Initializer to activate JSP support in Jetty.
*
* @return list of initializer to support jsp compiling
*/
private static List<ContainerInitializer> jspInitializers() {
final JettyJasperInitializer sci = new JettyJasperInitializer();
final ContainerInitializer initializer = new ContainerInitializer(sci, null);
final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(initializer);
return initializers;
}
示例7: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
private static List<ContainerInitializer> jspInitializers() {
JettyJasperInitializer sci = new JettyJasperInitializer();
ContainerInitializer initializer = new ContainerInitializer(sci, null);
List<ContainerInitializer> initializers = new ArrayList<ContainerInitializer>();
initializers.add(initializer);
return initializers;
}
示例8: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
private List<ContainerInitializer> jspInitializers() {
JasperInitializer sci = new JasperInitializer();
ContainerInitializer initializer = new ContainerInitializer(sci, null);
List<ContainerInitializer> initializers = new ArrayList<ContainerInitializer>();
initializers.add(initializer);
return initializers;
}
示例9: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
private List<ContainerInitializer> jspInitializers() {
JettyJasperInitializer sci = new JettyJasperInitializer();
ContainerInitializer initializer = new ContainerInitializer(sci, null);
List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(initializer);
return initializers;
}
示例10: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
/**
* Ensure the jsp engine is initialized correctly
*/
private List<ContainerInitializer> jspInitializers() {
JettyJasperInitializer sci = new JettyJasperInitializer();
ContainerInitializer initializer = new ContainerInitializer(sci, null);
List<ContainerInitializer> initializers = new ArrayList<ContainerInitializer>();
initializers.add(initializer);
return initializers;
}
示例11: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
private List<ContainerInitializer> jspInitializers() {
JettyJasperInitializer sci = new JettyJasperInitializer();
ContainerInitializer initializer = new ContainerInitializer(
(ServletContainerInitializer) sci, null);
List<ContainerInitializer> initializers = new ArrayList<ContainerInitializer>();
initializers.add(initializer);
return initializers;
}
示例12: createBoshHandler
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
/**
* Creates a Jetty context handler that can be used to expose BOSH (HTTP-Bind) functionality.
*
* Note that an invocation of this method will not register the handler (and thus make the related functionality
* available to the end user). Instead, the created handler is returned by this method, and will need to be
* registered with the embedded Jetty webserver by the caller.
*
* @return A Jetty context handler (never null).
*/
protected Handler createBoshHandler()
{
final ServletContextHandler context = new ServletContextHandler( null, "/http-bind", ServletContextHandler.SESSIONS );
// Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add( new ContainerInitializer( new JasperInitializer(), null ) );
context.setAttribute( "org.eclipse.jetty.containerInitializers", initializers );
context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager() );
// Generic configuration of the context.
context.setAllowNullPathInfo( true );
// Add the functionality-providers.
context.addServlet( new ServletHolder( new HttpBindServlet() ), "/*" );
// Add compression filter when needed.
if ( isHttpCompressionEnabled() )
{
final Filter gzipFilter = new AsyncGzipFilter()
{
@Override
public void init( FilterConfig config ) throws ServletException
{
super.init( config );
_methods.add( HttpMethod.POST.asString() );
Log.info( "Installed response compression filter" );
}
};
final FilterHolder filterHolder = new FilterHolder();
filterHolder.setFilter( gzipFilter );
context.addFilter( filterHolder, "/*", EnumSet.of( DispatcherType.REQUEST ) );
}
return context;
}
示例13: createWebAppContext
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
private void createWebAppContext() {
WebAppContext context;
// Add web-app. Check to see if we're in development mode. If so, we don't
// add the normal web-app location, but the web-app in the project directory.
boolean developmentMode = Boolean.getBoolean("developmentMode");
if( developmentMode )
{
System.out.println(LocaleUtils.getLocalizedString("admin.console.devmode"));
context = new WebAppContext(contexts, pluginDir.getParentFile().getParentFile().getParentFile().getParent() +
File.separator + "src" + File.separator + "web", "/");
}
else {
context = new WebAppContext(contexts, pluginDir.getAbsoluteFile() + File.separator + "webapp",
"/");
}
// Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(new ContainerInitializer(new JasperInitializer(), null));
context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
// The index.html includes a redirect to the index.jsp and doesn't bypass
// the context security when in development mode
context.setWelcomeFiles(new String[]{"index.html"});
// Make sure the context initialization is done when in development mode
if( developmentMode )
{
context.addBean( new ServletContainerInitializersStarter( context ), true );
}
}
示例14: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
/**
* Ensure the jsp engine is initialized correctly
*/
private List<ContainerInitializer> jspInitializers()
{
JettyJasperInitializer sci = new JettyJasperInitializer();
ContainerInitializer initializer = new ContainerInitializer(sci, null);
List<ContainerInitializer> initializers = new ArrayList<ContainerInitializer>();
initializers.add(initializer);
return initializers;
}
示例15: jspInitializers
import org.eclipse.jetty.plus.annotation.ContainerInitializer; //导入依赖的package包/类
/**
* Ensure the JSP engine is initialized correctly
*/
private List<ContainerInitializer> jspInitializers() {
List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(new ContainerInitializer(new JettyJasperInitializer(), null));
return initializers;
}