com.jcorporate.expresso.ext.controller
Class ServeTextFile
java.lang.Object
org.apache.struts.action.Action
com.jcorporate.expresso.core.controller.Controller
com.jcorporate.expresso.core.controller.DBController
com.jcorporate.expresso.ext.controller.ServeTextFile
- All Implemented Interfaces:
- Serializable
- public class ServeTextFile
- extends DBController
This controller is used to serve up text files. It helps provide a particularly
useful mechanism for tutorial purposes.
PLEASE NOTE!: It is DEFINITELY not recommended that this controller
should be opened up to anybody but the Administrator in a production
environment! It could be used by malicious attackers to cause the system
to cough up password files, and many other things that they would not normally
have access to
- Author:
- Michael Rimov - Adapted from code created by Peter Pilgrim.
- See Also:
- Serialized Form
| Fields inherited from class com.jcorporate.expresso.core.controller.Controller |
CONTROLLER_PARAM_KEY, CTL_SUCC_CTL, CTL_SUCC_STATE, CTL_SUCC_TRAN, mLog, NEWSTATE_EXCEPTION_KEY, ORIGINAL_URL_KEY, REQUEST_KEY, RESPONSE_KEY, RETURN_TO_SENDER_TRAN, STATE_ERR_CTL, STATE_ERR_STATE, STATE_ERR_TRAN, STATE_PARAM_KEY, STATE_SUCC_CTL, STATE_SUCC_STATE, STATE_SUCC_TRAN |
| Fields inherited from class org.apache.struts.action.Action |
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY |
| Methods inherited from class com.jcorporate.expresso.core.controller.Controller |
addFinalState, addPromptTransitions, addRegDomainParamtoSession, addRequestedURLtoSession, addState, addStatePairing, endTimer, execute, findControllerForm, generateToken, getActionForward, getControllerChainingTransition, getControllerSecurityTransition, getFinalState, getInitialState, getLogger, getParamValues, getRequestURL, getSchema, getSchemaHierarchy, getSchemaInstance, getSchemaStack, getState, getStates, getString, getString, handleException, instantiate, isFinalState, isHandleState, isPromptState, isTokenValid, loadStateForm, newState, nextHandleState, nextPromptState, populateStateForm, postPerform, prePerform, previousPromptState, processRequestTransitions, processTransitions, redirectRequest, redirectRequest, remapFromExtension, resetToken, saveToken, setControllerChainingTransition, setControllerSecurityTransition, setCurrentState, setInitialState, setSchema, setSchema, setupDefaultValues, setupReturnToSender, setupSubclassLog, transition, transition, transition, unloadStateForm |
| Methods inherited from class org.apache.struts.action.Action |
execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_RESERVED_KEYWORD_COLOR
public static final String DEFAULT_RESERVED_KEYWORD_COLOR
- See Also:
- Constant Field Values
DEFAULT_PRIMITIVE_VAR_COLOR
public static final String DEFAULT_PRIMITIVE_VAR_COLOR
- See Also:
- Constant Field Values
DEFAULT_SPECIAL_KEYWORD_COLOR
public static final String DEFAULT_SPECIAL_KEYWORD_COLOR
- See Also:
- Constant Field Values
DEFAULT_SINGLE_QUOTE_COLOR
public static final String DEFAULT_SINGLE_QUOTE_COLOR
- See Also:
- Constant Field Values
DEFAULT_DOUBLE_QUOTE_COLOR
public static final String DEFAULT_DOUBLE_QUOTE_COLOR
- See Also:
- Constant Field Values
DEFAULT_CSTYLE_COMMENT_COLOR
public static final String DEFAULT_CSTYLE_COMMENT_COLOR
- See Also:
- Constant Field Values
DEFAULT_CPLUS_COMMENT_COLOR
public static final String DEFAULT_CPLUS_COMMENT_COLOR
- See Also:
- Constant Field Values
DEFAULT_DECIMAL_NUMBER_COLOR
public static final String DEFAULT_DECIMAL_NUMBER_COLOR
- See Also:
- Constant Field Values
reservedKeywordColor
protected static final String reservedKeywordColor
- See Also:
- Constant Field Values
primitiveVarColor
protected static final String primitiveVarColor
- See Also:
- Constant Field Values
specialKeywordColor
protected static final String specialKeywordColor
- See Also:
- Constant Field Values
singleQuoteColor
protected static final String singleQuoteColor
- See Also:
- Constant Field Values
doubleQuoteColor
protected static final String doubleQuoteColor
- See Also:
- Constant Field Values
cstyleCommentColor
protected static final String cstyleCommentColor
- See Also:
- Constant Field Values
cplusCommentColor
protected static final String cplusCommentColor
- See Also:
- Constant Field Values
decimalNumberColor
protected static final String decimalNumberColor
- See Also:
- Constant Field Values
java_reserved_keywords
protected static final com.jcorporate.expresso.ext.controller.ServeTextFile.ReservedWord[] java_reserved_keywords
fast_keyword_map
protected static Hashtable fast_keyword_map
ServeTextFile
public ServeTextFile()
runServeTextFileState
protected ControllerResponse runServeTextFileState(ControllerRequest request,
ControllerResponse response)
throws ControllerException
- Serves up a basic text file as specified by the parameter. Our goal
here is to provide something that is reasonably secure in that we remove
all URL trickery.
- Parameters:
request - The ControllerRequest Objectresponse - The ControllerResponse Object
- Returns:
- ControllerResponse
- Throws:
ControllerException - upon error
returnFile
protected void returnFile(String filename,
OutputStream out)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException
runServeJavaFileState
protected ControllerResponse runServeJavaFileState(ControllerRequest request,
ControllerResponse response)
throws ControllerException
- Serves up a java source file as specified by the parameter. This
state is different from that of servTextFile in that it color codes
all the keywords, etc in the java file.
Our goal here is to provide something that is reasonably secure in that we remove
all URL trickery, and we also only serve up NON source code files. Again,
this should be NOT used in a production environment and only exists for
teaching purposes.
- Parameters:
request - The ControllerRequest Objectresponse - The ControllerResponse Object
- Returns:
- ControllerResponse
- Throws:
ControllerException - upon error
returnHTMLFormattedFile
public void returnHTMLFormattedFile(com.jcorporate.expresso.ext.controller.ServeTextFile.Parameters params)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException
writeHeader
public void writeHeader(com.jcorporate.expresso.ext.controller.ServeTextFile.Parameters params)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException
writeFooter
protected void writeFooter(com.jcorporate.expresso.ext.controller.ServeTextFile.Parameters params)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException
writeContent
protected void writeContent(com.jcorporate.expresso.ext.controller.ServeTextFile.Parameters params)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException
substituteEntity
protected static final String substituteEntity(char c9)
getTitle
public String getTitle()
- Description copied from class:
Controller
- Return the title of this Controller
- Overrides:
getTitle in class Controller
- Returns:
- java.lang.String The Title of the controller
Please see www.jcorporate.com for information about new Expresso releases.