com.wewebu.ow.server.servlets
Class OwAbstractUpload

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.wewebu.ow.server.servlets.OwAbstractUpload
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
OwGetContent, OwMultifileDownload

public abstract class OwAbstractUpload
extends javax.servlet.http.HttpServlet

Abstract HttpServlet which provides helper methods to handle file name for upload process.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com

Since:
3.1.0.4
See Also:
Serialized Form

Constructor Summary
OwAbstractUpload()
           
 
Method Summary
protected  String createFileName(String defaultName, OwContentElement contentElement)
          Return the name which should be used in content disposition header.
protected  void doGet(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          Handles the HTTP GET method.
protected  void doPost(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          Handles the HTTP POST method.
protected abstract  void processRequest(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          Main method to be implemented for upload of content to the client, this method is a delegation from GET and POST requests.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwAbstractUpload

public OwAbstractUpload()
Method Detail

createFileName

protected String createFileName(String defaultName,
                                OwContentElement contentElement)
                         throws Exception
Return the name which should be used in content disposition header. Will use the getMIMEParameter() of content element first and extract the file name from there. If not available a file extension is searched based on the content MIME type and will be attached to the defaultName.
Attaching will only be processed if the defaultName not already contains the same file extension suffix.

Parameters:
defaultName - String name to be used by default
contentElement - OwContentElement
Returns:
String for file name upload
Throws:
Exception - if could not retrieve information form provided content element

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request_p,
                     javax.servlet.http.HttpServletResponse response_p)
              throws javax.servlet.ServletException,
                     IOException
Handles the HTTP GET method.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request_p - servlet request
response_p - servlet response
Throws:
javax.servlet.ServletException
IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request_p,
                      javax.servlet.http.HttpServletResponse response_p)
               throws javax.servlet.ServletException,
                      IOException
Handles the HTTP POST method.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request_p - servlet request
response_p - servlet response
Throws:
javax.servlet.ServletException
IOException

processRequest

protected abstract void processRequest(javax.servlet.http.HttpServletRequest request_p,
                                       javax.servlet.http.HttpServletResponse response_p)
                                throws javax.servlet.ServletException,
                                       IOException
Main method to be implemented for upload of content to the client, this method is a delegation from GET and POST requests.

Parameters:
request_p - HttpServletRequest
response_p - HttpServletResponse
Throws:
javax.servlet.ServletException
IOException


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.