Render a response
517393
def _render_response(self, value, system):
        
        view = system['view']
        enc_class = getattr(view, '_json_encoder', None)
        if enc_class is None:
            enc_class = get_json_encoder()
        return json.dumps(value, cls=enc_class)
785984
def render_table_to_response(*args, **kwargs):
    
    response = render_table(*args, **kwargs)
    if isinstance(response, HttpResponse):  # pragma: no cover
        return response
    return HttpResponse(response)
688833
def render(self, name=None, template=None, context={}):
        ''''

        '''

        if isinstance(template, Template):
            _template = template
        else:
            _template = Template.objects.get(name=name)

        # Maybe cache or save local ?
        response = self.env.from_string(
            _template.content).render(context)

        return response
1230396
function Request__render(response) {

        if (this.isRendered) {
            return false;
        }



        if (Type.isString(response)) {
            this._checkContentType('text/html');
            this.response.writeHead(this.statusCode, this.headers);

            this.addHeader('Content-Length', response.length);
            this.response.end(response);
            this.isRendered = true;
            logger.info('Request.render:', {
                url: this.url,
                status: this.statusCode,
                id: this.id,
                isRendered: this.isRendered,
                content_type: this.getHeader('content-type')
            });
            return true;
        } else if (response instanceof Buffer) {
            this._checkContentType('text/html');
            this.response.writeHead(this.statusCode, this.headers);
            this.addHeader('Content-Length', response.length);
            this.response.end(response);
            this.isRendered = true;
            logger.info('Request.render:', {
                url: this.url,
                status: this.statusCode,
                id: this.id,
                isRendered: this.isRendered,
                content_type: this.getHeader('content-type')
            });
            return true;
        } else if (!response) {
            logger.error('Request.error:', {
                url: this.url,
                status: this.statusCode,
                id: this.id,
                response: response,
                isRendered: this.isRendered,
                content_type: this.getHeader('content-type'),
                message: 'No data to render'
            });
            throw new error.HttpError(500, {}, 'No data to render');
        } else {
            logger.error('Request.error:', {
                url: this.url,
                status: this.statusCode,
                id: this.id,
                response: response,
                isRendered: this.isRendered,
                content_type: this.getHeader('content-type'),
                message: 'Invalid response type'
            });
            throw new error.HttpError(500, {}, 'Invalid response type, string or buffer is required!');
        }
    }
1101876
def render_to_response(self, *args, **kwargs):
        ''''''
        if self.request.path != self.object.get_absolute_url():
            return HttpResponseRedirect(self.object.get_absolute_url())
        return super(TalkView, self).render_to_response(*args, **kwargs)
734154
def render_django_response(self, **kwargs):
        """"""
        from django.http import HttpResponse
        return HttpResponse(
            self.render(**kwargs), content_type='image/svg+xml'
        )
159772
function mapResponse(response) {
  response.body = response.text;
  response.statusCode = response.status;
  return response;
}
942283
def render_widget(self, request, widget_id):
        ''''''

        widget = get_widget_from_id(widget_id)

        response = widget.render(**{'request': request})

        return JsonResponse({'result': response, 'id': widget_id})
733983
def respond(template, context={}, request=None, **kwargs):
    ""
    from django.http import HttpResponse
    from django.template import RequestContext
    from django.template.loader import render_to_string    

    if request:
        default = context_processors.default(request)
        default.update(context)
    else:
        default = context.copy()
    
    rendered = render_to_string(template, default, context_instance=request and RequestContext(request) or None)
    return HttpResponse(rendered, **kwargs)
34813
@Override
	public void render() {
		uri = ActionContext.getContextPath() + uri;
		try {
			Response.getServletResponse().sendRedirect(uri);
		} catch (IOException e) {
			throw new RenderException("Redirect to [" + uri + "] error!", e);
		}
	}
1018556
def render_json(json, options={})
      callback, variable = params[:callback], params[:variable]
      response = begin
                   if callback && variable
                     "var #{variable} = #{json};\n#{callback}(#{variable});"
                   elsif variable
                     "var #{variable} = #{json};"
                   elsif callback
                     "#{callback}(#{json});"
                   else
                     json
                   end
                 end
      render({:content_type => "application/json", :text => response}.merge(options))
    end
378197
def render_to_json(templates, context, request):
    
    html = render_to_string(
        templates,
        context=context,
        request=request
    )
    _json = json.dumps({
        "html": html
    })
    return HttpResponse(_json)
454182
def render(*args, &block)
      options = _normalize_render(*args, &block)
      rendered_body = render_to_body(options)
      if options[:html]
        _set_html_content_type
      else
        _set_rendered_content_type rendered_format
      end
      self.response_body = rendered_body
    end
81145
public function render()
    {
        // set response headers
        @Common::stripHeader('Pragma');
        @Common::stripHeader('Expires');
        @Common::sendHeader('Content-Type: text/html; charset=UTF-8');
        @Common::sendHeader('Cache-Control: must-revalidate');
        @Common::sendHeader('X-Frame-Options: deny');

        $error = htmlspecialchars($this->error, ENT_QUOTES, 'UTF-8');
        $messages = htmlspecialchars(serialize($this->feedbackMessages), ENT_QUOTES, 'UTF-8');
        $tokenAuth = $this->tokenAuth;
        $httpsFail = (int) $this->httpsFail;

        // use a heredoc instead of an external file
        echo <<<END_OF_TEMPLATE
<!DOCTYPE html>
<html>
 <head>
  <meta name="robots" content="noindex,nofollow">
  <meta charset="utf-8">
  <title></title>
 </head>
 <body>
  <form name="myform" method="post" action="?module=CoreUpdater&amp;action=oneClickResults">
   <input type="hidden" name="token_auth" value="$tokenAuth" />
   <input type="hidden" name="error" value="$error" />
   <input type="hidden" name="messages" value="$messages" />
   <input type="hidden" name="httpsFail" value="$httpsFail" />
   <noscript>
    <button type="submit">Continue</button>
   </noscript>
  </form>
  <script type="text/javascript">
   document.myform.submit();
  </script>
 </body>
</html>
END_OF_TEMPLATE;
    }
263407
def render(self, template, context=None, def_name=None, subdir='templates', content_type=None, status=None, charset=None):
        ''''''
        template_adapter = self.get_template_loader(subdir).get_template(template)
        return getattr(template_adapter, 'render_to_response')(context=context, request=self.request, def_name=def_name, content_type=content_type, status=status, charset=charset)
837869
@SneakyThrows
    public static void render(final HttpServletResponse response) {
        val map = new HashMap<String, Object>();
        response.setStatus(HttpServletResponse.SC_OK);
        render(map, response);
    }
387025
@Override
	public void renderHead(IHeaderResponse response) {
		super.renderHead(response);
		
		StringBuilder sb = new StringBuilder();
		if(container.isVisible()) sb.append("$('#"+BootstrapModal.this.getMarkupId()+"').modal('show');");
		else sb.append("$('#"+BootstrapModal.this.getMarkupId()+"').modal('hide');");
		response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
	}