1 16 17 package org.springframework.web.portlet.bind; 18 19 import javax.portlet.PortletRequest; 20 21 import org.springframework.beans.MutablePropertyValues; 22 import org.springframework.validation.BindException; 23 import org.springframework.web.bind.WebDataBinder; 24 import org.springframework.web.portlet.multipart.MultipartActionRequest; 25 26 65 public class PortletRequestDataBinder extends WebDataBinder { 66 67 72 public PortletRequestDataBinder(Object target) { 73 super(target); 74 } 75 76 81 public PortletRequestDataBinder(Object target, String objectName) { 82 super(target, objectName); 83 } 84 85 86 104 public void bind(PortletRequest request) { 105 MutablePropertyValues mpvs = new PortletRequestParameterPropertyValues(request); 106 if (request instanceof MultipartActionRequest) { 107 MultipartActionRequest multipartRequest = (MultipartActionRequest) request; 108 bindMultipartFiles(multipartRequest.getFileMap(), mpvs); 109 } 110 doBind(mpvs); 111 } 112 113 119 public void closeNoCatch() throws PortletRequestBindingException { 120 if (getBindingResult().hasErrors()) { 121 throw new PortletRequestBindingException( 122 "Errors binding onto object '" + getBindingResult().getObjectName() + "'", 123 new BindException(getBindingResult())); 124 } 125 } 126 127 } 128 | Popular Tags |