Package org.salamandra.web.core.request

Examples of org.salamandra.web.core.request.BeanEntityRequest


  }
 
  @Override
  public void execute(HttpServletRequest request, HttpServletResponse response) throws TransformerException {

    BeanEntityRequest beanParseRequest = new BeanEntityRequest(request);
   
    if (beanParseRequest.getBeanref() == null)
      throw new TransformerException("Bean not found.");
   
    Object bean = factory.getBean(beanParseRequest.getBeanref());

    List<ISetProperty> lst = new ArrayList<ISetProperty>();

      Iterator<Map.Entry<String,String>> iter = beanParseRequest.getParameterIterator();
    while (iter.hasNext()) {
      final Map.Entry<String,String> element = (Map.Entry<String,String>) iter.next();

      lst.add(new ISetProperty() {
        public String getProperty() {
          return element.getKey();
        }
        public String getValue() {
          return element.getValue();
        }
      });
    }
   
    try {
      PrintWriter out = response.getWriter();

      Result result = new StreamResult(out);

      XmlBindingFactory xbf = new XmlBindingFactory(lst);
      xbf.setSAXTransformer(this);
     
      AbstractXmlBinding<?> axb = xbf.create(beanParseRequest.getProtocol(), bean);
      axb.transform(result);
    } catch (Exception e) {
      throw new TransformerException(e);
    };
  }
View Full Code Here

TOP

Related Classes of org.salamandra.web.core.request.BeanEntityRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.