Created
          February 15, 2012 14:02 
        
      - 
      
 - 
        
Save rodrigodealer/1835923 to your computer and use it in GitHub Desktop.  
    Json serialization for vraptor
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package br.com.pordotom.util; | |
| import br.com.caelum.vraptor.interceptor.TypeNameExtractor; | |
| import br.com.caelum.vraptor.ioc.Component; | |
| import br.com.caelum.vraptor.serialization.ProxyInitializer; | |
| import br.com.caelum.vraptor.serialization.xstream.XStreamBuilder; | |
| import br.com.caelum.vraptor.serialization.xstream.XStreamJSONSerialization; | |
| import com.thoughtworks.xstream.XStream; | |
| import com.thoughtworks.xstream.converters.basic.DateConverter; | |
| import javax.servlet.http.HttpServletResponse; | |
| @Component | |
| public class CustomJSONSerialization extends XStreamJSONSerialization { | |
| public CustomJSONSerialization(HttpServletResponse response, TypeNameExtractor extractor, ProxyInitializer initializer, XStreamBuilder builder) { | |
| super(response, extractor, initializer, builder); | |
| } | |
| @Override | |
| public XStream getXStream() { | |
| XStream xstream = super.getXStream(); | |
| xstream.registerConverter(new DateConverter("dd/MM/yyyy HH:mm:ss", new String[0])); | |
| return xstream; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment