private ProctorContext getProctorContext ( final HttpServletRequest request ) throws IllegalAccessException , InstantiationException { final ProctorContext proctorContext = contextClass . newInstance ( ) ; final BeanWrapper beanWrapper = new BeanWrapperImpl ( proctorContext ) ; for ( final PropertyDescriptor descriptor : beanWrapper . getPropertyDescriptors ( ) ) { final String propertyName = descriptor . getName ( ) ; if ( ! "class" . equals ( propertyName ) ) { // ignore class property which every object has final String parameterValue = request . getParameter ( propertyName ) ; if ( parameterValue != null ) { beanWrapper . setPropertyValue ( propertyName , parameterValue ) ; } } } return proctorContext ; }
Do some magic to turn request parameters into a context object