Examples of FileItemFactory


Examples of org.apache.commons.fileupload.FileItemFactory

  @Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    boolean isMultipart = ServletFileUpload.isMultipartContent(req);
    if(isMultipart) {
      try {
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(factory);
        List<FileItem> items = upload.parseRequest(req);
        String key = req.getParameter("type");
        for(FileItem item: items) {
          if(!item.isFormField()) {
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

    /**
     * Get the form data from the inbound request.
     */
    @SuppressWarnings("rawtypes")
    private FormData getFormData( final HttpServletRequest request ) throws IOException {
        final FileItemFactory factory = new DiskFileItemFactory();
        final ServletFileUpload upload = new ServletFileUpload( factory );
        upload.setHeaderEncoding( "UTF-8" );

        final FormData data = new FormData();
        try {
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

    /**
     * Get the form data from the inbound request.
     */
    @SuppressWarnings("rawtypes")
    public static FormData getFormData(HttpServletRequest request) {
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload( factory );
        upload.setHeaderEncoding( "UTF-8" );

        FormData data = new FormData();
        try {
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

    // Check that we have a file upload request
    boolean isMultipart = ServletFileUpload.isMultipartContent(request);
    if (isMultipart) {

      // Create a factory for disk-based file items
      FileItemFactory factory = new DiskFileItemFactory();

      // Create a new file upload handler
      ServletFileUpload upload = new ServletFileUpload(factory);

      // Parse the request
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

     */
    protected void doPost(Request req, Response resp) throws IOException {
        if (req.getEntity().getMediaType() != null &&
                req.getEntity().getMediaType().equals(MediaType.MULTIPART_FORM_DATA, true)) {
            try {
                FileItemFactory factory = new DiskFileItemFactory();
                RestletFileUpload upload = new RestletFileUpload(factory);
                List items = upload.parseRequest(req);
                FileItem file = null;

                Iterator it = items.iterator();
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

 
  public String performUpload(HttpServletRequest request, String currentFolder) throws Exception {
    String result = null;
    JSONEscapeObject JSONEscapeObject = new JSONEscapeObject();
    try {
      FileItemFactory factory = new DiskFileItemFactory();
      ServletFileUpload upload = new ServletFileUpload(factory);
      if (maxsize > 0) {
        upload.setSizeMax(maxsize);
      }
      List<?> items = upload.parseRequest(request);
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

   
    try  {
      if(request.getContentType() != null &&
          request.getContentType().startsWith("multipart/form-data;")) {
       
        FileItemFactory fif = new DiskFileItemFactory();
        ServletFileUpload sfu = new ServletFileUpload(fif);
        List itemList = sfu.parseRequest(request);
        Document paperDoc = null;
        String paperName = null;
        for(Object o : itemList) {
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

     * @throws Exception
     */
    public void testAddPathInfo() throws Exception
    {
        ParameterParser pp = new DefaultParameterParser();
        FileItemFactory factory = new DiskFileItemFactory(10240, null);

        assertEquals("keySet() is not empty!", 0, pp.keySet().size());

        FileItem test = factory.createItem("upload-field", "application/octet-stream", false, null);
        pp.add("upload-field", test);

        assertEquals("FileItem not found in keySet()!", 1, pp.keySet().size());

        Iterator it = pp.keySet().iterator();
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

    private static Logger logger = org.slf4j.LoggerFactory.getLogger(GWTFileManagerUploadServlet.class);

    @SuppressWarnings("unchecked")
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(factory);
        upload.setSizeMax(Jahia.getSettings().getJahiaFileUploadMaxSize());
        upload.setHeaderEncoding("UTF-8");
        Map<String, FileItem> uploads = new HashMap<String, FileItem>();
        String location = null;
View Full Code Here

Examples of org.apache.commons.fileupload.FileItemFactory

     * @param requestContext
     * @return
     * @throws FileUploadException
     */
    private List parseRequest(ServletRequestContext requestContext) throws FileUploadException {
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(factory);
        return upload.parseRequest(requestContext);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.