Skip to content

Commit

Permalink
Added NGWelcomePage (a nicer initial response for a new application)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugithordarson committed Jan 21, 2024
1 parent fea64a6 commit fcd43f1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ng-appserver/src/main/java/ng/appserver/NGApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.ServiceLoader;
Expand All @@ -33,6 +32,7 @@
import x.junk.NGExceptionPage;
import x.junk.NGExceptionPageDevelopment;
import x.junk.NGSessionTimeoutPage;
import x.junk.NGWelcomePage;

/**
* FIXME: Initialization still feels a little weird, while we're moving away from the way it's handled in WOApplication. Look a little more into the flow of application initialization // Hugi 2021-12-29
Expand Down Expand Up @@ -484,15 +484,18 @@ public NGActionResults exceptionResponse( final Throwable throwable, final NGCon
* @return A default response for requests to the root.
*/
public NGActionResults defaultResponse( final NGRequest request ) {
return pageWithName( NGWelcomePage.class, request.context() );
/*
NGResponse response = new NGResponse( "Welcome to NGObjects!\nSorry, but I'm young and I still have no idea how to handle the default request", 404 );
response.appendContentString( "\n\nWould you like to see your request headers instead?\n\n" );

for( Entry<String, List<String>> header : request.headers().entrySet() ) {
response.appendContentString( header.getKey() + " : " + header.getValue() );
response.appendContentString( "\n" );
}

return response;
*/
}

/**
Expand Down
11 changes: 11 additions & 0 deletions ng-appserver/src/main/java/x/junk/NGWelcomePage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package x.junk;

import ng.appserver.NGComponent;
import ng.appserver.NGContext;

public class NGWelcomePage extends NGComponent {

public NGWelcomePage( NGContext context ) {
super( context );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Welcome!</title>
<style>
body {
font-family: sans-serif;
padding: 40px;
}
</style>
</head>
<body>
<h2>Welcome to ng-objects!</h2>
<p>This is the start page for a new ng-objects application.<p>
<p>Eventually it will contain something really cool and useful!</p>
</body>
</html>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"WebObjects Release" = "WebObjects 5.0";
encoding = "UTF-8";
}

0 comments on commit fcd43f1

Please sign in to comment.