本文整理汇总了Java中org.apache.wicket.protocol.http.WicketFilter类的典型用法代码示例。如果您正苦于以下问题:Java WicketFilter类的具体用法?Java WicketFilter怎么用?Java WicketFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WicketFilter类属于org.apache.wicket.protocol.http包,在下文中一共展示了WicketFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServer
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
private static void startServer() throws Exception, InterruptedException {
Server server = new Server(port);
Context context = new Context(server, "/", Context.SESSIONS);
context.addServlet(DefaultServlet.class, "/*");
context.addEventListener(new ContextLoaderListener(getContext()));
context.addEventListener(new RequestContextListener());
WicketFilter filter = new WicketFilter();
filter.setFilterPath("/");
FilterHolder holder = new FilterHolder(filter);
holder.setInitParameter("applicationFactoryClassName", APP_FACTORY_NAME);
context.addFilter(holder, "/*", Handler.DEFAULT);
server.setHandler(context);
server.start();
server.join();
}
示例2: wicketFilterRegistration
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Bean
public FilterRegistrationBean wicketFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
WicketFilter wicketFilter = new WicketFilter();
registration.setFilter(wicketFilter);
registration.setName("wicketFilter");
registration.addInitParameter(WicketFilter.APP_FACT_PARAM,
SpringWebApplicationFactory.class.getName());
registration.addInitParameter("configuration", configuration);
registration.addInitParameter("testsMode", String.valueOf(testMode));
registration.addInitParameter("mockMode",String.valueOf(mockMode));
registration.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/portal/*");
registration.addInitParameter(WicketFilter.IGNORE_PATHS_PARAM,"/favicon.ico");
registration.addUrlPatterns("/portal/*");
registration.setDispatcherTypes(DispatcherType.REQUEST,DispatcherType.FORWARD);
registration.setMatchAfter(true);
return registration;
}
示例3: EmbeddableJetty
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
public EmbeddableJetty() {
System.setProperty("wicket.configuration", "development");
ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(new HttpConfiguration()));
http.setPort(PORT);
http.setIdleTimeout(1000 * 60 * 60);
server.addConnector(http);
ServletContextHandler sch = new ServletContextHandler(ServletContextHandler.SESSIONS);
FilterHolder fh2 = new FilterHolder(WicketFilter.class);
fh2.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM, WicketTestApplication.class.getName());
fh2.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
sch.addFilter(fh2, "/*", EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR));
server.setHandler(sch);
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
server.addEventListener(mBeanContainer);
server.addBean(mBeanContainer);
}
示例4: onStartup
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
//Create webapp context
AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); //part of spring-web
root.register(SpringSecurityConfiguration.class); //register class by annotation. Here be all security rules.
//Register DelegatingFilterProxy
FilterRegistration.Dynamic springSecurityFilterChainReg = servletContext.addFilter("springSecurityFilterChain", DelegatingFilterProxy.class);
springSecurityFilterChainReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.ERROR, DispatcherType.REQUEST), false, "/*");
servletContext.addListener(new ContextLoaderListener(root));
//Register WicketFilter
WicketFilter wicketFilter = new WicketFilter(new WicketApplication()) {
@Override
public void init(boolean isServlet, FilterConfig filterConfig) throws ServletException {
setFilterPath(""); //don't use web.xml. WicketApplication.init is a custom override for it.
super.init(isServlet, filterConfig);
}
};
FilterRegistration.Dynamic wicketFilterReg = servletContext.addFilter("wicketFilter", wicketFilter);
wicketFilterReg.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "*");
}
示例5: init
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Override
public void init(ServletConfig servletConfig) throws ServletException {
try {
FilterConfigImpl wicketFilterConfig = new FilterConfigImpl(servletConfig,
new WicketFilter(getWebApplication(servletConfig)),
"wicketFilter");
// wicketFilterConfig.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/app/*");
// filterChain = new CustomFilterChain(ImmutableList.of(
// wicketFilterConfig), servletConfig.getServletContext());
filterChain = new CustomFilterChain(ImmutableList.of(
wicketFilterConfig), servletConfig.getServletContext());
} catch (Exception ex) {
throw new ServletException(ex);
}
filterChain.init();
}
示例6: AbstractWebSocketProcessor
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
/**
* Constructor.
*
* @param request
* the http request that was used to create the TomcatWebSocketProcessor
* @param application
* the current Wicket Application
*/
public AbstractWebSocketProcessor(final HttpServletRequest request, final WebApplication application)
{
this.sessionId = request.getSession(true).getId();
String pageId = request.getParameter("pageId");
resourceName = request.getParameter("resourceName");
if (Strings.isEmpty(pageId) && Strings.isEmpty(resourceName))
{
throw new IllegalArgumentException("The request should have either 'pageId' or 'resourceName' parameter!");
}
if (Strings.isEmpty(pageId) == false)
{
this.pageId = Integer.parseInt(pageId, 10);
}
else
{
this.pageId = NO_PAGE_ID;
}
String baseUrl = request.getParameter(WebRequest.PARAM_AJAX_BASE_URL);
Checks.notNull(baseUrl, String.format("Request parameter '%s' is required!", WebRequest.PARAM_AJAX_BASE_URL));
this.baseUrl = Url.parse(baseUrl);
WicketFilter wicketFilter = application.getWicketFilter();
this.servletRequest = new ServletRequestCopy(request);
this.application = Args.notNull(application, "application");
this.webSocketSettings = WebSocketSettings.Holder.get(application);
this.webRequest = webSocketSettings.newWebSocketRequest(request, wicketFilter.getFilterPath());
this.connectionRegistry = webSocketSettings.getConnectionRegistry();
this.connectionFilter = webSocketSettings.getConnectionFilter();
}
示例7: configure
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Override
protected void configure() {
super.configure();
bind(WicketServlet.class).to(DefaultWicketServlet.class);
bind(WicketFilter.class).to(DefaultWicketFilter.class);
bind(WebSocketPolicy.class).toInstance(WebSocketPolicy.newServerPolicy());
bind(EditSupportRegistry.class).to(DefaultEditSupportRegistry.class);
bind(WebSocketManager.class).to(DefaultWebSocketManager.class);
contribute(CommitMessageTransformer.class, PatternCommitMessageTransformer.class);
contributeFromPackage(EditSupport.class, EditSupport.class);
bind(WebApplication.class).to(GitPlexWebApplication.class);
bind(Application.class).to(GitPlexWebApplication.class);
bind(AvatarManager.class).to(DefaultAvatarManager.class);
bind(WebSocketManager.class).to(DefaultWebSocketManager.class);
contributeFromPackage(EditSupport.class, EditSupportLocator.class);
bind(CommitIndexedBroadcaster.class);
contributeFromPackage(DiffRenderer.class, DiffRenderer.class);
contributeFromPackage(BlobRendererContribution.class, BlobRendererContribution.class);
contribute(Extension.class, new EmojiExtension());
contribute(Extension.class, new SourcePositionTrackExtension());
contribute(HtmlTransformer.class, new MentionTransformer());
contribute(HtmlTransformer.class, new PullRequestTransformer());
contribute(ResourcePackScopeContribution.class, new ResourcePackScopeContribution() {
@Override
public Collection<Class<?>> getResourcePackScopes() {
return Lists.newArrayList(WebModule.class);
}
});
contribute(ExpectedExceptionContribution.class, new ExpectedExceptionContribution() {
@SuppressWarnings("unchecked")
@Override
public Collection<Class<? extends Exception>> getExpectedExceptionClasses() {
return Sets.newHashSet(ConstraintViolationException.class, EntityNotFoundException.class,
ObjectNotFoundException.class, StaleStateException.class, UnauthorizedException.class,
GitException.class, PageExpiredException.class, StalePageException.class);
}
});
bind(UrlManager.class).to(DefaultUrlManager.class);
bind(CodeCommentChangeBroadcaster.class);
bind(PullRequestChangeBroadcaster.class);
bind(TaskChangeBroadcaster.class);
}
示例8: addWicketFilter
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
protected void addWicketFilter(ServletContext ctx, IServerContext context) {
FilterRegistration.Dynamic wicketFilter = ctx.addFilter(context.getName() + System.identityHashCode(context), WicketFilter.class);
wicketFilter.setInitParameter("applicationClassName", getWicketApplicationClass(context).getName());
wicketFilter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, context.getContextPath());
wicketFilter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, context.getContextPath());
}
示例9: wicketFilter
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Bean @DependsOn("openEntityManagerInViewFilter")
public FilterRegistrationBean wicketFilter() {
final FilterRegistrationBean reg = new FilterRegistrationBean(new WicketFilter());
reg.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
reg.addInitParameter(WicketFilter.APP_FACT_PARAM, SpringWebApplicationFactory.class.getName());
reg.addInitParameter("applicationBean", "webApp");
final RuntimeConfigurationType wicketConfiguration =
env.getRequiredProperty("wicket.configuration", RuntimeConfigurationType.class);
reg.addInitParameter("configuration", wicketConfiguration.name());
return reg;
}
示例10: wicketFilter
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Bean
public FilterRegistrationBean wicketFilter() {
final FilterRegistrationBean reg = new FilterRegistrationBean(new WicketFilter());
reg.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
reg.addInitParameter(WicketFilter.APP_FACT_PARAM, SpringWebApplicationFactory.class.getName());
reg.addInitParameter("applicationBean", "webApp");
reg.addInitParameter("configuration", env.getRequiredProperty("wicket.configuration"));
// reg.addInitParameter("applicationClassName", MyWebApplication.class.name);
return reg;
}
示例11: onStartup
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
String[] beanNamesForType = applicationContext.getBeanNamesForType(WicketBootWebApplication.class);
if(beanNamesForType.length != 1){
throw new IllegalStateException("Could not find exactly one bean for type WicketBootWebApplication " + beanNamesForType.length);
}
FilterRegistration filter = servletContext.addFilter(WICKET_FILTERNAME, wicketWebInitializerConfig.filterClass());
// Spring configuration
filter.setInitParameter(WicketFilter.APP_FACT_PARAM, SpringWebApplicationFactory.class.getName());
filter.setInitParameter("applicationBean", beanNamesForType[0]);
filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, props.getFilterMappingParam());
filter.addMappingForUrlPatterns(EnumSet.copyOf( props.getDispatcherTypes() ), false, props.getFilterMappingParam());
Map<String, String> initParameters = props.getInitParameters();
for (Entry<String, String> initParam : initParameters.entrySet()) {
filter.setInitParameter(initParam.getKey(), initParam.getValue());
}
wicketEndpointRepository.add(new WicketAutoConfig.Builder(this.getClass())
.withDetail("wicketFilterName", WICKET_FILTERNAME)
.withDetail("wicketFilterClass", wicketWebInitializerConfig.filterClass())
.withDetail("properties", props)
.build());
}
示例12: createAdminConsoleHandler
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
private Handler createAdminConsoleHandler() {
FilterHolder filter = new FilterHolder(WicketFilter.class);
filter.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
HyracksAdminConsoleApplication.class.getName());
filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
filter.setInitParameter(Application.CONFIGURATION, RuntimeConfigurationType.DEPLOYMENT.toString());
ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
handler.setContextPath("/adminconsole");
handler.setAttribute(ClusterControllerService.class.getName(), ccs);
handler.addFilter(filter, "/*", EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR));
handler.addServlet(DefaultServlet.class, "/");
return handler;
}
示例13: wicket
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Bean
public FilterRegistrationBean wicket() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new WicketFilter());
registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ERROR);
registration.addUrlPatterns("/*");
registration.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
registration.addInitParameter(Application.CONFIGURATION, "deployment"); // development
registration.addInitParameter("applicationBean", "midpointApplication");
registration.addInitParameter(WicketFilter.APP_FACT_PARAM, "org.apache.wicket.spring.SpringWebApplicationFactory");
return registration;
}
示例14: onStartup
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Override
public void onStartup(ServletContext sc) throws ServletException {
FilterRegistration filter = sc.addFilter("wicket-filter",
WicketFilter.class);
filter.setInitParameter(WicketFilter.APP_FACT_PARAM,
SpringWebApplicationFactory.class.getName());
filter.setInitParameter(PARAM_APP_BEAN, "wicketWebApplication");
// This line is the only surprise when comparing to the equivalent
// web.xml. Without some initialization seems to be missing.
filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
filter.addMappingForUrlPatterns(null, false, "/*");
}
示例15: wicketFilter
import org.apache.wicket.protocol.http.WicketFilter; //导入依赖的package包/类
@Bean
public FilterRegistrationBean wicketFilter() {
final FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(new WicketFilter());
filterRegistrationBean.addInitParameter(WicketFilter.APP_FACT_PARAM, SpringWebApplicationFactory.class.getName());
filterRegistrationBean.addInitParameter("applicationBean", "wicketApplication");
filterRegistrationBean.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
filterRegistrationBean.addUrlPatterns("/*");
filterRegistrationBean.addServletNames("wicket-filter");
return filterRegistrationBean;
}