use of org.springframework.web.bind.annotation.ModelAttribute in project x-pipe by ctripcorp.
the class AbstractDispatcherMetaServerController method populateModel.
@ModelAttribute
public void populateModel(@PathVariable final String clusterId, @RequestHeader(name = MetaServerService.HTTP_HEADER_FOWRARD, required = false) ForwardInfo forwardInfo, Model model, HttpServletRequest request) {
if (forwardInfo != null) {
logger.info("[populateModel]{},{}", clusterId, forwardInfo);
}
MetaServer metaServer = getMetaServer(clusterId, forwardInfo, request.getRequestURI());
if (metaServer == null) {
throw new UnfoundAliveSererException(clusterId, slotManager.getServerIdByKey(clusterId), currentMetaServer.getServerId());
}
model.addAttribute(MODEL_META_SERVER, metaServer);
if (forwardInfo != null) {
model.addAttribute(forwardInfo);
}
}
use of org.springframework.web.bind.annotation.ModelAttribute in project com.revolsys.open by revolsys.
the class WebAnnotationMethodHandlerAdapter method addReturnValueAsModelAttribute.
protected final void addReturnValueAsModelAttribute(final Method handlerMethod, final Class<?> handlerType, final Object returnValue, final ExtendedModelMap implicitModel) {
final ModelAttribute attr = AnnotationUtils.findAnnotation(handlerMethod, ModelAttribute.class);
String attrName = attr != null ? attr.value() : "";
if ("".equals(attrName)) {
final Class<?> resolvedType = GenericTypeResolver.resolveReturnType(handlerMethod, handlerType);
attrName = Conventions.getVariableNameForReturnType(handlerMethod, resolvedType, returnValue);
}
implicitModel.addAttribute(attrName, returnValue);
}
use of org.springframework.web.bind.annotation.ModelAttribute in project SimpleContentPortlet by Jasig.
the class ConfigureContentController method getForm.
/**
* Get the form object for the portlet configuration. If this portlet has
* already been configured with content, the current HTML will be
* pre-populated into the form object. If this is a new portlet, the
* initial content will be an empty string.
*
* @param request PortletRequest
* @return form object for the portlet configuration
*/
@ModelAttribute("form")
public ContentForm getForm(PortletRequest request) {
// TODO: Get the locale specified in the drop-down list
String content = this.contentDao.getContent(request, null);
ContentForm form = new ContentForm();
form.setContent(content);
return form;
}
use of org.springframework.web.bind.annotation.ModelAttribute in project tesb-rt-se by Talend.
the class AppController method createRequestParameters.
@ModelAttribute("inputData")
public SearchRequestParameters createRequestParameters() {
SimpleDateFormat sdf = new SimpleDateFormat(DateFormatValidator.DEFAULT_FORMAT);
SearchRequestParameters params = new SearchRequestParameters();
params.setCustomerName("aebert");
params.setPickupDate(sdf.format(new Date()));
params.setReturnDate(sdf.format(new Date(System.currentTimeMillis() + ADAY)));
return params;
}
use of org.springframework.web.bind.annotation.ModelAttribute in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneController method initPhoneNameForm.
/**
* Called before each and every request comes into the controller, and is placed on the request for use by those methods.
*
* @param request
* @param model
*
* @return
*/
@ModelAttribute("phoneNameForm")
public PhoneNameForm initPhoneNameForm(HttpServletRequest request, Model model) {
PhoneNameForm form = new PhoneNameForm();
form.setPhone((Phone) entityConfiguration.createEntityInstance("org.broadleafcommerce.profile.core.domain.Phone"));
return form;
}
Aggregations