ASP4
view release on metacpan or search on metacpan
- Refactored ASP4::ErrorHandler to be more easily sub-classable.
- GlobalASA is now officially removed.
2011-11-13 1.062
- The httpd.conf produced by asphelper had an incorrect DocumentRoot. Fixed now.
2011-11-07 1.061
- asphelper now creates new ASP4 apps using the proper structure.
2011-11-06 1.060
- $Response->Include on a missing file will no longer result in a 404 on the
calling file. This goes for $Response->TrapInclude as well as <!-- #include virtual="..." -->
2011-11-05 1.059
- ASP4::API:
- No longer have to do this:
use ASP4::API;
my $api; BEGIN { $api = ASP4::API->new }
# Now load classes:
use MyApp::Foo;
- You can do this instead:
that this is the correct way for onesie-twosie deployments.
2011-10-04 1.057
- Renamed @AppRoot@ macro to @ProjectRoot@ to avoid confusion with $Config->web->application_root
- Adjusted package declarations in some "stealth-mode" pm files because they have no POD yet.
2011-10-03 1.056
- Updated asphelper to include directives that disable mod_deflate and Apache2::Reload
for ASP4 websites. RayBaksh++
- This fixes the dreaded "This website uses an invalid form of compression" error
that you may have gotten after trying to $Response->Status(404) within an asp script.
- Added in-memory mock sessionstate handler for faster testing and easier installation.
2011-09-22 1.055
- Giving credit where credit is due :-)
- Erikdj++
- Added *experimental* memcached session storage backend.
2011-09-20 1.054
- Added @AppRoot@ macro for asp4-config.json. It is 1 folder "up" from @ServerRoot@.
- If your @ServerRoot@ is:
- Upgrade required if you know what's good for you.
2011-07-09 v1.049
[Bug Fixes]
- v1.048 broke session cookies.
- Upgrade to v1.049 (quick).
2011-07-07 v1.048
[Bug Fixes]
- <% $Response->Status(404); return $Response->End; %> DID NOT WORK.
Instead it continued processing other ContentPlaceHolders. Now we check
to see if $Response->End was called before we process anything else.
- Still getting some "Content encoding error" messages from FF/Chrome/MSIE but
we're almost there.
2011-05-19 v1.047
[Bug Fixes]
- $Response->Expires("30M") wasn't documented. Now it is.
- $Response->Expires wasn't working properly. Now it is. (Always ended up with pre-epoch expiration times).
- If Router::Generic is installed, ASP4::ConfigNode::Web will create $Config->web->router
based on the "routes" segment of asp4-config.json.
- No documentation about this yet.
2010-03-22 v1.024
- $Request->Reroute() with additional querystring parameters was not adding
those extra parameters to $Form. Now it does.
2010-03-08 v1.023
- ASP4::HTTPContext now checks to see if any RequestFilters match a uri before
returning a 404. This is helpful for SEO optimizations.
- New feature: $Request->Reroute("/new-uri/?foo=bar")
* Also very useful for SEO.
2010-03-08 v1.022
- asphelper's final instructions are now more clear and concise.
- Fixes a bug that caused active sessions to timeout as though inactive simply
because they were not changed before the timeout occurred. Now, $Session->save()
checks to see if it's been more than 60 seconds since the last time the __lastMod
was changed - and if it has been more than 60 seconds, the session is saved
and the __lastMod value is updated to time() - thus preventing expiry of
t/etc/properties.yaml
t/etc/test_fixtures.json
t/etc/test_fixtures.yaml
t/handlers/dev/api_inside_handler.pm
t/handlers/dev/encoding/hello.pm
t/handlers/dev/headers.pm
t/handlers/dev/redirect_after_trapinclude.pm
t/handlers/dev/seo_handler.pm
t/handlers/dev/simple.pm
t/handlers/dev/speed.pm
t/htdocs/404.asp
t/htdocs/child-returns-404.asp
t/htdocs/everything/master.asp
t/htdocs/everything/step01.asp
t/htdocs/form.pm
t/htdocs/GlobalASA.pm
t/htdocs/include-missing.asp
t/htdocs/index.asp
t/htdocs/masters/deep.asp
t/htdocs/masters/global.asp
t/htdocs/masters/submaster.asp
t/htdocs/pageparser/010.asp
lib/ASP4/HTTPContext.pm view on Meta::CPAN
eval {
$s->{handler} = $s->config->web->handler_resolver->new()->resolve_request_handler( $s->r->uri );
};
if( $@ )
{
$s->server->{LastError} = $@;
return $s->handle_error;
}# end if()
return $s->response->Status( 404 ) unless $s->{handler};
eval {
$s->config->load_class( $s->handler );
$s->config->web->handler_runner->new()->run_handler( $s->handler, $args );
};
if( $@ )
{
$s->server->{LastError} = $@;
return $s->handle_error;
lib/ASP4/Mock/RequestRec.pm view on Meta::CPAN
=head2 headers_out( )
Returns a hashref representing the outgoing headers.
=head2 err_headers_out( )
Returns a hashref representing the outgoing headers.
=head2 status( [$new_status] )
Sets or gets the status code for the response. 200 for "OK", 301 for "Moved" - 404 for "not found" etc.
=head2 content_type( [$new_content_type] )
Sets or gets the mime-header for the outgoing response. Default is C<text/plain>.
=head1 PUBLIC METHODS
=head2 print( $str )
Adds C<$str> to the outgoing response buffer.
lib/ASP4/ModPerl.pm view on Meta::CPAN
my $handler_class = eval {
$context->config->web->handler_resolver->new()->resolve_request_handler( $r->uri )
};
if( $@ )
{
warn $@;
$r->status( 500 );
return $r->status;
}# end if()
return 404 unless $handler_class;
eval {
my $cgi = CGI->new( $r );
my %args = map { my ($k,$v) = split /\=/, $_; ( $k => $v ) } split /&/, $ENV{QUERY_STRING};
map { $cgi->param($_ => $args{$_}) } keys %args;
$context->setup_request( $r, $cgi);
$context->execute;
};
if( $@ )
{
lib/ASP4/Response.pm view on Meta::CPAN
=head1 PROPERTIES
=head2 ContentType( [$type] )
Sets or gets the C<content-type> header for the response. Examples are C<text/html>, C<image/gif>, C<text/csv>, etc.
=head2 Status( [$status] )
Sets or gets the C<Status> header for the response. See L<http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html> for details.
B<NOTE:> Only the numeric part is necessary - eg: 200, 301, 404, etc.
=head2 Headers()
Returns the L<HTTP::Headers> object that will be used for the outgoing response.
If necessary, you can manipulate this object in any way you see fit.
=head2 Declined
For use within a L<ASP4::RequestFilter> subclass, like this:
lib/ASP4/StaticHandler.pm view on Meta::CPAN
sub run
{
my ($s, $context) = @_;
my $file = $ENV{SCRIPT_FILENAME} ?
$ENV{SCRIPT_FILENAME} :
$Server->MapPath( (split /\?/, $ENV{REQUEST_URI})[0] );
unless( $file && -f $file )
{
$Response->Status( 404 );
$Response->End;
return 404;
}# end unless()
open my $ifh, '<', $file
or die "Cannot open '$file' for reading: $!";
local $/;
$Response->SetHeader('content-length' => (stat($file))[7] );
my ($ext) = $file =~ m{\.([^\.]+)$};
my %types = (
swf => 'application/x-shockwave-flash',
xml => 'text/xml',
t/010-basic/090-everything.t view on Meta::CPAN
ok(
my $res = $api->ua->get('/static.txt'),
"Got /static.txt"
);
is(
$res->content => "Hello, World!\n",
"content is correct"
);
}
# static 404:
{
ok(
my $res = $api->ua->get('/missing-file.txt'),
"Requested /missing-file.txt"
);
ok(
! $res->is_success,
"Not successful"
);
like $res->status_line, qr{^404}, "Status looks like a 404 error";
}
t/conf/httpd.conf view on Meta::CPAN
PerlModule DBD::mysql
PerlModule ASP4::ModPerl
<VirtualHost *:80>
ServerName mysite.com
DocumentRoot /home/john/Projects/ASP4/t/htdocs
# Set the directory index:
DirectoryIndex index.asp
ErrorDocument 404 /404.asp
# All *.asp files are handled by ASP4::ModPerl
<Files ~ (\.asp$)>
SetHandler perl-script
PerlResponseHandler ASP4::ModPerl
</Files>
# !IMPORTANT! Prevent anyone from viewing your GlobalASA.pm
<Files ~ (\.pm$)>
Order allow,deny
t/htdocs/404.asp view on Meta::CPAN
<html>
<head><title>404: Page Missing</title></head>
<body>
<h1>404: Page Missing</h1>
<p>
The resource you requested — <code><%= $Server->HTMLEncode( $ENV{REDIRECT_REQUEST_URI} ) %></code> — could not be found.
</p>
</body>
</html>
t/htdocs/child-returns-404.asp view on Meta::CPAN
<%@ Page UseMasterPage="/masters/global.asp" %>
<asp:Content PlaceHolderID="init"><%
$Response->Status( 404 );
return $Response->End;
%></asp:Content>
<asp:Content PlaceHolderID="page_body"><%
die "Should not get here.";
%></asp:Content>
( run in 1.900 second using v1.01-cache-2.11-cpan-39bf76dae61 )