SharpPagesFeature
Assembly: ServiceStack.dll
View Source
public class SharpPagesFeature : ScriptContext, IDisposable, IPlugin, IViewEngine, IHasStringId, IHasId<string>
Properties
Id
View Source
public string Id { get; set; }
EnableHotReload
View Source
public bool? EnableHotReload { get; set; }
EnableSpaFallback
View Source
public bool? EnableSpaFallback { get; set; }
DisablePageBasedRouting
View Source
public bool DisablePageBasedRouting { get; set; }
DebugDefaultTemplate
View Source
public string DebugDefaultTemplate { get; set; }
ApiPath
View Source
public string ApiPath { get; set; }
ApiDefaultContentType
View Source
public string ApiDefaultContentType { get; set; }
ScriptAdminRole
Role Required to call Templates Admin Service (/script/admin), Default is Admin. If null Templates Admin Service will not be registered.
View Source
public string ScriptAdminRole { get; set; }
MetadataDebugAdminRole
Role Required to call Metadata Debug Service (/metadata/debug). If null Metadata Debug Service will only be registered in DebugMode.
View Source
public string MetadataDebugAdminRole { get; set; }
IgnorePaths
View Source
public List<string> IgnorePaths { get; set; }
ServiceStackScripts
View Source
public ServiceStackScripts ServiceStackScripts { get; }
HtmlExtension
View Source
public string HtmlExtension { get; set; }
ExcludeProtectedFilters
View Source
public bool ExcludeProtectedFilters { set; }
ImportRequestParams
Whether to auto populate scoped args with Request.FormData[] and Request.QueryString[] params (default false).
Recommendation is to instead use form.name
or query.name
(or qs.name
) to explicitly reference user input values.
View Source
public bool ImportRequestParams { get; set; }
Inherited Properties
AllowScriptingOfAllTypes
Allow scripting of all Types in loaded Assemblies
View Source
public bool AllowScriptingOfAllTypes { get; set; }
AppSettings
View Source
public IAppSettings AppSettings { get; set; }
Args
View Source
public Dictionary<string, object> Args { get; }
AssignExceptionsTo
What argument to assign Exceptions to
View Source
public string AssignExceptionsTo { get; set; }
AssignExpressionCache
View Source
public ConcurrentDictionary<string, Action<ScriptScopeContext, object, object>> AssignExpressionCache { get; }
Cache
View Source
public ConcurrentDictionary<string, object> Cache { get; }
CacheFiles
Where to store cached files, if unspecified falls back to configured VirtualFiles if it implements IVirtualFiles (i.e. writable)
View Source
public IVirtualFiles CacheFiles { get; set; }
CacheMemory
View Source
public ConcurrentDictionary<ReadOnlyMemory<char>, object> CacheMemory { get; }
CheckForModifiedPages
Whether to check for modified pages by default when not in DebugMode
View Source
public bool CheckForModifiedPages { get; set; }
CheckForModifiedPagesAfter
How long in between checking for modified pages
View Source
public TimeSpan? CheckForModifiedPagesAfter { get; set; }
CodePageInvokers
View Source
public ConcurrentDictionary<Type, Tuple<MethodInfo, MethodInvoker>> CodePageInvokers { get; }
CodePages
View Source
public Dictionary<string, Type> CodePages { get; }
Container
View Source
public IContainer Container { get; set; }
DebugMode
View Source
public bool DebugMode { get; set; }
DefaultLayoutPage
View Source
public string DefaultLayoutPage { get; set; }
DefaultMethods
View Source
public DefaultScripts DefaultMethods { get; }
DefaultScriptLanguage
View Source
public ScriptLanguage DefaultScriptLanguage { get; set; }
EmptyFile
View Source
public InMemoryVirtualFile EmptyFile { get; }
EmptyPage
View Source
public SharpPage EmptyPage { get; }
ExcludeFiltersNamed
View Source
public HashSet<string> ExcludeFiltersNamed { get; }
ExpiringCache
View Source
public ConcurrentDictionary<string, Tuple<DateTime, object>> ExpiringCache { get; }
FileFilterNames
View Source
public HashSet<string> FileFilterNames { get; }
FilterTransformers
Available transformers that can transform context filter stream outputs
View Source
public Dictionary<string, Func<Stream, Task<Stream>>> FilterTransformers { get; set; }
HasInit
View Source
public bool HasInit { get; }
HtmlMethods
View Source
public HtmlScripts HtmlMethods { get; }
IndexPage
View Source
public string IndexPage { get; set; }
InsertPlugins
Insert plugins at the start of Plugins so they're registered first
View Source
public List<IScriptPlugin> InsertPlugins { get; }
InsertScriptBlocks
Insert additional Blocks at the start so they have priority over default Script Blocks
View Source
public List<ScriptBlock> InsertScriptBlocks { get; }
InsertScriptMethods
Insert additional Methods at the start so they have priority over default Script Methods
View Source
public List<ScriptMethods> InsertScriptMethods { get; }
InvalidateCachesBefore
Existing caches and pages created prior to specified date should be invalidated
View Source
public DateTime? InvalidateCachesBefore { get; set; }
JsTokenCache
View Source
public ConcurrentDictionary<ReadOnlyMemory<char>, JsToken> JsTokenCache { get; }
Log
View Source
public ILog Log { get; }
MaxEvaluations
Limit Max number for micro ops like evaluating an AST instruction (default 1M)
View Source
public long MaxEvaluations { get; set; }
MaxQuota
Limit Max Iterations for Heavy Operations like rendering a Script Block (default 10K)
View Source
public int MaxQuota { get; set; }
MaxStackDepth
Limit Recursion Max StackDepth (default 25)
View Source
public int MaxStackDepth { get; set; }
OnAfterPlugins
View Source
public Action<ScriptContext> OnAfterPlugins { get; set; }
OnlyEvaluateFiltersWhenSkippingPageFilterExecution
View Source
public HashSet<string> OnlyEvaluateFiltersWhenSkippingPageFilterExecution { get; set; }
OnRenderException
View Source
public Action<PageResult, Exception> OnRenderException { get; set; }
OnUnhandledExpression
View Source
public Func<PageVariableFragment, ReadOnlyMemory<byte>> OnUnhandledExpression { get; set; }
PageFormats
View Source
public List<PageFormat> PageFormats { get; set; }
Pages
View Source
public ISharpPages Pages { get; set; }
ParseAsLanguage
View Source
public Dictionary<string, ScriptLanguage> ParseAsLanguage { get; set; }
PathMappings
View Source
public ConcurrentDictionary<string, string> PathMappings { get; }
Plugins
View Source
public List<IScriptPlugin> Plugins { get; }
Preprocessors
View Source
public List<Func<string, string>> Preprocessors { get; }
ProtectedMethods
View Source
public ProtectedScripts ProtectedMethods { get; }
RemoveNewLineAfterFiltersNamed
View Source
public HashSet<string> RemoveNewLineAfterFiltersNamed { get; set; }
RenderExpressionExceptions
Render render filter exceptions in-line where filter is located
View Source
public bool RenderExpressionExceptions { get; set; }
ScanAssemblies
Scan Assemblies and auto-register any Script Methods, Blocks and Code Pages
View Source
public List<Assembly> ScanAssemblies { get; set; }
ScanTypes
Scan Types and auto-register any Script Methods, Blocks and Code Pages
View Source
public List<Type> ScanTypes { get; set; }
ScriptAssemblies
Allow scripting of Types from specified Assemblies
View Source
public List<Assembly> ScriptAssemblies { get; set; }
ScriptBlocks
View Source
public List<ScriptBlock> ScriptBlocks { get; }
ScriptLanguages
View Source
public List<ScriptLanguage> ScriptLanguages { get; }
ScriptMethods
View Source
public List<ScriptMethods> ScriptMethods { get; }
ScriptNamespaces
Lookup Namespaces for resolving Types in Scripts
View Source
public List<string> ScriptNamespaces { get; set; }
ScriptTypeNameMap
Register short Type name accessible from scripts. (Advanced, use ScriptAssemblies/ScriptTypes first)
View Source
public Dictionary<string, Type> ScriptTypeNameMap { get; }
ScriptTypeQualifiedNameMap
Register long qualified Type name accessible from scripts. (Advanced, use ScriptAssemblies/ScriptTypes first)
View Source
public Dictionary<string, Type> ScriptTypeQualifiedNameMap { get; }
ScriptTypes
Allow scripting of the specified Types
View Source
public List<Type> ScriptTypes { get; set; }
SkipExecutingFiltersIfError
Whether to skip executing expressions if an Exception was thrown
View Source
public bool SkipExecutingFiltersIfError { get; set; }
VirtualFiles
View Source
public IVirtualPathProvider VirtualFiles { get; set; }
Methods
Register(IAppHost)
View Source
public virtual void Register(IAppHost appHost)
Parameters
Type | Name |
---|---|
ServiceStack.IAppHost | appHost |
RunInitPage()
View Source
public string RunInitPage()
Returns
System.String
RequestHandler(String, String, String)
View Source
protected virtual IHttpHandler RequestHandler(string httpMethod, string pathInfo, string filePath)
Returns
System.Web.IHttpHandler
Parameters
Type | Name |
---|---|
System.String | httpMethod |
System.String | pathInfo |
System.String | filePath |
PageBasedRoutingHandler(String, String, String)
View Source
protected virtual IHttpHandler PageBasedRoutingHandler(string httpMethod, string pathInfo, string requestFilePath)
Returns
System.Web.IHttpHandler
Parameters
Type | Name |
---|---|
System.String | httpMethod |
System.String | pathInfo |
System.String | requestFilePath |
GetRoutingPage(String, out Dictionary<String, Object>)
Resolve Page-based Routing page from /path/info
View Source
public SharpPage GetRoutingPage(string pathInfo, out Dictionary<string, object> routingArgs)
Returns
Parameters
Type | Name |
---|---|
System.String | pathInfo |
System.Collections.Generic.Dictionary<System.String,System.Object> | routingArgs |
GetViewPage(String)
View Source
public SharpPage GetViewPage(string viewName)
Returns
Parameters
Type | Name |
---|---|
System.String | viewName |
HasView(String, IRequest)
View Source
public bool HasView(string viewName, IRequest httpReq = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | viewName |
ServiceStack.Web.IRequest | httpReq |
RenderPartial(String, Object, Boolean, StreamWriter, IHtmlContext)
View Source
public string RenderPartial(string pageName, object model, bool renderHtml, StreamWriter writer = null, IHtmlContext htmlHelper = null)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | pageName |
System.Object | model |
System.Boolean | renderHtml |
System.IO.StreamWriter | writer |
ServiceStack.Html.IHtmlContext | htmlHelper |
ProcessRequestAsync(IRequest, Object, Stream)
View Source
public async Task<bool> ProcessRequestAsync(IRequest req, object dto, Stream outputStream)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Object | dto |
System.IO.Stream | outputStream |
Inherited Methods
AssertProtectedMethods()
View Source
public ProtectedScripts AssertProtectedMethods()
Returns
ServiceStack.Script.ProtectedScripts
Dispose()
View Source
public void Dispose()
GetAssignExpression(Type, ReadOnlyMemory<Char>)
View Source
public Action<ScriptScopeContext, object, object> GetAssignExpression(Type targetType, ReadOnlyMemory<char> expression)
Returns
System.Action<ServiceStack.Script.ScriptScopeContext,System.Object,System.Object>
Parameters
Type | Name |
---|---|
System.Type | targetType |
ReadOnlyMemory<System.Char> | expression |
GetBlock(String)
View Source
public ScriptBlock GetBlock(string name)
Returns
ServiceStack.Script.ScriptBlock
Parameters
Type | Name |
---|---|
System.String | name |
GetCodePage(String)
View Source
public SharpCodePage GetCodePage(string virtualPath)
Returns
ServiceStack.Script.SharpCodePage
Parameters
Type | Name |
---|---|
System.String | virtualPath |
GetFormat(String)
View Source
public PageFormat GetFormat(string extension)
Returns
ServiceStack.Script.PageFormat
Parameters
Type | Name |
---|---|
System.String | extension |
GetPage(String)
View Source
public SharpPage GetPage(string virtualPath)
Returns
Parameters
Type | Name |
---|---|
System.String | virtualPath |
GetPage(String, String, out SharpPage, out SharpCodePage)
View Source
public void GetPage(string fromVirtualPath, string virtualPath, out SharpPage page, out SharpCodePage codePage)
Parameters
Type | Name |
---|---|
System.String | fromVirtualPath |
System.String | virtualPath |
ServiceStack.Script.SharpPage | page |
ServiceStack.Script.SharpCodePage | codePage |
GetPathMapping(String, String)
View Source
public string GetPathMapping(string prefix, string key)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | prefix |
System.String | key |
GetScriptLanguage(String)
View Source
public ScriptLanguage GetScriptLanguage(string name)
Returns
ServiceStack.Script.ScriptLanguage
Parameters
Type | Name |
---|---|
System.String | name |
Init()
View Source
public ScriptContext Init()
Returns
ServiceStack.Script.ScriptContext
OneTimePage(String, String)
View Source
public SharpPage OneTimePage(string contents, string ext = null)
Returns
Parameters
Type | Name |
---|---|
System.String | contents |
System.String | ext |
RemoveBlocks(Predicate<ScriptBlock>)
View Source
public ScriptContext RemoveBlocks(Predicate<ScriptBlock> match)
Returns
ServiceStack.Script.ScriptContext
Parameters
Type | Name |
---|---|
System.Predicate<ServiceStack.Script.ScriptBlock> | match |
RemoveFilters(Predicate<ScriptMethods>)
View Source
public ScriptContext RemoveFilters(Predicate<ScriptMethods> match)
Returns
ServiceStack.Script.ScriptContext
Parameters
Type | Name |
---|---|
System.Predicate<ServiceStack.Script.ScriptMethods> | match |
RemovePathMapping(String, String)
View Source
public void RemovePathMapping(string prefix, string mapPath)
Parameters
Type | Name |
---|---|
System.String | prefix |
System.String | mapPath |
RemovePlugins(Predicate<IScriptPlugin>)
View Source
public ScriptContext RemovePlugins(Predicate<IScriptPlugin> match)
Returns
ServiceStack.Script.ScriptContext
Parameters
Type | Name |
---|---|
System.Predicate<ServiceStack.Script.IScriptPlugin> | match |
ScanType(Type)
View Source
public ScriptContext ScanType(Type type)
Returns
ServiceStack.Script.ScriptContext
Parameters
Type | Name |
---|---|
System.Type | type |
SetPathMapping(String, String, String)
View Source
public string SetPathMapping(string prefix, string mapPath, string toPath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | prefix |
System.String | mapPath |
System.String | toPath |
TryGetPage(String, String, out SharpPage, out SharpCodePage)
View Source
public bool TryGetPage(string fromVirtualPath, string virtualPath, out SharpPage page, out SharpCodePage codePage)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | fromVirtualPath |
System.String | virtualPath |
ServiceStack.Script.SharpPage | page |
ServiceStack.Script.SharpCodePage | codePage |