private void mergeQueryParams(UrlMapping parent, UrlMapping child) { List<QueryParameter> result = new ArrayList<QueryParameter>(); for (QueryParameter queryParam : parent.getQueryParams()) { if (!result.contains(queryParam)) { result.add(copy(queryParam)); } } for (QueryParameter queryParam : child.getQueryParams()) { if (!result.contains(queryParam)) { result.add(copy(queryParam)); } } child.setQueryParams(result); }
public PrettyConfig processConfiguration(ServletContext context, PrettyConfig config) { String enabled = context.getInitParameter(HIERARCHY_ENABLED_PARAM); if ((enabled != null) && "false".equalsIgnoreCase(enabled.trim())) { return config; } List<UrlMapping> mappings = config.getMappings(); for (UrlMapping m : mappings) { createAncestry(config, m); } return config; }
private void createAncestry(PrettyConfig config, UrlMapping m) { if (m.hasParent() && !seen.contains(m)) { UrlMapping parent = config.getMappingById(m.getParentId()); if (parent == null) { throw new PrettyException("Error when building configuration for URL-mapping [" + m.getId() + ":" + m.getPattern() + "] - the requested parentId [" + m.getParentId() + "] does not exist in the configuration."); } if (parent.hasParent()) { createAncestry(config, parent); } m.setPattern(parent.getPattern() + m.getPattern()); mergeValidators(parent, m); mergeActions(parent, m); mergeQueryParams(parent, m); seen.add(m); } }
ConfigurationPostProcessor parenting = new ParentingPostProcessor();
private void createAncestry(PrettyConfig config, UrlMapping m) { if (m.hasParent() && !seen.contains(m)) { UrlMapping parent = config.getMappingById(m.getParentId()); if (parent == null) { throw new PrettyException("Error when building configuration for URL-mapping [" + m.getId() + ":" + m.getPattern() + "] - the requested parentId [" + m.getParentId() + "] does not exist in the configuration."); } if (parent.hasParent()) { createAncestry(config, parent); } m.setPattern(parent.getPattern() + m.getPattern()); mergeValidators(parent, m); mergeActions(parent, m); mergeQueryParams(parent, m); seen.add(m); } }
ConfigurationPostProcessor parenting = new ParentingPostProcessor();
private void createAncestry(PrettyConfig config, UrlMapping m) { if (m.hasParent() && !seen.contains(m)) { UrlMapping parent = config.getMappingById(m.getParentId()); if (parent == null) { throw new PrettyException("Error when building configuration for URL-mapping [" + m.getId() + ":" + m.getPattern() + "] - the requested parentId [" + m.getParentId() + "] does not exist in the configuration."); } if (parent.hasParent()) { createAncestry(config, parent); } m.setPattern(parent.getPattern() + m.getPattern()); mergeValidators(parent, m); mergeActions(parent, m); mergeQueryParams(parent, m); seen.add(m); } }
private void mergeQueryParams(UrlMapping parent, UrlMapping child) { List<QueryParameter> result = new ArrayList<QueryParameter>(); for (QueryParameter queryParam : parent.getQueryParams()) { if (!result.contains(queryParam)) { result.add(copy(queryParam)); } } for (QueryParameter queryParam : child.getQueryParams()) { if (!result.contains(queryParam)) { result.add(copy(queryParam)); } } child.setQueryParams(result); }
public PrettyConfig processConfiguration(ServletContext context, PrettyConfig config) { String enabled = context.getInitParameter(HIERARCHY_ENABLED_PARAM); if ((enabled != null) && "false".equalsIgnoreCase(enabled.trim())) { return config; } List<UrlMapping> mappings = config.getMappings(); for (UrlMapping m : mappings) { createAncestry(config, m); } return config; }
ConfigurationPostProcessor parenting = new ParentingPostProcessor();
private void createAncestry(PrettyConfig config, UrlMapping m) { if (m.hasParent() && !seen.contains(m)) { UrlMapping parent = config.getMappingById(m.getParentId()); if (parent == null) { throw new PrettyException("Error when building configuration for URL-mapping [" + m.getId() + ":" + m.getPattern() + "] - the requested parentId [" + m.getParentId() + "] does not exist in the configuration."); } if (parent.hasParent()) { createAncestry(config, parent); } m.setPattern(parent.getPattern() + m.getPattern()); mergeValidators(parent, m); mergeActions(parent, m); mergeQueryParams(parent, m); seen.add(m); } }
private void mergeQueryParams(UrlMapping parent, UrlMapping child) { List<QueryParameter> result = new ArrayList<QueryParameter>(); for (QueryParameter queryParam : parent.getQueryParams()) { if (!result.contains(queryParam)) { result.add(copy(queryParam)); } } for (QueryParameter queryParam : child.getQueryParams()) { if (!result.contains(queryParam)) { result.add(copy(queryParam)); } } child.setQueryParams(result); }
@Override public PrettyConfig processConfiguration(ServletContext context, PrettyConfig config) { String enabled = context.getInitParameter(HIERARCHY_ENABLED_PARAM); if ((enabled != null) && "false".equalsIgnoreCase(enabled.trim())) { return config; } List<UrlMapping> mappings = config.getMappings(); for (UrlMapping m : mappings) { createAncestry(config, m); } return config; }
ConfigurationPostProcessor parenting = new ParentingPostProcessor();
private void mergeQueryParams(UrlMapping parent, UrlMapping child) { List<QueryParameter> result = new ArrayList<QueryParameter>(); for (QueryParameter queryParam : parent.getQueryParams()) { if (!result.contains(queryParam)) { result.add(copy(queryParam)); } } for (QueryParameter queryParam : child.getQueryParams()) { if (!result.contains(queryParam)) { result.add(copy(queryParam)); } } child.setQueryParams(result); }
public PrettyConfig processConfiguration(ServletContext context, PrettyConfig config) { String enabled = context.getInitParameter(HIERARCHY_ENABLED_PARAM); if ((enabled != null) && "false".equalsIgnoreCase(enabled.trim())) { return config; } List<UrlMapping> mappings = config.getMappings(); for (UrlMapping m : mappings) { createAncestry(config, m); } return config; }
private void mergeActions(UrlMapping parent, UrlMapping child) { List<UrlAction> result = new ArrayList<UrlAction>(); for (UrlAction action : parent.getActions()) { if (!result.contains(action) && action.isInheritable()) { result.add(copy(action)); } } for (UrlAction action : child.getActions()) { if (!result.contains(action)) { result.add(copy(action)); } } child.setActions(result); }
private void mergeActions(UrlMapping parent, UrlMapping child) { List<UrlAction> result = new ArrayList<UrlAction>(); for (UrlAction action : parent.getActions()) { if (!result.contains(action) && action.isInheritable()) { result.add(copy(action)); } } for (UrlAction action : child.getActions()) { if (!result.contains(action)) { result.add(copy(action)); } } child.setActions(result); }
private void mergeActions(UrlMapping parent, UrlMapping child) { List<UrlAction> result = new ArrayList<UrlAction>(); for (UrlAction action : parent.getActions()) { if (!result.contains(action) && action.isInheritable()) { result.add(copy(action)); } } for (UrlAction action : child.getActions()) { if (!result.contains(action)) { result.add(copy(action)); } } child.setActions(result); }
private void mergeActions(UrlMapping parent, UrlMapping child) { List<UrlAction> result = new ArrayList<UrlAction>(); for (UrlAction action : parent.getActions()) { if (!result.contains(action) && action.isInheritable()) { result.add(copy(action)); } } for (UrlAction action : child.getActions()) { if (!result.contains(action)) { result.add(copy(action)); } } child.setActions(result); }