UrlMapping mapping = new UrlMapping(); mapping.setId(mappingAnnotation.id()); mapping.setParentId(mappingAnnotation.parentId()); mapping.setPattern(mappingAnnotation.pattern()); mapping.setViewId(mappingAnnotation.viewId()); mapping.setOutbound(mappingAnnotation.outbound()); mapping.setOnPostback(mappingAnnotation.onPostback()); Object existingMapping = urlMappings.put(mapping.getId(), mapping); throw new IllegalArgumentException("Duplicated mapping id: " + mapping.getId()); "Please set the index of the path parameter you want to validate with the @URLValidator specified on mapping: " + mapping.getId()); mapping.getPathValidators().add(pathValidator); return mapping.getId().trim();
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 UrlMapping buildPrettyFacesUrlMapping(String viewId, Annotation annotation, String facesMapping) { org.jboss.seam.faces.rewrite.UrlMapping urlMappingAnnotation = (org.jboss.seam.faces.rewrite.UrlMapping) annotation; UrlMapping urlMapping = new UrlMapping(); urlMapping.setViewId(buildViewUrl(viewId, facesMapping)); urlMapping.setId(viewId); urlMapping.setOnPostback(urlMappingAnnotation.onPostback()); urlMapping.setOutbound(urlMappingAnnotation.outbound()); urlMapping.setPattern(urlMappingAnnotation.pattern()); return urlMapping; }
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); } }
List<QueryParameter> queryParams = mapping.getQueryParams(); List<QueryParameter> queryParameterValues = new ArrayList<QueryParameter>(); + mapping.getId() + " >, Error occurred while extracting values from backing bean" + " < " + expression + ":" + value + " >", e);
if (!mapping.isOnPostback() && FacesStateUtils.isPostback(context)) List<PathParameter> params = mapping.getPatternParser().parse(url); for (PathParameter param : params) throw new PrettyException("PrettyFaces: Exception occurred while processing <" + mapping.getId() + ":" + el + "> for URL <" + url + ">", e);
private void validatePathParams(final FacesContext context, final URL url, final UrlMapping mapping) List<PathParameter> params = mapping.getPatternParser().parse(url); List<PathValidator> validators = mapping.getValidatorsForPathParam(param); + "] on mappingId [" + mapping.getId() + "] to type in location [" + currentParameter.getExpression() + "]"); handleValidationFailure(context, message, currentPathValidator.getOnError()); + "] on mappingId [" + mapping.getId() + "] parameter [" + currentParameter.getExpression() + "] at position [" + currentParameter.getPosition() + "]"); handleValidationFailure(context, message, currentPathValidator.getOnError());
log.trace("Adding action expression '" + urlAction.getAction() + "' to mapping: " + mapping.getId()); mapping.addAction(urlAction); + mapping.getId()); mapping.addQueryParam(queryParam);
if (cachedMappingId != null) return mapping.getId().equals(Decoder.query(cachedMappingId)); String mappingViewId = mapping.getViewId(); int outboundQueryStringStart = outboundPath.indexOf("?"); if (outboundQueryStringStart != -1) if (mapping.getViewId().contains("?")) { mappingViewQueryString.addParameters(mapping.getViewId());
String viewId = mapping.getViewId(); if (mapping.isDynaView()) qs.addParameters("?" + PrettyFacesWrappedResponse.REWRITE_MAPPING_ID_KEY + "=" + mapping.getId());
public void executeActions(final FacesContext context, final PhaseId currentPhaseId, final UrlMapping mapping) List<UrlAction> actions = mapping.getActions(); for (UrlAction action : actions) throw new PrettyException("Exception occurred while processing <" + mapping.getId() + ":" + action.getAction() + "> " + e.getMessage(), e);
URLPatternParser parser = mapping.getPatternParser(); List<PathParameter> parameters = parser.getPathParameters(); List<String> parameterValues = new ArrayList<String>(); + mapping.getId() + " >, Required value " + " < " + expression + " > was null"); + mapping.getId() + " >, Error occurred while extracting values from backing bean" + " < " + expression + ":" + value + " >", e);
REWRITE_MAPPING_ID_KEY + ":" + mapping.getId()); String viewId = mapping.getViewId(); log.trace("Forwarding mapped request [" + url.toURL() + "] to resource [" + viewId + "]"); if (url.toURL().equals(viewId)) else if ((event instanceof HttpOutboundServletRewrite) && mapping.isOutbound())
/** * Get the {@link UrlMapping} corresponding with the given mapping id. * * @param id Mapping id * @return PrettyUrlMapping Corresponding mapping */ public UrlMapping getMappingById(String id) { if (id != null) { if (id.startsWith(PrettyContext.PRETTY_PREFIX)) { id = id.substring(PrettyContext.PRETTY_PREFIX.length()); } for (UrlMapping mapping : getMappings()) { if (mapping.getId().equals(id)) { return mapping; } } } return null; }
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); } }
List<QueryParameter> queryParams = mapping.getQueryParams(); List<QueryParameter> queryParameterValues = new ArrayList<QueryParameter>(); + mapping.getId() + " >, Error occurred while extracting values from backing bean" + " < " + expression + ":" + value + " >", e);
if (!mapping.isOnPostback() && FacesStateUtils.isPostback(context)) List<PathParameter> params = mapping.getPatternParser().parse(url); for (PathParameter param : params) throw new PrettyException("PrettyFaces: Exception occurred while processing <" + mapping.getId() + ":" + el + "> for URL <" + url + ">", e);
private void validatePathParams(final FacesContext context, final URL url, final UrlMapping mapping) List<PathParameter> params = mapping.getPatternParser().parse(url); List<PathValidator> validators = mapping.getValidatorsForPathParam(param); + "] on mappingId [" + mapping.getId() + "] to type in location [" + currentParameter.getExpression() + "]"); handleValidationFailure(context, message, currentPathValidator.getOnError()); + "] on mappingId [" + mapping.getId() + "] parameter [" + currentParameter.getExpression() + "] at position [" + currentParameter.getPosition() + "]"); handleValidationFailure(context, message, currentPathValidator.getOnError());
log.trace("Adding action expression '" + urlAction.getAction() + "' to mapping: " + mapping.getId()); mapping.addAction(urlAction); + mapping.getId()); mapping.addQueryParam(queryParam);
String viewId = urlMapping.getViewId(); if (viewId == null) viewId = urlMapping.getViewId(); ExtractedValuesURLBuilder builder = new ExtractedValuesURLBuilder(); result = context.getContextPath() + builder.buildURL(urlMapping).encode() log.debug("ViewId for mapping with id <" + urlMapping.getId() + "> was blank");