小编qui*_*ner的帖子

访问jsrender模板中的全局javascript变量并更新它

我试图用jsrender模板中的值更新全局javascript变量.我怎样才能完成它......

我创造了一个小提琴http://jsfiddle.net/4RH7n/8/

我需要将最后一个电影名称放入该javascript变量中..

javascript jsrender

4
推荐指数
1
解决办法
4275
查看次数

delegatingHandler(webapi)等效于servicestack

我正在尝试从asp.net mvc4 webapi框架迁移到servicestack框架.我在webapi中有一个delegatingHandler,它在servicestack中等同于什么?

这是我将验证我的请求并返回自定义响应而不再进一步的地方.

我的代表处理者

public class xyzDH : DelegatingHandler
{
    protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    {
        int maxLengthAllowed = 200;
        long? contentLen = request.Content.Headers.ContentLength; 
        if (contentLen > maxLengthAllowed)
        {
            var defaultResponse = ResponseHelper.GetBaseResponse("Content Lenght Issue", true, UploadLogSizeIssue);
            return Task<HttpResponseMessage>.Factory.StartNew(() =>
            {
                var response = new HttpResponseMessage(HttpStatusCode.OK)
                    {
                        Content = new StringContent(defaultResponse.ToString(), Encoding.UTF8, "message/http")
                    };
                return response;
            });
        }

        return base.SendAsync(request, cancellationToken);
    }
}
Run Code Online (Sandbox Code Playgroud)

servicestack asp.net-web-api

1
推荐指数
1
解决办法
713
查看次数