Created
September 14, 2013 16:16
-
-
Save steinermatt/6563271 to your computer and use it in GitHub Desktop.
pjax-tiles / src / main / java / net / inscope / sandbox / pjax / web / PJAXViewPreparer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.inscope.sandbox.pjax.web; | |
import org.apache.tiles.Attribute; | |
import org.apache.tiles.AttributeContext; | |
import org.apache.tiles.context.TilesRequestContext; | |
import org.apache.tiles.preparer.PreparerException; | |
import org.apache.tiles.preparer.ViewPreparer; | |
public class PJAXViewPreparer implements ViewPreparer | |
{ | |
public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext) throws PreparerException | |
{ | |
if (tilesContext.getHeader().containsKey("x-pjax")) | |
{ | |
Attribute template = attributeContext.getTemplateAttribute(); | |
String templatePath = (String) template.getValue(); | |
templatePath = templatePath.replace("default", "pjax"); | |
template.setValue(templatePath); | |
attributeContext.setTemplateAttribute(template); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment