added property to disable escaping for hooks

This commit is contained in:
Sebastian Sdorra
2013-12-27 15:42:50 +01:00
parent 8274697426
commit e4902f093e
2 changed files with 47 additions and 6 deletions

View File

@@ -211,6 +211,22 @@ public class PreProcessorUtil
* @param changeset * @param changeset
*/ */
public void prepareForReturn(Repository repository, Changeset changeset) public void prepareForReturn(Repository repository, Changeset changeset)
{
prepareForReturn(repository, changeset, true);
}
/**
* Method description
*
*
* @param repository
* @param changeset
* @param escape
*
* @since 1.35
*/
public void prepareForReturn(Repository repository, Changeset changeset,
boolean escape)
{ {
if (logger.isTraceEnabled()) if (logger.isTraceEnabled())
{ {
@@ -218,7 +234,10 @@ public class PreProcessorUtil
changeset.getId(), repository.getName()); changeset.getId(), repository.getName());
} }
EscapeUtil.escape(changeset); if (escape)
{
EscapeUtil.escape(changeset);
}
PreProcessorHandler<Changeset> handler = PreProcessorHandler<Changeset> handler =
new PreProcessorHandler<Changeset>(changesetPreProcessorFactorySet, new PreProcessorHandler<Changeset>(changesetPreProcessorFactorySet,

View File

@@ -95,9 +95,9 @@ public final class HookChangesetBuilder
/** /**
* Returns a immutable {@link List} of added {@link Changeset}'s. * Returns a immutable {@link List} of added {@link Changeset}'s.
* <strong>Note:</strong> Use this method only if you need a {@link List}, if * <strong>Note:</strong> Use this method only if you need a {@link List}, if
* you just want to iterate over the {@link Changeset}'s use * you just want to iterate over the {@link Changeset}'s use
* {@link #getChangesets()} instead. The {@link #getChangesets()} needs less * {@link #getChangesets()} instead. The {@link #getChangesets()} needs less
* memory and should be much more faster then this method. * memory and should be much more faster then this method.
* *
* @return immutable {@link List} of added {@link Changeset}'s * @return immutable {@link List} of added {@link Changeset}'s
@@ -108,7 +108,7 @@ public final class HookChangesetBuilder
} }
/** /**
* Returns an {@link Iterable} which is able to return all {@link Changeset}s * Returns an {@link Iterable} which is able to return all {@link Changeset}s
* which are added to the repository. * which are added to the repository.
* *
* @return {@link Iterable} for added {@link Changeset}s * @return {@link Iterable} for added {@link Changeset}s
@@ -132,7 +132,8 @@ public final class HookChangesetBuilder
try try
{ {
copy = DeepCopy.copy(c); copy = DeepCopy.copy(c);
preProcessorUtil.prepareForReturn(repository, copy); preProcessorUtil.prepareForReturn(repository, copy,
!disableEscaping);
} }
catch (IOException ex) catch (IOException ex)
{ {
@@ -155,6 +156,24 @@ public final class HookChangesetBuilder
//~--- set methods ---------------------------------------------------------- //~--- set methods ----------------------------------------------------------
/**
* Disable html escaping for the returned changesets. By default all
* changesets are html escaped.
*
*
* @param disableEscaping true to disable the html escaping
*
* @return {@code this}
*
* @since 1.35
*/
public HookChangesetBuilder setDisableEscaping(boolean disableEscaping)
{
this.disableEscaping = disableEscaping;
return this;
}
/** /**
* Disable the execution of pre processors. * Disable the execution of pre processors.
* *
@@ -173,6 +192,9 @@ public final class HookChangesetBuilder
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** disable escaping */
private boolean disableEscaping = false;
/** disable pre processors marker */ /** disable pre processors marker */
private boolean disablePreProcessors = false; private boolean disablePreProcessors = false;