Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
408 ashish 1
package in.shop2020.serving.controllers.handler;
2
 
3
import java.io.Reader;
4
import java.io.Writer;
5
 
6
import org.apache.struts2.rest.handler.ContentTypeHandler;
7
import com.thoughtworks.xstream.*;
8
import java.io.*;
9
 
10
public class SxstreamContentHandler implements ContentTypeHandler {
11
 
12
	@Override
13
	public String fromObject(Object obj, String resultCode, Writer stream)
14
			throws IOException {
15
		if (obj != null) {
16
	         XStream x = new XStream();
17
	         //x.processAnnotations(obj.getClass());
18
	         x.toXML(obj, stream);
19
	      }
20
 
21
 
22
		return null;
23
	}
24
 
25
	@Override
26
	public String getContentType() {
27
		// TODO Auto-generated method stub
28
		return "text/xml";
29
	}
30
 
31
	@Override
32
	public String getExtension() {
33
		// TODO Auto-generated method stub
34
		return "xml";
35
 
36
	}
37
 
38
	@Override
39
	public void toObject(Reader in, Object target) throws IOException {
40
		// TODO Auto-generated method stub
41
		XStream x = new XStream();
42
 
43
	      //x.processAnnotations(target.getClass());
44
	      x.fromXML(in, target);
45
 
46
 
47
	}
48
 
49
}