本文整理汇总了Java中org.apache.cxf.transport.servlet.CXFServlet类的典型用法代码示例。如果您正苦于以下问题:Java CXFServlet类的具体用法?Java CXFServlet怎么用?Java CXFServlet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CXFServlet类属于org.apache.cxf.transport.servlet包,在下文中一共展示了CXFServlet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initWebApp
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
private WebAppContext initWebApp() throws IOException {
WebAppContext ctx = new WebAppContext();
ctx.setContextPath(CONFIG.getContextPath());
ctx.setResourceBase(new ClassPathResource("webapp").getURI().toString());
// Disable directory listings if no index.html is found.
ctx.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
ServletHolder web = new ServletHolder("spring-dispatcher", new DispatcherServlet(springContext));
ServletHolder cxf = new ServletHolder("cxf", new CXFServlet());
ctx.addEventListener(new ContextLoaderListener(springContext));
ctx.addServlet(web, CONFIG.getSpringMapping());
ctx.addServlet(cxf, CONFIG.getCxfMapping());
if (CONFIG.getProfile().isProd()) {
addSecurityFilter(ctx);
}
initJSP(ctx);
return ctx;
}
示例2: onStartup
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
WebApplicationContext context = getContext();
servletContext.addListener(new ContextLoaderListener(context));
servletContext.addFilter("characterEncodingFilter", new CharacterEncodingFilter("UTF-8"));
DispatcherServlet dispatcherServlet = new DispatcherServlet(context);
dispatcherServlet.setThrowExceptionIfNoHandlerFound(true);
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("Dispatcher", dispatcherServlet);
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/*");
CXFServlet cxf = new CXFServlet();
BusFactory.setDefaultBus(cxf.getBus());
ServletRegistration.Dynamic cxfServlet = servletContext.addServlet("CXFServlet", cxf);
cxfServlet.setLoadOnStartup(1);
cxfServlet.addMapping("/services/*");
servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy("springSecurityFilterChain")).addMappingForUrlPatterns(null, false,
"/*");
servletContext.getSessionCookieConfig().setSecure(cookieSecure);
}
示例3: startPeopleService
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
public void startPeopleService() throws Exception {
final File base = createBaseDirectory();
log.info("Using base folder: " + base.getAbsolutePath());
final Tomcat tomcat = new Tomcat();
tomcat.setPort(8080);
tomcat.setBaseDir(base.getAbsolutePath());
Context context = tomcat.addContext("/", base.getAbsolutePath());
Tomcat.addServlet(context, "CXFServlet", new CXFServlet());
context.addServletMapping("/rest/*", "CXFServlet");
context.addApplicationListener(ContextLoaderListener.class.getName());
context.setLoader(new WebappLoader(Thread.currentThread().getContextClassLoader()));
context.addParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
context.addParameter("contextConfigLocation", AppConfig.class.getName());
tomcat.start();
tomcat.getServer().await();
}
示例4: main
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
public static void main(final String[] args) throws Exception {
final File base = createBaseDirectory();
log.info("Using base folder: " + base.getAbsolutePath());
final Tomcat tomcat = new Tomcat();
tomcat.setPort(8080);
tomcat.setBaseDir( base.getAbsolutePath() );
Context context = tomcat.addContext( "/", base.getAbsolutePath() );
Tomcat.addServlet( context, "CXFServlet", new CXFServlet() );
context.addServletMapping( "/rest/*", "CXFServlet" );
context.addApplicationListener( ContextLoaderListener.class.getName() );
context.setLoader( new WebappLoader( Thread.currentThread().getContextClassLoader() ) );
context.addParameter( "contextClass", AnnotationConfigWebApplicationContext.class.getName() );
context.addParameter( "contextConfigLocation", MusicConfig.class.getName() );
tomcat.start();
tomcat.getServer().await();
}
示例5: startJaxRsServer
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
public void startJaxRsServer() throws LifecycleException, IOException {
final File base = createBaseDirectory(basedir);
log.info("Using base folder: " + base.getAbsolutePath());
tomcat = new Tomcat();
tomcat.setPort(tomcatPort);
tomcat.setBaseDir(base.getAbsolutePath());
Context context = tomcat.addContext("/", base.getAbsolutePath());
Tomcat.addServlet(context, "CXFServlet", new CXFServlet());
context.addServletMapping("/rest/*", "CXFServlet");
context.addApplicationListener(ContextLoaderListener.class.getName());
context.setLoader(new WebappLoader(Thread.currentThread().getContextClassLoader()));
context.addParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
context.addParameter("contextConfigLocation", tomcatClass);
tomcat.start();
tomcat.getServer().await();
}
示例6: cxfServlet
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean cxfServlet() {
final ServletRegistrationBean bean = new ServletRegistrationBean();
bean.setEnabled(true);
bean.setName("cxfServletSecurityTokenService");
bean.setServlet(new CXFServlet());
bean.setUrlMappings(Collections.singleton(WSFederationConstants.ENDPOINT_STS.concat("*")));
bean.setAsyncSupported(true);
return bean;
}
示例7: servletRegistrationBean
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean servletRegistrationBean() {
CXFServlet cxfServlet = new CXFServlet();
ServletRegistrationBean servletRegistration = new ServletRegistrationBean(cxfServlet, URL_PATH_SERVICES + "/*");
return servletRegistration;
}
示例8: cxfServlet
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean cxfServlet() {
LOGGER.info("Initializing CXF");
ServletRegistrationBean servletDef = new ServletRegistrationBean(new CXFServlet(), "/api/soap/*");
servletDef.setLoadOnStartup(1);
return servletDef;
}
示例9: soapServletRegistrationBean
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean soapServletRegistrationBean() {
log.info("+++ soapServletRegistration");
ServletRegistrationBean registration = new ServletRegistrationBean(new CXFServlet(), "/services/*");
registration.setLoadOnStartup(1);
registration.setName("CXFServlet");
return registration;
}
示例10: cxfServlet
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean cxfServlet() {
ServletRegistrationBean registration = new ServletRegistrationBean();
registration.setServlet(new CXFServlet());
registration.addInitParameter("service-list-path", "midpointservices");
registration.setLoadOnStartup(1);
registration.addUrlMappings("/model/*", "/ws/*");
return registration;
}
示例11: addApacheCxfServlet
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
private void addApacheCxfServlet(ServletContext servletContext) {
CXFServlet cxfServlet = new CXFServlet();
ServletRegistration.Dynamic appServlet = servletContext.addServlet("CXFServlet", cxfServlet);
appServlet.setLoadOnStartup(1);
Set<String> mappingConflicts = appServlet.addMapping("/api/v1/*");
}
示例12: createCXFServlet
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
private void createCXFServlet(ServletContext servletContext) {
log.info("Creating CXF Servlet started....");
CXFServlet servlet = new CXFServlet();
ServletRegistration.Dynamic appServlet = servletContext.addServlet("CXFServlet", servlet);
appServlet.setLoadOnStartup(1);
appServlet.addMapping("/services/*");
// for serving up asynchronous events in tomcat
appServlet.setAsyncSupported(true);
// log.info("Creating CXF Servlet completed");
}
示例13: startServer
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
@Before
public void startServer()
throws Exception
{
System.setProperty( "redback.admin.creation.file", "target/auto-admin-creation.properties" );
server = new Server();
serverConnector = new ServerConnector( server, new HttpConnectionFactory() );
server.addConnector( serverConnector );
ServletHolder servletHolder = new ServletHolder( new CXFServlet() );
ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS );
context.setResourceBase( SystemUtils.JAVA_IO_TMPDIR );
context.setSessionHandler( new SessionHandler() );
context.addServlet( servletHolder, "/" + getRestServicesPath() + "/*" );
context.setInitParameter( "contextConfigLocation", getSpringConfigLocation() );
context.addEventListener( new ContextLoaderListener() );
ServletHolder servletHolderRepo = new ServletHolder( new RepositoryServlet() );
context.addServlet( servletHolderRepo, "/repository/*" );
server.setHandler( context );
server.start();
port = serverConnector.getLocalPort();
log.info( "start server on port {}", this.port );
User user = new User();
user.setEmail( "[email protected]" );
user.setFullName( "the root user" );
user.setUsername( RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME );
user.setPassword( FakeCreateAdminService.ADMIN_TEST_PWD );
getUserService( null ).createAdminUser( user );
}
示例14: configStandaloneServer
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
private CXFServlet configStandaloneServer() {
httpServer = new org.eclipse.jetty.server.Server(httpPort);
Bus bus = BusFactory.getDefaultBus(true);
ContextHandlerCollection contexts = new ContextHandlerCollection();
httpServer.setHandler(contexts);
ServletContextHandler root = new ServletContextHandler(contexts, "/",
ServletContextHandler.SESSIONS);
CXFServlet cxf = new CXFServlet();
cxf.setBus(bus);
ServletHolder servlet = new ServletHolder(cxf);
root.addServlet(servlet, "/cxf/*");
return cxf;
}
示例15: addSpringContext
import org.apache.cxf.transport.servlet.CXFServlet; //导入依赖的package包/类
static private void addSpringContext(HandlerCollection collection) {
final ServletHolder servletHolder = new ServletHolder(new CXFServlet());
final ServletContextHandler context = new ServletContextHandler();
context.setContextPath("/");
context.addServlet(servletHolder, "/rest/*");
context.addEventListener(new ContextLoaderListener());
context.setInitParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
context.setInitParameter("contextConfigLocation", AppConfig.class.getName());
collection.addHandler(context);
}