public void LoadRDFData() { Framework.Utilities.DebugLogging.Log("{Page Calling} Profile.ProfileData.LoadRDFData() start " + ((System.Web.UI.TemplateControl)(this)).AppRelativeVirtualPath); XmlDocument xml = new XmlDocument(); Namespace rdfnamespaces = new Namespace(); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); if (HttpContext.Current.Request.Headers["Offset"] != null) { this.RDFTriple.Offset = HttpContext.Current.Request.Headers["Offset"]; } if (HttpContext.Current.Request.Headers["Limit"] != null) { this.RDFTriple.Limit = HttpContext.Current.Request.Headers["Limit"]; } if (HttpContext.Current.Request.Headers["ExpandRDFList"] != null) { this.RDFTriple.ExpandRDFList = HttpContext.Current.Request.Headers["ExpandRDFList"]; } xml = data.GetRDFData(this.RDFTriple); this.RDFData = xml; this.RDFNamespaces = rdfnamespaces.LoadNamespaces(xml); Framework.Utilities.DebugLogging.Log("{Page Calling} Profile.ProfileData.LoadRDFData() end" + ((System.Web.UI.TemplateControl)(this)).AppRelativeVirtualPath); }
public void ProcessRequest(HttpContext context) { // Set up the response settings context.Response.ContentType = "image/jpeg"; context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.BufferOutput = false; if (!string.IsNullOrEmpty(context.Request.QueryString["NodeID"])) { // get the id for the image Int64 nodeid = Convert.ToInt32(context.Request.QueryString["NodeID"]); bool harvarddefault = false; if (context.Request.QueryString["HarvardDefault"] != null) { harvarddefault = true; } Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); Framework.Utilities.RDFTriple request = new Profiles.Framework.Utilities.RDFTriple(nodeid); request.Expand = true; Framework.Utilities.Namespace xmlnamespace = new Profiles.Framework.Utilities.Namespace(); XmlDocument person ; person = data.GetRDFData(request); XmlNamespaceManager namespaces = xmlnamespace.LoadNamespaces(person); if (person.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", namespaces) != null) { //Set up the response settings context.Response.ContentType = "image/jpeg"; context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.BufferOutput = false; Stream stream = data.GetUserPhotoList(nodeid,harvarddefault); const int buffersize = 1024 * 16; byte[] buffer2 = new byte[buffersize]; int count = stream.Read(buffer2, 0, buffersize); while (count > 0) { context.Response.OutputStream.Write(buffer2, 0, count); count = stream.Read(buffer2, 0, buffersize); } } else { context.Response.Write("No Image Found"); } } }
public void ProcessRequest(HttpContext context) { // Set up the response settings context.Response.ContentType = "image/jpeg"; context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.BufferOutput = false; if (!string.IsNullOrEmpty(context.Request.QueryString["NodeID"])) { // get the id for the image Int64 nodeid = Convert.ToInt32(context.Request.QueryString["NodeID"]); bool harvarddefault = false; if (context.Request.QueryString["HarvardDefault"] != null) { harvarddefault = true; } Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); Framework.Utilities.RDFTriple request = new Profiles.Framework.Utilities.RDFTriple(nodeid); request.Expand = true; Framework.Utilities.Namespace xmlnamespace = new Profiles.Framework.Utilities.Namespace(); XmlDocument person; person = data.GetRDFData(request); XmlNamespaceManager namespaces = xmlnamespace.LoadNamespaces(person); if (person.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", namespaces) != null) { //Set up the response settings context.Response.ContentType = "image/jpeg"; context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.BufferOutput = false; Stream stream = data.GetUserPhotoList(nodeid, harvarddefault); const int buffersize = 1024 * 16; byte[] buffer2 = new byte[buffersize]; int count = stream.Read(buffer2, 0, buffersize); while (count > 0) { context.Response.OutputStream.Write(buffer2, 0, count); count = stream.Read(buffer2, 0, buffersize); } } else { context.Response.Write("No Image Found"); } } }
public void LoadPageData() { Framework.Utilities.Namespace namespaces = new Namespace(); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); this.PresentationXML = data.GetPresentationData(this.RDFTriple); XmlNode x = this.PresentationXML.SelectSingleNode("Presentation[1]/ExpandRDFList[1]"); if (x != null) { this.RDFTriple.ExpandRDFList = x.OuterXml; } this.RDFData = data.GetRDFData(this.RDFTriple); this.RDFNamespaces = namespaces.LoadNamespaces(this.RDFData); }
public void ProcessRequest(HttpContext context) { Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); // Set up the response settings context.Response.ContentType = "image/jpeg"; context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.BufferOutput = false; Int64 nodeid = -1; if (!string.IsNullOrEmpty(context.Request.QueryString["NodeID"])) { // get the id for the image nodeid = Convert.ToInt32(context.Request.QueryString["NodeID"]); } if (nodeid > 0) { bool thumbnail = false; int width = 150; int height = 300; if (context.Request.QueryString["Thumbnail"] != null) { thumbnail = true; } if (context.Request.QueryString["Width"] != null) { width = Convert.ToInt32(context.Request.QueryString["Width"]); height = 2 * width; } if (context.Request.QueryString["Height"] != null) { height = Convert.ToInt32(context.Request.QueryString["Height"]); } byte[] image = (byte[])Framework.Utilities.Cache.FetchObject(GetCacheKey(nodeid, width, height)); if (image == null) { // stuff below this and if statement is what makes it slow Framework.Utilities.RDFTriple request = new Profiles.Framework.Utilities.RDFTriple(nodeid); request.Expand = true; request.ShowDetails = true; request.ExpandRDFList = "<ExpandRDF Class=\"http://xmlns.com/foaf/0.1/Person\" Property=\"http://vivoweb.org/ontology/core#authorInAuthorship\" Limit=\"1\" />"; Framework.Utilities.Namespace xmlnamespace = new Profiles.Framework.Utilities.Namespace(); XmlDocument person; person = data.GetRDFData(request); XmlNamespaceManager namespaces = xmlnamespace.LoadNamespaces(person); byte[] rawimage = null; if (person.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", namespaces) != null) { rawimage = data.GetUserPhotoList(nodeid); } else if (thumbnail) { rawimage = silhouetteImage; } if (rawimage != null) { Edit.Utilities.DataIO resize = new Profiles.Edit.Utilities.DataIO(); image = resize.ResizeImageFile(rawimage, width, height); // we are caching silhouettes many times, but that is OK Framework.Utilities.Cache.Set(GetCacheKey(nodeid, width, height), image, nodeid, request.Session.SessionID); } } if (image != null) { Stream stream = new System.IO.MemoryStream(image); // Set up the response settings context.Response.ContentType = "image/jpeg"; context.Response.Cache.SetExpires(DateTime.Now.AddDays(7)); context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetValidUntilExpires(true); context.Response.BufferOutput = false; context.Response.AddHeader("Content-Length", stream.Length.ToString()); const int buffersize = 1024 * 16; byte[] buffer2 = new byte[buffersize]; int count = stream.Read(buffer2, 0, buffersize); while (count > 0) { context.Response.OutputStream.Write(buffer2, 0, count); count = stream.Read(buffer2, 0, buffersize); } } else { context.Response.Write("No Image Found"); } } }
public void LoadRDFData() { Framework.Utilities.DebugLogging.Log("{Page Calling} Profile.ProfileData.LoadRDFData() start " + ((System.Web.UI.TemplateControl)(this)).AppRelativeVirtualPath); XmlDocument xml = new XmlDocument(); Namespace rdfnamespaces = new Namespace(); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); if (HttpContext.Current.Request.Headers["Offset"] != null) this.RDFTriple.Offset = HttpContext.Current.Request.Headers["Offset"]; if (HttpContext.Current.Request.Headers["Limit"] != null) this.RDFTriple.Limit = HttpContext.Current.Request.Headers["Limit"]; if (HttpContext.Current.Request.Headers["ExpandRDFList"] != null) this.RDFTriple.ExpandRDFList = HttpContext.Current.Request.Headers["ExpandRDFList"]; xml = data.GetRDFData(this.RDFTriple); this.RDFData = xml; this.RDFNamespaces = rdfnamespaces.LoadNamespaces(xml); Framework.Utilities.DebugLogging.Log("{Page Calling} Profile.ProfileData.LoadRDFData() end" + ((System.Web.UI.TemplateControl)(this)).AppRelativeVirtualPath); }