diff --git a/Kernel/System/Web/Request.pm b/Kernel/System/Web/Request.pm index c327b87880..5a64985b9e 100644 --- a/Kernel/System/Web/Request.pm +++ b/Kernel/System/Web/Request.pm @@ -16,6 +16,8 @@ package Kernel::System::Web::Request; +## nofilter(TidyAll::Plugin::OTOBO::Perl::Pod::FunctionPod) + use strict; use warnings; use v5.24; @@ -50,24 +52,35 @@ Holds the request params and other info on the request. =head2 new() -create param object. Do not use it directly, instead use: +create param object. Do not use it directly, instead use it via the OTOBO object manager. + +The regular usage in the web interface modules, e.g. in L. use Kernel::System::ObjectManager; - # usually the PSGI env is already available - local $Kernel::OM = Kernel::System::ObjectManager->new( + # the PSGI env is already available in the interface modules + $Kernel::OM->ObjectParamAdd( 'Kernel::System::Web::Request' => { PSGIEnv => $PSGIEnv } ); - # alternatively create a request object when we are in a CGI environment - local $Kernel::OM = Kernel::System::ObjectManager->new( + # later in the code + my $ParamObject = $Kernel::OM->Get('Kernel::System::Web::Request'); + +In the test scripts it is convenient to pass in a request object directly. + + use CGI; + use Kernel::System::UnitTest::RegisterDriver; + + CGI::initialize_globals(); + $Kernel::OM->ObjectParamAdd( 'Kernel::System::Web::Request' => { - WebRequest => CGI::PSGI->new($env) + WebRequest => CGI->new(), } ); + # later in the test script or in the used modules my $ParamObject = $Kernel::OM->Get('Kernel::System::Web::Request'); If Kernel::System::Web::Request is instantiated several times, they will share the @@ -389,7 +402,7 @@ sub GetCookie { =head2 RemoteAddr() get the remote address of the HTTP client. -This is a wrapper around CGI::remote_addr(). +This is a wrapper around C. my $RemoteAddr = $ParamObject->RemoteAddr(); @@ -404,7 +417,7 @@ sub RemoteAddr { =head2 RemoteUser() get the remote user. -This is a wrapper around CGI::remote_user(). +This is a wrapper around C. my $RemoteUser = $ParamObject->RemoteUser(); @@ -419,7 +432,7 @@ sub RemoteUser { =head2 ScriptName() return the script name as a partial URL, for self-referring scripts. -This is a wrapper around CGI::script_name(). +This is a wrapper around C. my $ScriptName = $ParamObject->ScriptName(); @@ -438,7 +451,7 @@ sub ScriptName { =head2 ServerProtocol() return info about the protocol. -This is a wrapper around CGI::server_protocol(). +This is a wrapper around C. my $ServerProtocol = $ParamObject->ServerProtocol(); @@ -453,7 +466,7 @@ sub ServerProtocol { =head2 ServerSoftware() return info which server is running. -This is a wrapper around CGI::server_software(). +This is a wrapper around C. my $ServerSoftware = $ParamObject->ServerSoftware(); @@ -468,7 +481,7 @@ sub ServerSoftware { =head2 RequestURI() Returns the interpreted pathname of the requested document or CGI (relative to the document root). Or undef if not set. -This is a wrapper around CGI::request_uri(). +This is a wrapper around C. my $RequestURI = $ParamObject->RequestURI(); @@ -483,7 +496,7 @@ sub RequestURI { =head2 ContentType() Returns content-type header. -This is a wrapper around CGI::content_type(). +This is a wrapper around C. my $ContentType = $ParamObject->ContentType(); @@ -498,7 +511,7 @@ sub ContentType { =head2 QueryString() Returns the query string. -This is a wrapper around CGI::query_string(). +This is a wrapper around C. my $QueryString = $ParamObject->QueryString(); @@ -513,7 +526,7 @@ sub QueryString { =head2 RequestMethod() Usually either GET or POST. -This is a wrapper around CGI::request_method(). +This is a wrapper around C. my $RequestMethod = $ParamObject->RequestMethod(); @@ -528,7 +541,7 @@ sub RequestMethod { =head2 PathInfo() Returns additional path information from the script URL. -This is a wrapper around CGI::path_info(). +This is a wrapper around C. my $PathInfo = $ParamObject->PathInfo(); @@ -543,7 +556,7 @@ sub PathInfo { =head2 HTTP() get the HTTP environment variable. Called with a single argument get the specific environment variable. -This is a wrapper around CGI::http(). +This is a wrapper around C. my $UserAgent = $ParamObject->HTTP('USER_AGENT'); diff --git a/bin/psgi-bin/otobo.psgi b/bin/psgi-bin/otobo.psgi index b2f34db34c..e9f4327492 100755 --- a/bin/psgi-bin/otobo.psgi +++ b/bin/psgi-bin/otobo.psgi @@ -206,7 +206,7 @@ my $ExactlyRootMiddleware = sub { # With S3 support, loader files are initially stored in S3. # Sync them to the local file system so that Plack::App::File can deliver them. -# Checking the namee is sufficient as the loader files contain a checksum. +# Checking the name is sufficient as the loader files contain a checksum. my $SyncFromS3Middleware = sub { my $App = shift;