Package org.apache.commons.fileupload

Examples of org.apache.commons.fileupload.RequestContext


    @SuppressWarnings("unchecked")
    public static Map<String, byte[]> parseMultipart(final RequestHeader header, final serverObjects args, final InputStream in) throws IOException {

        final InputStream body = prepareBody(header, in);
       
        RequestContext request = new yacyContextRequest(header, body);

        // check information
        if (!FileUploadBase.isMultipartContent(request)) {
            throw new IOException("the request is not a multipart-message!");
        }
       
        // check if we have enough memory
        if (!MemoryControl.request(request.getContentLength() * 3, false)) {
          throw new IOException("not enough memory available for request. request.getContentLength() = " + request.getContentLength() + ", MemoryControl.available() = " + MemoryControl.available());
        }

        // parse data in memory
        final FileUpload upload = new FileUpload(DISK_FILE_ITEM_FACTORY);
        final List<FileItem> items;
View Full Code Here


        upload.setSizeMax(ParameterSupport.maxRequestSize);
        upload.setFileSizeMax(ParameterSupport.maxFileSize);
        upload.setFileItemFactory(new DiskFileItemFactory(ParameterSupport.fileSizeThreshold,
            ParameterSupport.location));

        RequestContext rc = new ServletRequestContext(this.getServletRequest()) {
            @Override
            public String getCharacterEncoding() {
                String enc = super.getCharacterEncoding();
                return (enc != null) ? enc : Util.ENCODING_DIRECT;
            }
View Full Code Here

        // Create a new file upload handler
        ServletFileUpload upload = new ServletFileUpload(factory);
        upload.setSizeMax(-1);

        RequestContext rc = new ServletRequestContext(this.getServletRequest()) {
            public String getCharacterEncoding() {
                String enc = super.getCharacterEncoding();
                return (enc != null) ? enc : Util.ENCODING_DIRECT;
            }
        };
View Full Code Here

     *
     * @param req  the request.
     * @return a new request context.
     */
    private RequestContext createRequestContext(final HttpServletRequest req) {
  return new RequestContext() {
      public String getCharacterEncoding() {
    return req.getCharacterEncoding();
      }

      public String getContentType() {
View Full Code Here

     *
     * @param req the request.
     * @return a new request context.
     */
    private RequestContext createRequestContext(final HttpServletRequest req) {
        return new RequestContext() {
            public String getCharacterEncoding() {
                return req.getCharacterEncoding();
            }

            public String getContentType() {
View Full Code Here

    public String /*List<?>*/ parseRequest(HttpServletRequest request, SSOSubject authenticated)
      throws FileUploadException
    {
    try
    {
      RequestContext ctx = new ServletRequestContext(request);
        FileItemIterator iter = fileUpload.getItemIterator(ctx);
        //List<FileItem> items = new ArrayList<FileItem>();
        String filenames = "";
        String[] overrideFilenames = request.getParameterValues("overrideFilenames");
        String overrideFilename;
View Full Code Here

@Deprecated
public class FileUploadUtil {

    public static ResourceImpl processUpload(HttpServletRequest req)
            throws IOException, ServletException {
        RequestContext reqContext = new ServletRequestContext(req);
        boolean isMultipart = ServletFileUpload.isMultipartContent(reqContext);
        if (isMultipart) {
            ResourceImpl resource = new ResourceImpl();
            try {
                //Create a factory for disk-based file items
View Full Code Here

    this.algorithm = algorithm;
  }
 
  public List<FileItem> parseRequest(HttpRequest request)
      throws FileUploadException {
    RequestContext ctx = new HttpRequestContext(request);
      if (getFileItemFactory() == null) {
        setFileItemFactory(new DiskFileItemFactory());
      }
    return parseRequest(ctx);
    }
View Full Code Here

        String hasHotUpdate =
                (String) configContext.getAxisConfiguration().getParameterValue("hotupdate");
        req.setAttribute("hotDeployment", (hasHotDeployment.equals("true")) ? "enabled"
                : "disabled");
        req.setAttribute("hotUpdate", (hasHotUpdate.equals("true")) ? "enabled" : "disabled");
        RequestContext reqContext = new ServletRequestContext(req);

        boolean isMultipart = ServletFileUpload.isMultipartContent(reqContext);
        if (isMultipart) {

            try {
View Full Code Here

     *
     * @param req  the request.
     * @return a new request context.
     */
    private RequestContext createRequestContext(final HttpServletRequest req) {
        return new RequestContext() {
            public String getCharacterEncoding() {
                return req.getCharacterEncoding();
            }

            public String getContentType() {
View Full Code Here

TOP

Related Classes of org.apache.commons.fileupload.RequestContext

Copyright © 2018 www.massapicom. 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.