/** * Injects request attributes. */ protected void injectAttributes(final HttpServletRequest servletRequest, final Targets targets) { final Enumeration<String> attributeNames = servletRequest.getAttributeNames(); while (attributeNames.hasMoreElements()) { final String attrName = attributeNames.nextElement(); targets.forEachTargetAndIn(this, (target, in) -> { final String name = in.matchedName(attrName); if (name != null) { final Object attrValue = servletRequest.getAttribute(attrName); target.writeValue(name, attrValue, true); } }); } }
@Override public void inject(final ServletContext servletContext, final Targets targets) { instancesInjector.inject(servletContext, targets); final Enumeration<String> attributeNames = servletContext.getAttributeNames(); while (attributeNames.hasMoreElements()) { final String attrName = attributeNames.nextElement(); targets.forEachTargetAndIn(this, (target, in) -> { final String name = in.matchedName(attrName); if (name != null) { final Object attrValue = servletContext.getAttribute(attrName); target.writeValue(name, attrValue, true); } }); } }
@Override public void inject(final ActionRequest actionRequest, final Targets targets) { final HttpServletRequest servletRequest = actionRequest.getHttpServletRequest(); final HttpSession session = servletRequest.getSession(); final Enumeration<String> attributeNames = session.getAttributeNames(); while (attributeNames.hasMoreElements()) { final String attrName = attributeNames.nextElement(); targets.forEachTargetAndIn(this, (target, in) -> { final String name = in.matchedName(attrName); if (name != null) { final Object attrValue = session.getAttribute(attrName); target.writeValue(name, attrValue, true); } }); } }
final String name = in.matchedName(paramName); if (name != null) { String[] paramValues = servletRequest.getParameterValues(paramName);
final String name = in.matchedName(paramName); if (name != null) { final FileUpload[] paramValues = multipartRequest.getFiles(paramName);
private void injectMacros(final String actionPath, final PathMacros pathMacros, final Targets targets) { final String[] names = pathMacros.names(); final String[] values = pathMacros.extract(actionPath); for (int ndx = 0; ndx < values.length; ndx++) { final String value = values[ndx]; if (StringUtil.isEmpty(value)) { continue; } final String macroName = names[ndx]; targets.forEachTargetAndIn(madvocScope, (target, in) -> { final String name = in.matchedName(macroName); if (name != null) { target.writeValue(name, value, true); } }); } }