Package org.springframework.web.multipart

Examples of org.springframework.web.multipart.MultipartResolver


   *             if an unrecoverable error occurs.
   */
  public HttpServletRequest handleMultipartRequest(RequestWrapper request, ServletContext servletContext)
      throws HdivMultipartException {

    MultipartResolver multipartResolver = this.lookupMultipartResolver(servletContext);

    if (multipartResolver == null) {
      return request;
    }
    if (!(multipartResolver instanceof HdivCommonsMultipartResolver || multipartResolver instanceof HdivStandardServletMultipartResolver)) {
      throw new IllegalStateException(
          "In order to enable HDIV multipart processing, MultipartResolver must be of "
              + HdivCommonsMultipartResolver.class.getName() + " or "
              + HdivStandardServletMultipartResolver.class.getName() + " type.");
    }

    MultipartHttpServletRequest processedRequest = null;
    try {
      // Resolve multipart with the original request
      processedRequest = multipartResolver.resolveMultipart((HttpServletRequest) request.getRequest());

    } catch (MultipartException e) {

      throw new HdivMultipartException(e);
    }
View Full Code Here


   * @param request
   *            the request to cleanup resources for
   * @since HDIV 2.1.0
   */
  public void cleanupMultipart(HttpServletRequest request) {
    MultipartResolver multipartResolver = lookupMultipartResolver(request.getSession().getServletContext());

    if (multipartResolver != null) {
      MultipartHttpServletRequest req = WebUtils.getNativeRequest(request, MultipartHttpServletRequest.class);
      if (req != null) {
        multipartResolver.cleanupMultipart(req);
      }
    }

  }
View Full Code Here

   * @return MultipartResolver instance
   */
  @SuppressWarnings("rawtypes")
  protected MultipartResolver lookupMultipartResolver(ServletContext servletContext) {

    MultipartResolver resolver = null;

    if (this.webApplicationContext == null) {
      this.webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
    }

View Full Code Here

      }

      LOG.debug( "Registering the MultipartFilter with resolver bean {} for default DispatcherServlet",
                 resolverBeanName );

      MultipartResolver resolver = beanFactory.getBean( resolverBeanName, MultipartResolver.class );
      MultipartFilter multipartFilter = new AcrossMultipartFilter( resolver );
      beanFactory.registerSingleton( FILTER_NAME, multipartFilter );

      FilterRegistration.Dynamic registration = servletContext.addFilter( FILTER_NAME,
                                                                          multipartFilter );
View Full Code Here

  @Test
  public void containerWithCustomMulipartResolver() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext(
        ContainerWithCustomMultipartResolver.class, BaseConfiguration.class);
    MultipartResolver multipartResolver = this.context
        .getBean(MultipartResolver.class);
    assertThat(multipartResolver,
        not(instanceOf(StandardServletMultipartResolver.class)));
  }
View Full Code Here

  private String determineExistingResolverBeanName() {
    Map<String, MultipartResolver> existingResolvers = BeanFactoryUtils.beansOfTypeIncludingAncestors( beanFactory,
                                                                                                       MultipartResolver.class );

    if ( !existingResolvers.isEmpty() ) {
      MultipartResolver resolver = existingResolvers.get( DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME );

      String resolverBeanName = null;

      if ( resolver != null ) {
        resolverBeanName = MultipartFilter.DEFAULT_MULTIPART_RESOLVER_BEAN_NAME;
View Full Code Here

        }

    }

    private static MultipartResolver initMultipartResolver(ApplicationContext context) {
        MultipartResolver multipartResolver = (MultipartResolver) SpringUtils.getBean(context,
                MultipartResolver.class);
        if (multipartResolver != null) {
            if (logger.isDebugEnabled()) {
                logger.debug("Using MultipartResolver [" + multipartResolver + "]");
            }
View Full Code Here

TOP

Related Classes of org.springframework.web.multipart.MultipartResolver

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.