本文整理匯總了Java中org.h2.server.web.WebServlet類的典型用法代碼示例。如果您正苦於以下問題:Java WebServlet類的具體用法?Java WebServlet怎麽用?Java WebServlet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WebServlet類屬於org.h2.server.web包,在下文中一共展示了WebServlet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: h2servletRegistration
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Bean
ServletRegistrationBean h2servletRegistration()
{
ServletRegistrationBean registrationBean = new ServletRegistrationBean( new WebServlet());
registrationBean.addUrlMappings("/console/*");
return registrationBean;
}
示例2: testStartUpProdServletContext
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Test
public void testStartUpProdServletContext() throws ServletException {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
webConfigurer.onStartup(servletContext);
assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry);
assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry);
verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class));
verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class));
verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class));
}
示例3: testStartUpDevServletContext
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Test
public void testStartUpDevServletContext() throws ServletException {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
webConfigurer.onStartup(servletContext);
assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry);
assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry);
verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class));
verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class));
verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class));
}
示例4: testStartUpProdServletContext
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Test
public void testStartUpProdServletContext() throws ServletException {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
webConfigurer.onStartup(servletContext);
assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry);
assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry);
verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class));
verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class));
verify(servletContext).addFilter(eq("cachingHttpHeadersFilter"), any(CachingHttpHeadersFilter.class));
verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class));
}
示例5: testStartUpDevServletContext
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Test
public void testStartUpDevServletContext() throws ServletException {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
webConfigurer.onStartup(servletContext);
assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry);
assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry);
verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class));
verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class));
verify(servletContext, never()).addFilter(eq("cachingHttpHeadersFilter"), any(CachingHttpHeadersFilter.class));
verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class));
}
示例6: h2servletRegistration
import org.h2.server.web.WebServlet; //導入依賴的package包/類
/**
* H2 Database Console
*
* @return
*/
@Bean
ServletRegistrationBean h2servletRegistration() {
ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());
registrationBean.addUrlMappings("/console/*");
return registrationBean;
}
示例7: init
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Override
public void init() {
super.init();
try {
Field field = WebServlet.class.getDeclaredField("server");
field.setAccessible(true);
org.h2.server.web.WebServer server = (org.h2.server.web.WebServer) field.get(this);
ConnectionInfo connectionInfo = new ConnectionInfo("Traccar|"
+ Context.getConfig().getString("database.driver") + "|"
+ Context.getConfig().getString("database.url") + "|"
+ Context.getConfig().getString("database.user"));
Method method;
method = org.h2.server.web.WebServer.class.getDeclaredMethod("updateSetting", ConnectionInfo.class);
method.setAccessible(true);
method.invoke(server, connectionInfo);
method = org.h2.server.web.WebServer.class.getDeclaredMethod("setAllowOthers", boolean.class);
method.setAccessible(true);
method.invoke(server, true);
} catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
Log.warning(e);
}
}
示例8: h2servletRegistration
import org.h2.server.web.WebServlet; //導入依賴的package包/類
/**
* Access the H2 Console:
* http://localhost:8080/admin/h2/
* @return
*/
@Bean
public ServletRegistrationBean h2servletRegistration(){
ServletRegistrationBean registrationBean = new ServletRegistrationBean( new WebServlet());
registrationBean.addUrlMappings("/admin/h2/*");
return registrationBean;
}
示例9: configureServlets
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Override
protected void configureServlets() {
if (enabled) {
filter(H2_PATH, H2_PATH + "/*").through(LeaderRedirectFilter.class);
serve(H2_PATH, H2_PATH + "/*").with(new WebServlet(), ImmutableMap.of(
"webAllowOthers", "true",
"ifExists", "true"
));
}
}
示例10: h2servletRegistration
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Profile("development")
@Bean
ServletRegistrationBean h2servletRegistration() {
ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());
registrationBean.addUrlMappings("/console/*");
return registrationBean;
}
示例11: h2Console
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Bean
public ServletRegistrationBean h2Console() {
String path = this.properties.getPath();
String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
ServletRegistrationBean registration = new ServletRegistrationBean(
new WebServlet(), urlMapping);
H2ConsoleProperties.Settings settings = this.properties.getSettings();
if (settings.isTrace()) {
registration.addInitParameter("trace", "");
}
if (settings.isWebAllowOthers()) {
registration.addInitParameter("webAllowOthers", "");
}
return registration;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:16,代碼來源:H2ConsoleAutoConfiguration.java
示例12: h2servletRegistration
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Bean
ServletRegistrationBean h2servletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new WebServlet());
registration.addUrlMappings("/console/*");
registration.addInitParameter("webAllowOthers", "true");
return registration;
}
示例13: h2servletRegistration
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Bean
@Profile("default")
public ServletRegistrationBean h2servletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new WebServlet());
registration.addUrlMappings("/console/*");
return registration;
}
示例14: h2Servlet
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Bean
public ServletRegistrationBean h2Servlet() {
ServletRegistrationBean servletBean = new ServletRegistrationBean();
servletBean.addUrlMappings("/h2/*");
servletBean.setServlet(new WebServlet());
return servletBean;
}
示例15: h2servletRegistration
import org.h2.server.web.WebServlet; //導入依賴的package包/類
@Bean
public ServletRegistrationBean h2servletRegistration() {
WebServlet webServlet = new WebServlet();
ServletRegistrationBean bean = new ServletRegistrationBean(webServlet);
bean.addUrlMappings("/h2console/*");
return bean;
}