Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Assetic response#75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
1 commit merged intosymfony:masterfrommarphi:assetic_response
Feb 22, 2011
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,14 +26,12 @@
class AsseticController
{
protected $request;
protected $response;
protected $am;
protected $cache;

public function __construct(Request $request,Response $response,AssetManager $am, CacheInterface $cache)
public function __construct(Request $request, AssetManager $am, CacheInterface $cache)
{
$this->request = $request;
$this->response = $response;
$this->am = $am;
$this->cache = $cache;
}
Expand All@@ -46,20 +44,22 @@ public function render($name)

$asset = $this->getAsset($name);

$response = new Response();

// validate if-modified-since
if (null !== $lastModified = $asset->getLastModified()) {
$date = new \DateTime();
$date->setTimestamp($lastModified);
$this->response->setLastModified($date);
$response->setLastModified($date);

if ($this->response->isNotModified($this->request)) {
return $this->response;
if ($response->isNotModified($this->request)) {
return $response;
}
}

$this->response->setContent($asset->dump());
$response->setContent($asset->dump());

return $this->response;
return $response;
}

protected function getAsset($name)
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
</service>
<service id="assetic.controller" class="%assetic.controller.class%" scope="prototype">
<argument type="service" id="request" />
<argument type="service" id="response" />
<argument type="service" id="assetic.asset_manager" />
<argument type="service" id="assetic.cache" />
</service>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,7 +50,6 @@ protected function setUp()
$this->container = new ContainerBuilder();
$this->container->addScope(new Scope('request'));
$this->container->register('request', 'Symfony\\Component\\HttpFoundation\\Request')->setScope('request');
$this->container->register('response', 'Symfony\\Component\\HttpFoundation\\Response')->setScope('prototype');
$this->container->register('twig', 'Twig_Environment');
$this->container->setParameter('kernel.debug', false);
$this->container->setParameter('kernel.root_dir', __DIR__);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp