/** * @return A non-<code>null</code> but maybe empty map with all contained * {@link IFileItem} objects from file uploads. The key of the map is * the field name. Important: if the value is an array of * {@link IFileItem} it is not considered in the returned map! */ @Nonnull default ICommonsMap <String, IFileItem> getAllUploadedFileItems () { final ICommonsMap <String, IFileItem> ret = new CommonsHashMap <> (); for (final Map.Entry <String, Object> aEntry : entrySet ()) { final Object aAttrValue = aEntry.getValue (); if (aAttrValue instanceof IFileItem) ret.put (aEntry.getKey (), (IFileItem) aAttrValue); } return ret; }
/** * @return A non-<code>null</code> but maybe empty map with all contained * {@link IFileItem} objects from file uploads. The key of the map is * the field name. */ @Nonnull default ICommonsMap <String, IFileItem []> getAllUploadedFileItemsComplete () { final ICommonsMap <String, IFileItem []> ret = new CommonsHashMap <> (); for (final Map.Entry <String, Object> aEntry : entrySet ()) { final String sAttrName = aEntry.getKey (); final Object aAttrValue = aEntry.getValue (); if (aAttrValue instanceof IFileItem) ret.put (sAttrName, new IFileItem [] { (IFileItem) aAttrValue }); else if (aAttrValue instanceof IFileItem []) ret.put (sAttrName, ArrayHelper.getCopy ((IFileItem []) aAttrValue)); } return ret; }
public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception { final SimpleURL aTargetURL = new SimpleURL (m_aTargetURL); // Add all parameters for (final Map.Entry <String, Object> aEntry : aRequestScope.params ().entrySet ()) { final String sKey = aEntry.getKey (); final Object aValue = aEntry.getValue (); if (aValue instanceof String) aTargetURL.add (sKey, (String) aValue); else if (aValue instanceof String []) for (final String sValue : (String []) aValue) aTargetURL.add (sKey, sValue); } aUnifiedResponse.setRedirect (aTargetURL.getAsStringWithEncodedParameters ()); } }