Skip to content

Instantly share code, notes, and snippets.

@chkal
Created August 8, 2012 04:57
Show Gist options
  • Save chkal/3292206 to your computer and use it in GitHub Desktop.
Save chkal/3292206 to your computer and use it in GitHub Desktop.
Using Jade with Rewrite
public class JadeTransformer extends StringTransformer
{
@Override
public String transform(String src)
{
try {
return new Jade().process(src, new HashMap<String, Object>());
}
catch (IOException e) {
throw new IllegalStateException(e);
}
}
}
public class MyConfigProvider extends HttpConfigurationProvider
{
@Override
public int priority()
{
return 0;
}
@Override
public Configuration getConfiguration(final ServletContext context)
{
return ConfigurationBuilder.begin()
.addRule()
.when(Path.matches("/{something}.html"))
.perform(Forward.to("/{something}.jade").and(Transform.with(JadeTransformer.class)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment