Class ImageUploadController
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet
-
- edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet
-
- edu.cornell.mannlib.vitro.webapp.controller.freemarker.ImageUploadController
-
- All Implemented Interfaces:
MultipartRequestWrapper.ParsingStrategy,Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
@WebServlet(name="ImageUploadController", urlPatterns="/uploadImages") public class ImageUploadController extends FreemarkerHttpServletHandle adding, replacing or deleting the main image on an Individual.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet
FreemarkerHttpServlet.Template
-
Nested classes/interfaces inherited from class edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet
VitroHttpServlet.PickListSorter
-
-
Field Summary
Fields Modifier and Type Field Description static StringACTION_DELETEA request to delete the file and return to the referring page.static StringACTION_DELETE_EDITA request to delete the file and return to the "new image" screen.static StringACTION_SAVEHere is the cropping info; we're ready to save the image.static StringACTION_UPLOADHere is the main image file.static StringBODY_CANCEL_URLstatic StringBODY_DELETE_URLstatic StringBODY_ENTITY_NAMEstatic StringBODY_ERROR_MESSAGEstatic StringBODY_FORM_ACTIONstatic StringBODY_MAIN_IMAGE_HEIGHTstatic StringBODY_MAIN_IMAGE_URLstatic StringBODY_MAIN_IMAGE_WIDTHstatic StringBODY_MAX_FILE_SIZEstatic StringBODY_THUMBNAIL_HEIGHTstatic StringBODY_THUMBNAIL_URLstatic StringBODY_THUMBNAIL_WIDTHstatic StringBODY_TITLEstatic intMAXIMUM_FILE_SIZELimit file size to 6 megabytes.static StringPARAMETER_ACTIONThe form field that tells what we are doing: uploading? deleting?static StringPARAMETER_ENTITY_URIThe form field that identifies the Individual.static StringPARAMETER_UPLOADED_FILEThe form field of the uploaded file; use as a key to the FileItem map.static StringTEMPLATE_CROPstatic StringTEMPLATE_ERRORstatic StringTEMPLATE_NEWstatic StringTEMPLATE_REPLACEstatic intTHUMBNAIL_HEIGHTGenerated thumbnails will be this big.static intTHUMBNAIL_WIDTH-
Fields inherited from class edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet
BODY_TEMPLATE_TYPE, PAGE_TEMPLATE_TYPE
-
Fields inherited from class edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet
HTML_MIMETYPE, JSON_LD_MIMETYPE, JSON_MIMETYPE, N3_MIMETYPE, publicDateFormat, RDFXML_MIMETYPE, TTL_MIMETYPE, XHTML_MIMETYPE
-
-
Constructor Summary
Constructors Constructor Description ImageUploadController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit()When initialized, get a reference to the File Storage system.longmaximumMultipartFileSize()How large an image file will we accept?protected ResponseValuesprocessRequest(VitroRequest vreq)Handle the different actions.protected AuthorizationRequestrequiredActions(VitroRequest vreq)The required action depends on what we are trying to do.booleanstashFileSizeException()What will we do if there is a problem parsing the request?-
Methods inherited from class edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet
doException, doForward, doGet, doPost, doRdf, doRedirect, doResponse, doTemplate, getBeansWrapper, getDisplayModelMenu, getFreemarkerComponentsForJsp, getPageTemplateName, getPageTemplateValues, getThemeDir, getTitle, handleException, processTemplate, processTemplateToString, wrap, wrap, write, writePage, writeTemplate, writeTemplate
-
Methods inherited from class edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet
dumpRequestParameters, isAuthorizedToDisplayPage, redirectToInsufficientAuthorizationPage, redirectToLoginPage, redirectUnauthorizedRequest, service, sortForPickList
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
-
-
-
-
Field Detail
-
MAXIMUM_FILE_SIZE
public static final int MAXIMUM_FILE_SIZE
Limit file size to 6 megabytes.- See Also:
- Constant Field Values
-
THUMBNAIL_HEIGHT
public static final int THUMBNAIL_HEIGHT
Generated thumbnails will be this big.- See Also:
- Constant Field Values
-
THUMBNAIL_WIDTH
public static final int THUMBNAIL_WIDTH
- See Also:
- Constant Field Values
-
PARAMETER_ACTION
public static final String PARAMETER_ACTION
The form field that tells what we are doing: uploading? deleting?- See Also:
- Constant Field Values
-
PARAMETER_ENTITY_URI
public static final String PARAMETER_ENTITY_URI
The form field that identifies the Individual.- See Also:
- Constant Field Values
-
PARAMETER_UPLOADED_FILE
public static final String PARAMETER_UPLOADED_FILE
The form field of the uploaded file; use as a key to the FileItem map.- See Also:
- Constant Field Values
-
ACTION_UPLOAD
public static final String ACTION_UPLOAD
Here is the main image file. Hold on to it.- See Also:
- Constant Field Values
-
ACTION_SAVE
public static final String ACTION_SAVE
Here is the cropping info; we're ready to save the image.- See Also:
- Constant Field Values
-
ACTION_DELETE
public static final String ACTION_DELETE
A request to delete the file and return to the referring page.- See Also:
- Constant Field Values
-
ACTION_DELETE_EDIT
public static final String ACTION_DELETE_EDIT
A request to delete the file and return to the "new image" screen.- See Also:
- Constant Field Values
-
BODY_TITLE
public static final String BODY_TITLE
- See Also:
- Constant Field Values
-
BODY_ENTITY_NAME
public static final String BODY_ENTITY_NAME
- See Also:
- Constant Field Values
-
BODY_MAIN_IMAGE_URL
public static final String BODY_MAIN_IMAGE_URL
- See Also:
- Constant Field Values
-
BODY_MAIN_IMAGE_HEIGHT
public static final String BODY_MAIN_IMAGE_HEIGHT
- See Also:
- Constant Field Values
-
BODY_MAIN_IMAGE_WIDTH
public static final String BODY_MAIN_IMAGE_WIDTH
- See Also:
- Constant Field Values
-
BODY_THUMBNAIL_URL
public static final String BODY_THUMBNAIL_URL
- See Also:
- Constant Field Values
-
BODY_CANCEL_URL
public static final String BODY_CANCEL_URL
- See Also:
- Constant Field Values
-
BODY_DELETE_URL
public static final String BODY_DELETE_URL
- See Also:
- Constant Field Values
-
BODY_FORM_ACTION
public static final String BODY_FORM_ACTION
- See Also:
- Constant Field Values
-
BODY_ERROR_MESSAGE
public static final String BODY_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
BODY_MAX_FILE_SIZE
public static final String BODY_MAX_FILE_SIZE
- See Also:
- Constant Field Values
-
BODY_THUMBNAIL_WIDTH
public static final String BODY_THUMBNAIL_WIDTH
- See Also:
- Constant Field Values
-
BODY_THUMBNAIL_HEIGHT
public static final String BODY_THUMBNAIL_HEIGHT
- See Also:
- Constant Field Values
-
TEMPLATE_NEW
public static final String TEMPLATE_NEW
- See Also:
- Constant Field Values
-
TEMPLATE_REPLACE
public static final String TEMPLATE_REPLACE
- See Also:
- Constant Field Values
-
TEMPLATE_CROP
public static final String TEMPLATE_CROP
- See Also:
- Constant Field Values
-
TEMPLATE_ERROR
public static final String TEMPLATE_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init() throws javax.servlet.ServletExceptionWhen initialized, get a reference to the File Storage system. Without that, we can do nothing.- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
maximumMultipartFileSize
public long maximumMultipartFileSize()
How large an image file will we accept?- Specified by:
maximumMultipartFileSizein interfaceMultipartRequestWrapper.ParsingStrategy- Overrides:
maximumMultipartFileSizein classVitroHttpServlet
-
stashFileSizeException
public boolean stashFileSizeException()
What will we do if there is a problem parsing the request?- Specified by:
stashFileSizeExceptionin interfaceMultipartRequestWrapper.ParsingStrategy- Overrides:
stashFileSizeExceptionin classVitroHttpServlet
-
requiredActions
protected AuthorizationRequest requiredActions(VitroRequest vreq)
The required action depends on what we are trying to do.- Overrides:
requiredActionsin classFreemarkerHttpServlet
-
processRequest
protected ResponseValues processRequest(VitroRequest vreq)
Handle the different actions. If not specified, the default action is to show the intro screen.- Overrides:
processRequestin classFreemarkerHttpServlet
-
-