Skip to content

Commit

Permalink
Moved the horrid resetSessionCookie() to a separate method
Browse files Browse the repository at this point in the history
  • Loading branch information
hugithordarson committed Mar 17, 2024
1 parent 522d379 commit 312b09e
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions ng-appserver/src/main/java/ng/appserver/NGApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,32 @@ public NGApplication() {
systemRoutes.map( "/wa/", new NGDirectActionRequestHandler() );
systemRoutes.map( "/womp/", new WOMPRequestHandler() );
systemRoutes.map( "/sessionCookieReset/", ( request ) -> {
final NGResponse response = new NGResponse();

response.setHeader( "location", "/" );
response.setStatus( 302 );
response.setHeader( "content-type", "text/html" );
response.setHeader( "content-length", "0" );
response.addCookie( createSessionCookie( "SessionCookieKillerCookieValuesDoesNotMatter", 0 ) );
return resetSessionCookie();
} );

return response;
// FIXME: This is her temporarily while we figure out a "missing slash" problem on a deployed application // Hugi 2024-03-17
systemRoutes.map( "/sessionCookieReset", ( request ) -> {
return resetSessionCookie();
} );

_routeTables.add( systemRoutes );
}

/**
* FIXME: This needs cleanup. And perhaps... A better mechanism overall? // Hugi 2024-03-17
*/
private NGActionResults resetSessionCookie() {
final NGResponse response = new NGResponse();

response.setHeader( "location", "/" );
response.setStatus( 302 );
response.setHeader( "content-type", "text/html" );
response.setHeader( "content-length", "0" );
response.addCookie( createSessionCookie( "SessionCookieKillerCookieValuesDoesNotMatter", 0 ) );

return response;
}

/**
* Locates plugins and loads them.
*/
Expand Down Expand Up @@ -497,12 +510,12 @@ public NGActionResults defaultResponse( final NGRequest request ) {
/*
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

0 comments on commit 312b09e

Please sign in to comment.