org.thymeleaf.processor.IProcessor Java Examples
The following examples show how to use
org.thymeleaf.processor.IProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringDataDialect.java From thymeleaf-spring-data-dialect with Apache License 2.0 | 6 votes |
public Set<IProcessor> getProcessors(final String dialectPrefix) { final Set<IProcessor> processors = new HashSet<IProcessor>(); processors.add(new StandardXmlNsTagProcessor(TemplateMode.HTML, PREFIX)); processors.add(new PaginationAttrProcessor(PREFIX)); processors.add(new PaginationSortAttrProcessor(PREFIX)); processors.add(new PaginationSortAscAttrProcessor(PREFIX)); processors.add(new PaginationSortDescAttrProcessor(PREFIX)); processors.add(new PaginationSummaryAttrProcessor(PREFIX)); processors.add(new PageObjectAttrProcessor(PREFIX)); processors.add(new PaginationUrlAttrProcessor(PREFIX)); processors.add(new PaginationQualifierAttrProcessor(PREFIX)); processors.add(new PaginationSplitAttrProcessor(PREFIX)); processors.add(new PageSizeSelectorAttrProcessor(PREFIX)); return processors; }
Example #2
Source File: ThSysDialect.java From mayday with GNU General Public License v3.0 | 5 votes |
@Override public Set<IProcessor> getProcessors(String dialectPrefix) { Set<IProcessor> processors = new HashSet<IProcessor>(); processors.add(new ThSysTagProcessor(dialectPrefix)); processors.add(new StandardXmlNsTagProcessor(TemplateMode.HTML, dialectPrefix)); return processors; }
Example #3
Source File: ThymeleafCsrfDialectTest.java From wisdom with Apache License 2.0 | 5 votes |
@Test public void testTheCreatedProcessorWithToken() { ThymeleafCsrfDialect component = new ThymeleafCsrfDialect(); component.csrf = new CSRFServiceImpl(); ((CSRFServiceImpl) component.csrf).crypto = new CryptoServiceSingleton(CSRFServiceImplTest.SECRET, Hash.MD5, 128, Crypto.AES_CBC_ALGORITHM, 20); final Configuration configuration = mock(Configuration.class); when(configuration.getWithDefault("token.name", "csrfToken")).thenReturn("csrfToken"); ((CSRFServiceImpl) component.csrf).configuration = configuration; FakeContext ctxt = new FakeContext(); ctxt.getFakeRequest().data().put(CSRFServiceImpl.TOKEN_KEY, "token"); Context.CONTEXT.set(ctxt); IDialect dialect = component.createDialect(); assertThat(dialect.getPrefix()).isEqualToIgnoringCase("csrf"); assertThat(dialect.getProcessors()).hasSize(1); IProcessor processor = dialect.getProcessors().iterator().next(); assertThat(processor).isInstanceOf(ThymeleafCsrfDialect.CSRFElementProcessor.class); List<Node> nodes = ((ThymeleafCsrfDialect.CSRFElementProcessor) processor).getMarkupSubstitutes(null, null); assertThat(nodes).hasSize(1); assertThat(nodes.get(0)).isInstanceOf(Element.class); Element element = (Element) nodes.get(0); assertThat(element.getNormalizedName()).isEqualTo("input"); assertThat(element.getAttributeFromNormalizedName("type").getValue()).isEqualTo("hidden"); assertThat(element.getAttributeFromNormalizedName("name").getValue()).isEqualTo("csrfToken"); assertThat(element.getAttributeFromNormalizedName("value").getValue()).isEqualTo("token"); }
Example #4
Source File: WebjarsDialect.java From cat-boot with Apache License 2.0 | 5 votes |
@Override public Set<IProcessor> getProcessors() { Set<IProcessor> processors = new HashSet<>(); processors.add(new WebjarsLinkProcessor("src")); processors.add(new WebjarsLinkProcessor("href")); return Collections.unmodifiableSet(processors); }
Example #5
Source File: ThymeleafProcessorDialect.java From wenku with MIT License | 5 votes |
@Override public Set<IProcessor> getProcessors(final String dialectPrefix) { final Set<IProcessor> processors = new HashSet<>(); processors.add(new PrettytimeProcessor()); // 日期美化 Processor processors.add(new PropertiesProcessor()); // 获取配置文件 Processor return processors; }
Example #6
Source File: DataAttributeDialect.java From thymeleaf-extras-data-attribute with Apache License 2.0 | 5 votes |
@Override public Set<IProcessor> getProcessors(String dialectPrefix) { HashSet<IProcessor> processors = new HashSet<IProcessor>(); processors.add(new StandardXmlNsTagProcessor(TemplateMode.HTML, dialectPrefix)); processors.add(new DataProcessor(TemplateMode.HTML, dialectPrefix)); return processors; }
Example #7
Source File: ThymeleafCsrfDialectTest.java From wisdom with Apache License 2.0 | 5 votes |
@Test public void testTheCreatedProcessorWhenNoTokenCreated() { ThymeleafCsrfDialect component = new ThymeleafCsrfDialect(); component.csrf = new CSRFServiceImpl(); ((CSRFServiceImpl) component.csrf).crypto = new CryptoServiceSingleton(CSRFServiceImplTest.SECRET, Hash.MD5, 128, Crypto.AES_CBC_ALGORITHM, 20); final Configuration configuration = mock(Configuration.class); when(configuration.getWithDefault("token.name", "csrfToken")).thenReturn("csrfToken"); ((CSRFServiceImpl) component.csrf).configuration = configuration; FakeContext ctxt = new FakeContext(); Context.CONTEXT.set(ctxt); IDialect dialect = component.createDialect(); assertThat(dialect.getPrefix()).isEqualToIgnoringCase("csrf"); assertThat(dialect.getProcessors()).hasSize(1); IProcessor processor = dialect.getProcessors().iterator().next(); assertThat(processor).isInstanceOf(ThymeleafCsrfDialect.CSRFElementProcessor.class); List<Node> nodes = ((ThymeleafCsrfDialect.CSRFElementProcessor) processor).getMarkupSubstitutes(null, null); assertThat(nodes).hasSize(1); assertThat(nodes.get(0)).isInstanceOf(Element.class); Element element = (Element) nodes.get(0); assertThat(element.getNormalizedName()).isEqualTo("input"); assertThat(element.getAttributeFromNormalizedName("type").getValue()).isEqualTo("hidden"); assertThat(element.getAttributeFromNormalizedName("name").getValue()).isEqualTo("csrfToken"); assertThat(element.getAttributeFromNormalizedName("value").getValue()).isEqualTo("invalid"); }
Example #8
Source File: ThymeleafCsrfDialect.java From wisdom with Apache License 2.0 | 5 votes |
protected IDialect createDialect() { return new AbstractDialect() { @Override public String getPrefix() { return "csrf"; } @Override public Set<IProcessor> getProcessors() { return ImmutableSet.<IProcessor>of(new CSRFElementProcessor()); } }; }
Example #9
Source File: ShiroDialect.java From thymeleaf-extras-shiro with Apache License 2.0 | 4 votes |
private static Set<IProcessor> createStandardProcessorsSet(String dialectPrefix) { LinkedHashSet<IProcessor> processors = new LinkedHashSet<IProcessor>(); processors.add(new PrincipalAttrProcessor(dialectPrefix)); processors.add(new PrincipalElementProcessor(dialectPrefix)); processors.add(new HasAllRolesAttrProcessor(dialectPrefix)); processors.add(new HasAllRolesElementProcessor(dialectPrefix)); processors.add(new HasAnyRolesAttrProcessor(dialectPrefix)); processors.add(new HasAnyRolesElementProcessor(dialectPrefix)); processors.add(new HasRoleAttrProcessor(dialectPrefix)); processors.add(new HasRoleElementProcessor(dialectPrefix)); processors.add(new LacksRoleAttrProcessor(dialectPrefix)); processors.add(new LacksRoleElementProcessor(dialectPrefix)); processors.add(new HasAllPermissionsAttrProcessor(dialectPrefix)); processors.add(new HasAllPermissionsElementProcessor(dialectPrefix)); processors.add(new HasAnyPermissionsAttrProcessor(dialectPrefix)); processors.add(new HasAnyPermissionsElementProcessor(dialectPrefix)); processors.add(new HasPermissionAttrProcessor(dialectPrefix)); processors.add(new HasPermissionElementProcessor(dialectPrefix)); processors.add(new LacksPermissionAttrProcessor(dialectPrefix)); processors.add(new LacksPermissionElementProcessor(dialectPrefix)); processors.add(new AuthenticatedAttrProcessor(dialectPrefix)); processors.add(new AuthenticatedElementProcessor(dialectPrefix)); processors.add(new NotAuthenticatedAttrProcessor(dialectPrefix)); processors.add(new NotAuthenticatedElementProcessor(dialectPrefix)); processors.add(new GuestAttrProcessor(dialectPrefix)); processors.add(new GuestElementProcessor(dialectPrefix)); processors.add(new UserAttrProcessor(dialectPrefix)); processors.add(new UserElementProcessor(dialectPrefix)); // Remove the xmlns:prefix attributes we might add for IDE validation but should not be exposed in the web browsers. processors.add(new StandardXmlNsTagProcessor(TemplateMode.HTML, dialectPrefix)); return processors; }
Example #10
Source File: WebAuthnDialect.java From webauthn4j-spring-security with Apache License 2.0 | 4 votes |
@Override public Set<IProcessor> getProcessors(String dialectPrefix) { final Set<IProcessor> processors = new LinkedHashSet<>(); processors.add(new ChallengeAttrProcessor(getPrefix(), getDialectProcessorPrecedence())); return processors; }
Example #11
Source File: ShiroDialect.java From thymeleaf-extras-shiro with Apache License 2.0 | 4 votes |
public Set<IProcessor> getProcessors(String dialectPrefix) { return createStandardProcessorsSet(dialectPrefix); }
Example #12
Source File: MyDialect.java From wisdom with Apache License 2.0 | 4 votes |
@Override public Set<IProcessor> getProcessors() { return ImmutableSet.<IProcessor>of(new SayToAttrProcessor()); }
Example #13
Source File: MyDialect.java From wisdom with Apache License 2.0 | 4 votes |
@Override public Set<IProcessor> getProcessors() { return ImmutableSet.<IProcessor>of(new SayToAttrProcessor()); }
Example #14
Source File: KonkerDialect.java From konker-platform with Apache License 2.0 | 4 votes |
public Set<IProcessor> getProcessors(final String dialectPrefix) { final Set<IProcessor> processors = new HashSet<IProcessor>(); processors.add(new EnabledImageTagProcessor(dialectPrefix)); return processors; }
Example #15
Source File: DictDialect.java From FEBS-Security with Apache License 2.0 | 4 votes |
private static Set<IProcessor> createStandardProcessorsSet(String dialectPrefix) { final Set<IProcessor> processors = new HashSet<IProcessor>(); processors.add(new DictShowProcessor(dialectPrefix)); processors.add(new DictSelectProcessor(dialectPrefix)); return processors; }
Example #16
Source File: DictDialect.java From FEBS-Security with Apache License 2.0 | 4 votes |
@Override public Set<IProcessor> getProcessors(String dialectPrefix) { return createStandardProcessorsSet(dialectPrefix); }
Example #17
Source File: NimrodDialect.java From nimrod with MIT License | 4 votes |
@Override public Set<IProcessor> getProcessors(String s) { final Set<IProcessor> processors = new HashSet<>(); processors.add(new SecurityAuthorityElementProcessor(s)); return processors; }