-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add interceptor for web requests (e.g. uploads )
- Loading branch information
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/ortus/boxlang/runtime/interceptors/WebRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ortus.boxlang.runtime.interceptors; | ||
|
||
import ortus.boxlang.runtime.events.InterceptionPoint; | ||
import ortus.boxlang.runtime.scopes.Key; | ||
import ortus.boxlang.runtime.types.IStruct; | ||
import ortus.boxlang.runtime.types.exceptions.BoxRuntimeException; | ||
|
||
/** | ||
* Web request based interceptions | ||
* TODO: Move this to web runtime when broken out | ||
*/ | ||
public class WebRequest { | ||
|
||
/** | ||
* Listens for the file component actions around web uploaads | ||
* | ||
* @param arguments | ||
*/ | ||
@InterceptionPoint | ||
public void onFileComponentAction( IStruct interceptData ) { | ||
IStruct arguments = interceptData.getAsStruct( Key.arguments ); | ||
Key action = Key.of( arguments.getAsString( Key.action ) ); | ||
|
||
if ( action.equals( Key.upload ) ) { | ||
throw new BoxRuntimeException( "The file action [" + action.getName() + "] is yet implemented in the web runtime" ); | ||
} else if ( action.equals( Key.uploadAll ) ) { | ||
throw new BoxRuntimeException( "The file action [" + action.getName() + "] is not yet implemented in the web runtime" ); | ||
} | ||
} | ||
|
||
} |