~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/net/instaweb/rewriter/public/file_input_resource.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2010 Google Inc.
3
 
 *
4
 
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 
 * you may not use this file except in compliance with the License.
6
 
 * You may obtain a copy of the License at
7
 
 *
8
 
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 
 *
10
 
 * Unless required by applicable law or agreed to in writing, software
11
 
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 
 * See the License for the specific language governing permissions and
14
 
 * limitations under the License.
15
 
 */
16
 
 
17
 
// Author: sligocki@google.com (Shawn Ligocki)
18
 
//
19
 
// Input resource created based on a local file.
20
 
 
21
 
#ifndef NET_INSTAWEB_REWRITER_PUBLIC_FILE_INPUT_RESOURCE_H_
22
 
#define NET_INSTAWEB_REWRITER_PUBLIC_FILE_INPUT_RESOURCE_H_
23
 
 
24
 
#include "net/instaweb/http/public/request_context.h"
25
 
#include "net/instaweb/rewriter/public/resource.h"
26
 
#include "net/instaweb/util/public/basictypes.h"
27
 
#include "net/instaweb/util/public/string.h"
28
 
#include "net/instaweb/util/public/string_util.h"
29
 
 
30
 
namespace net_instaweb {
31
 
 
32
 
struct ContentType;
33
 
class InputInfo;
34
 
class MessageHandler;
35
 
class ResponseHeaders;
36
 
class RewriteDriver;
37
 
 
38
 
class FileInputResource : public Resource {
39
 
 public:
40
 
  FileInputResource(const RewriteDriver* driver,
41
 
                    const ContentType* type,
42
 
                    StringPiece url,
43
 
                    StringPiece filename);
44
 
  virtual ~FileInputResource();
45
 
 
46
 
  // Uses default no-op Freshen implementation because file-based resources
47
 
  // are fetched each time they are needed.
48
 
 
49
 
  virtual bool IsValidAndCacheable() const;
50
 
 
51
 
  // Set OutputPartition's input info used for expiration validation.
52
 
  virtual void FillInPartitionInputInfo(HashHint include_content_hash,
53
 
                                        InputInfo* input);
54
 
 
55
 
  virtual GoogleString url() const { return url_; }
56
 
 
57
 
  virtual bool UseHttpCache() const { return false; }
58
 
 
59
 
 protected:
60
 
  void SetDefaultHeaders(const ContentType* content_type,
61
 
                         ResponseHeaders* header, MessageHandler* handler);
62
 
 
63
 
  virtual void LoadAndCallback(NotCacheablePolicy not_cacheable_policy,
64
 
                               const RequestContextPtr& request_context,
65
 
                               AsyncCallback* callback);
66
 
 
67
 
 private:
68
 
  GoogleString url_;
69
 
  GoogleString filename_;
70
 
  int64 last_modified_time_sec_;  // Loaded from file mtime.
71
 
  int64 load_from_file_cache_ttl_ms_;
72
 
  bool load_from_file_ttl_set_;
73
 
 
74
 
  DISALLOW_COPY_AND_ASSIGN(FileInputResource);
75
 
};
76
 
 
77
 
}  // namespace net_instaweb
78
 
 
79
 
#endif  // NET_INSTAWEB_REWRITER_PUBLIC_FILE_INPUT_RESOURCE_H_