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
*/
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())
{
@@ -218,7 +234,10 @@ public class PreProcessorUtil
changeset.getId(), repository.getName());
}
EscapeUtil.escape(changeset);
if (escape)
{
EscapeUtil.escape(changeset);
}
PreProcessorHandler<Changeset> handler =
new PreProcessorHandler<Changeset>(changesetPreProcessorFactorySet,

View File

@@ -95,9 +95,9 @@ public final class HookChangesetBuilder
/**
* Returns a immutable {@link List} of added {@link Changeset}'s.
* <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
* {@link #getChangesets()} instead. The {@link #getChangesets()} needs less
* <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
* {@link #getChangesets()} instead. The {@link #getChangesets()} needs less
* memory and should be much more faster then this method.
*
* @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.
*
* @return {@link Iterable} for added {@link Changeset}s
@@ -132,7 +132,8 @@ public final class HookChangesetBuilder
try
{
copy = DeepCopy.copy(c);
preProcessorUtil.prepareForReturn(repository, copy);
preProcessorUtil.prepareForReturn(repository, copy,
!disableEscaping);
}
catch (IOException ex)
{
@@ -155,6 +156,24 @@ public final class HookChangesetBuilder
//~--- 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.
*
@@ -173,6 +192,9 @@ public final class HookChangesetBuilder
//~--- fields ---------------------------------------------------------------
/** disable escaping */
private boolean disableEscaping = false;
/** disable pre processors marker */
private boolean disablePreProcessors = false;