本文整理汇总了Java中org.tuckey.web.filters.urlrewrite.UrlRewriteFilter类的典型用法代码示例。如果您正苦于以下问题:Java UrlRewriteFilter类的具体用法?Java UrlRewriteFilter怎么用?Java UrlRewriteFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UrlRewriteFilter类属于org.tuckey.web.filters.urlrewrite包,在下文中一共展示了UrlRewriteFilter类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: rewriteFilterConfig
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
@Bean
public FilterRegistrationBean rewriteFilterConfig() {
FilterRegistrationBean reg = new FilterRegistrationBean();
reg.setName(REWRITE_FILTER_NAME);
reg.setFilter(new UrlRewriteFilter());
reg.addInitParameter("confPath", REWRITE_FILTER_CONF_PATH);
reg.addInitParameter("confReloadCheckInterval", "-1");
reg.addInitParameter("statusPath", "/redirect");
reg.addInitParameter("statusEnabledOnHosts", "*");
reg.addInitParameter("logLevel", "WARN");
return reg;
}
开发者ID:hosken5,项目名称:spring-boot-freemarker-showcase,代码行数:13,代码来源:SiteConfig.java
示例2: beforeSpringSecurityFilterChain
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
@Override
protected void beforeSpringSecurityFilterChain(final ServletContext servletContext) {
// Be sure charsetFilters are registered before spring security, otherwise logins will fail in tomcat with non-ascii passwords
initCharacterSetFilter(servletContext);
insertFilters(servletContext,
new UncaughtExceptionFilter(),
new MDCInsertingServletFilter(),
new UrlRewriteFilter());
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:10,代码来源:SecurityWebApplicationInitializer.java
示例3: filterRegistrationBean
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
/**
* register filter bean.
*
* @return FilterRegistrationBean
*/
@Bean
public FilterRegistrationBean filterRegistrationBean() {
final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(new UrlRewriteFilter());
registrationBean.addUrlPatterns("*");
registrationBean.addInitParameter("confReloadCheckInterval", "5");
registrationBean.addInitParameter("logLevel", "INFO");
return registrationBean;
}
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators-example,代码行数:17,代码来源:FilterRegistrationConfig.java
示例4: run
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
@Override
public void run(MappedJsonConfiguration metadictConfiguration, Environment environment) throws Exception {
// Define default mapping URL pattern for resources
environment.jersey().setUrlPattern("/api/*");
// Configure url rewrite filter
FilterRegistration.Dynamic rewrite = environment.servlets()
.addFilter("UrlRewriteFilter", new UrlRewriteFilter());
rewrite.setInitParameter("confPath", "urlrewrite.xml");
rewrite.addMappingForUrlPatterns(EnumSet.of(DispatcherType.FORWARD, DispatcherType.REQUEST), true, "/*");
}
开发者ID:jhendess,项目名称:metadict,代码行数:11,代码来源:MetadictApplication.java
示例5: beforeClass
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
ServletHelper.init();
httpUtil = new HttpTestUtil(new HttpTestUtil.ContextCustomizer() {
public void customize(WebAppContext ctx) throws Exception {
wac = mock(WebApplicationContext.class);
ctx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
URL resource = getClass().getClassLoader().getResource("WEB-INF/urlrewrite.xml");
if (resource == null) {
throw new RuntimeException("Cannot load WEB-INF/urlrewrite.xml");
}
ctx.setBaseResource(Resource.newResource(new File(resource.getFile()).getParent()));
ctx.addFilter(UrlRewriteFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)).setInitParameter("confPath", "/urlrewrite.xml");
ctx.addServlet(HttpTestUtil.EchoServlet.class, "/*");
}
});
httpUtil.httpConnector(HTTP);
httpUtil.httpsConnector(HTTPS);
when(wac.getBean("serverConfigService")).thenReturn(new BaseUrlProvider() {
public boolean hasAnyUrlConfigured() {
return useConfiguredUrls;
}
public String siteUrlFor(String url, boolean forceSsl) throws URISyntaxException {
ServerSiteUrlConfig siteUrl = forceSsl ? new ServerSiteUrlConfig("https://127.2.2.2:" + 9071) : new ServerSiteUrlConfig("http://127.2.2.2:" + 5197);
return siteUrl.siteUrlFor(url);
}
});
httpUtil.start();
originalSslPort = System.getProperty(SystemEnvironment.CRUISE_SERVER_SSL_PORT);
System.setProperty(SystemEnvironment.CRUISE_SERVER_SSL_PORT, String.valueOf(9071));
}
开发者ID:gocd,项目名称:gocd,代码行数:36,代码来源:UrlRewriterIntegrationTest.java
示例6: setUp
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
UrlRewriteFilter filter =
createUrlFilter(SiteApplication.REWRITE_FILTER_NAME,
SiteApplication.REWRITE_FILTER_CONF_PATH);
filterChain = new PassThroughFilterChain(filter, new MockFilterChain());
}
开发者ID:spring-io,项目名称:sagan,代码行数:8,代码来源:RewriteTests.java
示例7: createUrlFilter
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
private UrlRewriteFilter createUrlFilter(String filterName, String mappingsFile) throws ServletException {
UrlRewriteFilter newFilter = new UrlRewriteFilter();
MockFilterConfig filterConfig = new MockFilterConfig(filterName);
filterConfig.addInitParameter("confPath", mappingsFile);
filterConfig.addInitParameter("logLevel", "WARN");
newFilter.init(filterConfig);
return newFilter;
}
开发者ID:spring-io,项目名称:sagan,代码行数:9,代码来源:RewriteTests.java
示例8: run
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
@Override
public void run(AppConfiguration configuration, Environment environment) {
// password encoder
final PasswordEncoder passwordEncoder = new PasswordEncoder();
// DAO
final CategoryDAO categoryDAO = new CategoryDAO(hibernate.getSessionFactory(), configuration);
final BudgetDAO budgetDAO = new BudgetDAO(hibernate.getSessionFactory(), configuration);
final BudgetTypeDAO budgetTypeDAO = new BudgetTypeDAO(hibernate.getSessionFactory());
final UserDAO userDAO = new UserDAO(hibernate.getSessionFactory());
final TransactionDAO transactionDAO = new TransactionDAO(hibernate.getSessionFactory());
final RecurringDAO recurringDAO = new RecurringDAO(hibernate.getSessionFactory());
final AuthTokenDAO authTokenDAO = new AuthTokenDAO(hibernate.getSessionFactory());
// service
final FinanceService financeService = new FinanceService(userDAO, budgetDAO, budgetTypeDAO, categoryDAO, transactionDAO, recurringDAO, authTokenDAO, passwordEncoder);
// jobs
final RecurringJob recurringJob = new UnitOfWorkAwareProxyFactory(hibernate).create(RecurringJob.class, FinanceService.class, financeService);
// resource
environment.jersey().register(new UserResource(financeService));
environment.jersey().register(new CategoryResource(financeService));
environment.jersey().register(new BudgetResource(financeService));
environment.jersey().register(new TransactionResource(financeService));
environment.jersey().register(new RecurringResource(financeService));
environment.jersey().register(new ReportResource(financeService));
// health check
environment.jersey().register(new HealthCheckResource(environment.healthChecks()));
// managed
environment.lifecycle().manage(new MigrationManaged(configuration));
environment.lifecycle().manage(new JobsManaged(recurringJob));
// auth
TokenAuthenticator tokenAuthenticator = new UnitOfWorkAwareProxyFactory(hibernate).create(TokenAuthenticator.class, FinanceService.class, financeService);
final OAuthCredentialAuthFilter<User> authFilter =
new OAuthCredentialAuthFilter.Builder<User>()
.setAuthenticator(tokenAuthenticator)
.setPrefix("Bearer")
.setAuthorizer(new DefaultAuthorizer())
.setUnauthorizedHandler(new DefaultUnauthorizedHandler())
.buildAuthFilter();
environment.jersey().register(RolesAllowedDynamicFeature.class);
environment.jersey().register(new AuthDynamicFeature(authFilter));
environment.jersey().register(new AuthValueFactoryProvider.Binder(User.class));
// filters
FilterRegistration.Dynamic urlRewriteFilter = environment.servlets().addFilter("rewriteFilter", UrlRewriteFilter.class);
urlRewriteFilter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, "/*");
urlRewriteFilter.setInitParameter("confPath", "urlrewrite.xml");
// only enable for dev
// FilterRegistration.Dynamic filterSlow = environment.servlets().addFilter("slowFilter", SlowNetworkFilter.class);
// filterSlow.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, "/*");
// exception mapper
environment.jersey().register(new NotFoundExceptionMapper());
environment.jersey().register(new DataConstraintExceptionMapper());
environment.jersey().register(new ConstraintViolationExceptionMapper());
environment.jersey().register(new SQLConstraintViolationExceptionMapper());
}
开发者ID:paukiatwee,项目名称:budgetapp,代码行数:67,代码来源:BudgetApplication.java
示例9: init
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter; //导入依赖的package包/类
public void init(FilterConfig filterConfig) throws ServletException {
urlRewriteFilter = new UrlRewriteFilter();
urlRewriteFilter.init(new FilterConfigWrapper(filterConfig, getInitParameters()));
}
开发者ID:windup,项目名称:windup-rulesets,代码行数:5,代码来源:WikiUrlRewriteFilter.java
注:本文中的org.tuckey.web.filters.urlrewrite.UrlRewriteFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论