Skip to content

Commit

Permalink
Temp hack for rendering an exception response to a partial page update
Browse files Browse the repository at this point in the history
  • Loading branch information
hugithordarson committed Oct 9, 2024
1 parent 7c082c1 commit ef7b9a3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ng-appserver/src/main/java/ng/appserver/NGApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,12 @@ protected NGActionResults handlePageRestorationException( final NGPageRestoratio
*/
public NGActionResults exceptionResponse( final Throwable throwable, final NGContext context ) {

// FIXME: The originating context might have been an Ajax request, meaning the exception page won't render squat, which isn't helpful.
// We should(a) not render the exception pace in the original context where the exception happened and/or (b) have a better,
// more generic mechanism to ignore the context's updateContainers (in other words, we need a better way to control rendering from the server side)
// Hugi 2024-10-09
context.forceFullUpdate = true;

final boolean isDevelopmentMode = isDevelopmentMode();

// If we're in development mode, we want to show some extra nice debugging information (sources, caches, context info etc.)
Expand Down
5 changes: 5 additions & 0 deletions ng-appserver/src/main/java/ng/appserver/NGContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public String targetedUpdateContainerID() {
return request().headerForKey( "x-updatecontainerid" );
}

/**
* FIXME: Yet another temporary testhack while we experiment with methods to control partial page updates on the server side // Hugi 2024-10-09
*/
public boolean forceFullUpdate;

/**
* The request that initiated the creation of this context
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ private static List<NGElement> childrenFromTemplate( final NGElement contentTemp
*/
private static boolean shouldAppendToResponseInContext( final NGContext context ) {

// FIXME: Dont' forget; this is a temporary reprieve // Hugi 2024-10-09
if( context.forceFullUpdate ) {
return true;
}

// The list of containers to update is passed in to the request as a header
// FIXME: Get this from the context (or wherever we eventually decide to store response generation parameters) // Hugi 2024-10-09
final List<String> containerIDsToUpdate = context.request().headersForKey( "x-updatecontainerid" );

// If no containers are specified, we're doing a full page render, so always perform appendToResponse()
Expand Down

0 comments on commit ef7b9a3

Please sign in to comment.