private Representation HandleIterable(System.Collections.IEnumerable data) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<Representation> results = new java.util.ArrayList<>(); IList <Representation> results = new List <Representation>(); foreach (Object value in data) { Representation rep = GetRepresentation(value); results.Add(rep); } RepresentationType representationType = GetType(results); return(new ListRepresentation(representationType, results)); }
public static object Serialize(Representation repr) { if (repr is ValueRepresentation) { return(Serialize(( ValueRepresentation )repr)); } else if (repr is MappingRepresentation) { return(Serialize(( MappingRepresentation )repr)); } else if (repr is ListRepresentation) { return(Serialize(( ListRepresentation )repr)); } else { throw new System.ArgumentException(repr.GetType().ToString()); } }
public Response Response(Response.StatusType status, Representation representation) { return(Response(Response.status(status), representation)); }
public virtual string Assemble(Representation representation) { return(representation.Serialize(_format, _baseUri, _extensions)); }
public static void Write(Representation representation, RepresentationFormat format, URI baseUri) { representation.Serialize(format, baseUri, null); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private javax.ws.rs.core.Response.ResponseBuilder formatRepresentation(javax.ws.rs.core.Response.ResponseBuilder response, final Representation representation) private Response.ResponseBuilder FormatRepresentation(Response.ResponseBuilder response, Representation representation) { _representationWriteHandler.onRepresentationStartWriting(); bool mustFail = representation is ExceptionRepresentation; if (_format is StreamingFormat) { return(response.entity(Stream(representation, ( StreamingFormat )_format, mustFail))); } else { return(response.entity(ToBytes(Assemble(representation), mustFail))); } }
protected internal virtual Response Response(Response.ResponseBuilder response, Representation representation) { return(FormatRepresentation(response, representation).type(HttpHeaderUtils.mediaTypeWithCharsetUtf8(MediaType)).build()); }