src/main/java/org/eiichiro/bootleg/xml/XMLResponse.java
public void to(WebContext context) {
		if (entity == null) {
			return;
		}
		
		HttpServletResponse response = context.response();
		
		try {
			response.setCharacterEncoding("UTF-8");
			response.setHeader("Content-Type", mediaType);
			
			if (status > 0) {
				response.setStatus(status);
			}
			
			if (entity instanceof String) {
				response.getWriter().write((String) entity);
				return;
			}
			
			Marshaller marshaller = JAXBContext.newInstance(entity.getClass()).createMarshaller();
			marshaller.setAdapter(new ValueTypeXmlAdapter<Object>());
			marshaller.marshal(entity, response.getWriter());
		} catch (Exception e) {
			throw new UncheckedException(e);
		}
	}
public void to(WebContext context) {
		if (entity == null) {
			return;
		}
		
		HttpServletResponse response = context.response();
		
		try {
			response.setCharacterEncoding("UTF-8");
			response.setHeader("Content-Type", mediaType);
			
			if (status > 0) {
				response.setStatus(status);
			}
			
			if (entity instanceof String) {
				response.getWriter().write((String) entity);
				return;
			}
			
			Marshaller marshaller = JAXBContext.newInstance(entity.getClass()).createMarshaller();
			marshaller.setAdapter(new ValueTypeXmlAdapter<Object>());
			marshaller.marshal(entity, response.getWriter());
		} catch (Exception e) {
			throw new UncheckedException(e);
		}
	}
public void to ( WebContext context ) { if ( entity == null ) { return ; } HttpServletResponse response = context . response ( ) ; try { response . setCharacterEncoding ( "UTF-8" ) ; response . setHeader ( "Content-Type" , mediaType ) ; if ( status > 0 ) { response . setStatus ( status ) ; } if ( entity instanceof String ) { response . getWriter ( ) . write ( ( String ) entity ) ; return ; } Marshaller marshaller = JAXBContext . newInstance ( entity . getClass ( ) ) . createMarshaller ( ) ; marshaller . setAdapter ( new ValueTypeXmlAdapter < Object > ( ) ) ; marshaller . marshal ( entity , response . getWriter ( ) ) ; } catch ( Exception e ) { throw new UncheckedException ( e ) ; } }
Writes {@code XMLResponse} to the current {@code WebContext}.

@param context The current {@code WebContext}.
Writes { @code XMLResponse } to the current { @code WebContext } .