Class: PageRequest
- Inherits:
-
Object
- Object
- PageRequest
- Defined in:
- lib/ribit/ribit.rb
Instance Method Summary collapse
- #get_action_id ⇒ Object
- #get_base_path ⇒ Object
- #get_base_url ⇒ Object
- #get_header_field(name) ⇒ Object
- #get_host ⇒ Object
- #get_query_data ⇒ Object
- #get_request_param(name) ⇒ Object
- #get_requested_page_id ⇒ Object
-
#initialize(servletRequest) ⇒ PageRequest
constructor
A new instance of PageRequest.
Constructor Details
#initialize(servletRequest) ⇒ PageRequest
Returns a new instance of PageRequest.
193 194 195 196 197 |
# File 'lib/ribit/ribit.rb', line 193 def initialize( servletRequest ) @servletRequest = servletRequest @requestParams = parse_query_params( servletRequest.query_string) @logger = RibitLogger.new( PageRequest ) end |
Instance Method Details
#get_action_id ⇒ Object
220 221 222 223 224 225 226 227 |
# File 'lib/ribit/ribit.rb', line 220 def get_action_id match = /^\/([^\/?]+)/.match( @servletRequest.path_info ) if ( match == nil ) return nil end return match[1] end |
#get_base_path ⇒ Object
209 210 211 |
# File 'lib/ribit/ribit.rb', line 209 def get_base_path return @servletRequest.script_name end |
#get_base_url ⇒ Object
240 241 242 243 |
# File 'lib/ribit/ribit.rb', line 240 def get_base_url # last '/' is needed otherwise url doesn't work correctly return get_host + get_base_path + '/' end |
#get_header_field(name) ⇒ Object
246 247 248 |
# File 'lib/ribit/ribit.rb', line 246 def get_header_field( name ) @servletRequest[name] end |
#get_host ⇒ Object
230 231 232 233 234 235 236 237 |
# File 'lib/ribit/ribit.rb', line 230 def get_host match = /^((http:\/\/)?[^\/:]+(:[0-9]+)?)/.match( @servletRequest.request_uri.to_s ) if ( match == nil ) return '/' end return match[1] end |
#get_query_data ⇒ Object
205 206 207 |
# File 'lib/ribit/ribit.rb', line 205 def get_query_data return @servletRequest.query end |
#get_request_param(name) ⇒ Object
214 215 216 217 |
# File 'lib/ribit/ribit.rb', line 214 def get_request_param( name ) return @requestParams[name] return URI.unescape( @requestParams[name] ) end |
#get_requested_page_id ⇒ Object
200 201 202 |
# File 'lib/ribit/ribit.rb', line 200 def get_requested_page_id() return @requestParams[Constants::PAGE_ID_REQUEST_PARAM_NAME] end |