use of org.zaproxy.zap.model.StructuralNodeModifier in project zaproxy by zaproxy.
the class ContextStructurePanel method saveToContext.
/**
* Save the data from this panel to the provided context.
*
* @param context the context
* @param updateSiteStructure {@code true} if the nodes of the context should be restructured, {@code false} otherwise
* @see Context#restructureSiteTree()
*/
private void saveToContext(Context context, boolean updateSiteStructure) {
ParameterParser urlParamParser = context.getUrlParamParser();
ParameterParser formParamParser = context.getPostParamParser();
List<String> structParams = new ArrayList<String>();
List<StructuralNodeModifier> ddns = new ArrayList<StructuralNodeModifier>();
for (StructuralNodeModifier snm : this.ddnTableModel.getElements()) {
if (snm.getType().equals(StructuralNodeModifier.Type.StructuralParameter)) {
structParams.add(snm.getName());
} else {
ddns.add(snm);
}
}
if (urlParamParser instanceof StandardParameterParser) {
StandardParameterParser urlStdParamParser = (StandardParameterParser) urlParamParser;
urlStdParamParser.setKeyValuePairSeparators(this.getUrlKvPairSeparators().getText());
urlStdParamParser.setKeyValueSeparators(this.getUrlKeyValueSeparators().getText());
urlStdParamParser.setStructuralParameters(structParams);
context.setUrlParamParser(urlStdParamParser);
urlStdParamParser.setContext(context);
}
if (formParamParser instanceof StandardParameterParser) {
StandardParameterParser formStdParamParser = (StandardParameterParser) formParamParser;
formStdParamParser.setKeyValuePairSeparators(this.getPostKvPairSeparators().getText());
formStdParamParser.setKeyValueSeparators(this.getPostKeyValueSeparators().getText());
context.setPostParamParser(formStdParamParser);
formStdParamParser.setContext(context);
}
context.setDataDrivenNodes(ddns);
if (updateSiteStructure) {
context.restructureSiteTree();
}
}
Aggregations