dd4t / dynamic-delivery-4-tridion Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
If a user requests a URL with double slashes (like http://www.acme.org//my//page.html), the URL should be normalized (into http://www.acme.org/my/page.html) before it is requested from the broker API. This is standard behaviour of most web servers.
Currently, each call to the static property ConfigurationHelper.PublicationID results in a read from the Web.config. This can easily be cached in a private variable like this:
public static int PublicationId
{
get
{
if (_publicationId > 0)
{
return _publicationId;
}
_publicationId = SafeGetConfigSettingAsInt(ConfigurationKeys.PublicationId);
return _publicationId;
}
}
Even if "Target Group" is applied to a component presentation, cannot get it in DD4T Java version.
"Target Group" condition is not de-serialized to Java object.
Detail is in following StackExchange post.
http://tridion.stackexchange.com/questions/14242/how-to-do-personalization-on-dd4t-java-2-0
All factories have an instance property for the associated provider, like this:
private IPageProvider _pageProvider = null;
This should be a static property so that it is loaded only once:
private static IPageProvider _pageProvider = null;
I am having an issue where the tridion base controller does not redirect to the child or action code.
The DD4T providers use the Tridion CD factories to get data (pages, components, binaries, etc). This is done in many different, inconsistent ways:
The Tridion CD factories are all marked as IDisposable, but DD4T doesn't call Dispose on them (or wrap them in a using block).
Moreover, the items which are returned by these factories are also disposables, yet DD4T never makes use of this. All of this causes excessive memory consumption.
I propose the following changes:
CD Factories are static properties, backed up by a private static variable like so:
private static BinaryFactory _binaryFactory = null;
private static readonly lockBinaryFactory = new Object();
private static BinaryFactory BinaryFactory
{
get
{
if (_binaryFactory == null)
{
lock (lockBinaryFactory)
{
if (_binaryFactory == null)
{
_binaryFactory = new BinaryFactory();
}
}
}
return _binaryFactory;
}
}
CD Factories which need a publication ID as constructor argument, must be cached in a static Dictionary with a GetXXFactory(string publicationID) method (leaving out the locking bit for brevity):
private static Dictionary<int,ComponentMetaFactory > _tridionComponentMetaFactories = new Dictionary<int,ComponentMetaFactory>();
private static readonly lockComponentMetaFactory = new Object();
private static ComponentMetaFactory GetTridionComponentMetaFactory(int publicationId)
{
if (_tridionComponentMetaFactories.ContainsKey(publicationId))
{
return _tridionComponentMetaFactories[publicationId];
}
lock (lockComponentMetaFactory)
{
if (!_tridionComponentMetaFactories.ContainsKey(publicationId)) // we must test again, because in the mean time another thread might have added a record to the dictionary!
{
_tridionComponentMetaFactories.Add(publicationId, new ComponentMetaFactory(publicationId));
}
}
return _tridionComponentMetaFactories[publicationId];
}
Add a using block when the factories are used to retrieve an item:
using (var binaryData = BinaryFactory.GetBinary("tcm:2-123"))
{
// do something with binaryData
}
The DD4T providers themselves implement IDisposable, and clean up all factories in the Dispose method as follows:
protected virtual void Dispose(bool isDisposed)
{
if (_binaryFactory != null)
{
_binaryFactory.Dispose();
_binaryFactory = null;
}
if (_tridionComponentMetaFactories != null)
{
foreach (var factory in _tridionComponentMetaFactories.Values)
{
if (factory != null)
{
factory.Dispose();
}
}
_tridionComponentMetaFactories.Clear();
_tridionComponentMetaFactories = null;
}
}
For example, the PageFactory.TryFindPage method contains this snippet:
PageProvider.GetLastPublishedDateByUrl(url);
This can easily be replaced by:
PageProvider.GetLastPublishedDateByUri(page.Id)
This will be faster. Also check other factories!
With Arabic set as browser/system language, ExtendedQueryParameters.ToTridionQuery() method fails with the following trace:
2015-09-23 15:12:05,179 [118] ERROR Core.Helpers.HtmlHelperExtensions - HtmlHelperExtensions
System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'. ---> System.ArgumentOutOfRangeException: Specified time is not supported in this calendar. It should be between 04/30/1900 00:00:00 (Gregorian date) and 11/16/2077 23:59:59 (Gregorian date), inclusive.
Parameter name: time
at System.Globalization.UmAlQuraCalendar.CheckTicksRange(Int64 ticks)
at System.Globalization.UmAlQuraCalendar.GetDatePart(DateTime time, Int32 part)
at System.DateTimeFormat.FormatCustomized(DateTime dateTime, String format, DateTimeFormatInfo dtfi, TimeSpan offset)
at System.DateTimeFormat.Format(DateTime dateTime, String format, DateTimeFormatInfo dtfi, TimeSpan offset)
at DD4T.Providers.SDLTridion2011sp1.ExtendedQueryParameters.ToTridionQuery()
at DD4T.Providers.SDLTridion2011sp1.TridionComponentProvider.FindComponents(IQuery query)
...
Pull Request:
#27
When requesting the multimedia.AltText it always returns null. When looking in the ComponentBuilder.cs it is not filled. My assumption was that we could create our own multimedia schema and add an "AltText" field that would be filled automaticly. Can someone tell me what the use of this field is, and if this assumption is correct ? If so the following change is suggested;
ComponentBuilder.cs
Line_43: multimedia.AltText = tcmComponent.Content["AltText"].Value;
Add helper class to write out labels from the views
Currently the content type is always XML, even if the format is JSON. We need this line in the BasePageTemplate as well as BaseComponentTemplate:
package.PushItem(Package.OutputName, package.CreateStringItem(SerializerService is XmlSerializerService ? ContentType.Xml : ContentType.Text, outputValue));
Currently this method does not work if your CTs are mapped to views through their title.
Currently, if the property BinaryProvider.LoadBinariesAsStream is set to true (it defaults to false), the provider connects to the broker database directly. This goes against one of our principle to always use the Tridion API.
I suggest to mark this property as obsolete in 2.0 so we can remove it some time later. Is anyone using this feature (to load binaries as a stream rather than an array of bytes) at all?
The linkfactory must be enabled to resolve page links, by implementing the following method:
public string ResolvePageLink(string tcmUri)
Note that the results must be cached just like component links.
Here on sdl.com implementation we use DD4T 1.31. Recently we've discovered a small bug related to rich text field formatting.
To reproduce it you should just do the following:
As final result we see lost whitespaces between bold, italic, underline words. After a few debugging hours I've found that issue is in TridionXml helper and particularly in LoadXml method. There should be PreserveWhitespace=true assignement before base.LoadXml()
More info: Anatolii Lysenko ([email protected])
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.