• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MultipartRequestWrapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.struts.upload.MultipartRequestWrapper的典型用法代码示例。如果您正苦于以下问题:Java MultipartRequestWrapper类的具体用法?Java MultipartRequestWrapper怎么用?Java MultipartRequestWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MultipartRequestWrapper类属于org.apache.struts.upload包,在下文中一共展示了MultipartRequestWrapper类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processMultipart

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * <p>If this is a multipart request, wrap it with a special wrapper.
 * Otherwise, return the request unchanged.</p>
 *
 * @param request The HttpServletRequest we are processing
 */
protected HttpServletRequest processMultipart(HttpServletRequest request) {

    if (!"POST".equalsIgnoreCase(request.getMethod())) {
        return (request);
    }
    
    String contentType = request.getContentType();
    if ((contentType != null) &&
        contentType.startsWith("multipart/form-data")) {
        return (new MultipartRequestWrapper(request));
    } else {
        return (request);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:RequestProcessor.java


示例2: doInclude

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * <p>Do an include of specified URI using a <code>RequestDispatcher</code>.
 * This method is used by all internal method needing to do an include.</p>
 *
 * @param uri Context-relative URI to include
 * @param request Current page request
 * @param response Current page response
 * @since Struts 1.1
 */
protected void doInclude(
    String uri,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
        
    // Unwrap the multipart request, if there is one.
    if (request instanceof MultipartRequestWrapper) {
        request = ((MultipartRequestWrapper) request).getRequest();
    }

    RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
    if (rd == null) {
        response.sendError(
            HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
            getInternal().getMessage("requestDispatcher", uri));
        return;
    }
    rd.include(request, response);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:RequestProcessor.java


示例3: getAllParameters

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * すべてのパラメータを返します。
 * 
 * @param request
 *            リクエスト
 * @param multipartHandler
 *            マルチパートリクエストハンドラ
 * @return すべてのパラメータ
 */
@SuppressWarnings("unchecked")
protected Map<String, Object> getAllParameters(HttpServletRequest request,
        MultipartRequestHandler multipartHandler) {
    Map<String, Object> params = new HashMap<String, Object>();
    if (request instanceof MultipartRequestWrapper) {
        request = ((MultipartRequestWrapper) request).getRequest();
    }
    Enumeration e = request.getParameterNames();
    while (e.hasMoreElements()) {
        String name = (String) e.nextElement();
        params.put(name, request.getParameterValues(name));
    }
    if (multipartHandler != null) {
        Hashtable elements = multipartHandler.getAllElements();
        params.putAll(elements);
    }
    return params;
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:28,代码来源:S2RequestProcessor.java


示例4: testGetAllParameters

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * @throws Exception
 */
public void testGetAllParameters() throws Exception {
    MultipartRequestHandler multipartHandler = new CommonsMultipartRequestHandler() {

        @SuppressWarnings("unchecked")
        @Override
        public Hashtable getAllElements() {
            Hashtable elements = new Hashtable();
            elements.put("aaa", "111");
            return elements;
        }

    };
    getRequest().addParameter("bbb", "222");
    HttpServletRequest request = new MultipartRequestWrapper(getRequest());
    S2RequestProcessor processor = new S2RequestProcessor();
    Map<String, Object> params = processor.getAllParameters(request,
            multipartHandler);
    assertEquals("111", params.get("aaa"));
    assertEquals("222", ((String[]) params.get("bbb"))[0]);
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:24,代码来源:S2RequestProcessorTest.java


示例5: execute

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * Process the specified HTTP request, and create the corresponding HTTP
 * response (or forward to another web component that will create it).
 * Return an <code>ActionForward</code> instance describing where and how
 * control should be forwarded, or <code>null</code> if the response has
 * already been completed.
 *
 * @param mapping The ActionMapping used to select this instance
 * @param form The optional ActionForm bean for this request (if any)
 * @param request The HTTP request we are processing
 * @param response The HTTP response we are creating
 *
 * @exception Exception if an error occurs
 */
public ActionForward execute(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {

    // Create a RequestDispatcher the corresponding resource
    String path = mapping.getParameter();
    if (path == null) {
        throw new ServletException(messages.getMessage("include.path"));
    }

    RequestDispatcher rd =
        servlet.getServletContext().getRequestDispatcher(path);

    if (rd == null) {
        throw new ServletException(messages.getMessage("include.rd", path));
    }

    // Unwrap the multipart request, if there is one.
    if (request instanceof MultipartRequestWrapper) {
        request = ((MultipartRequestWrapper) request).getRequest();
    }

    // Forward control to the specified resource
    rd.include(request, response);

    // Tell the controller servlet that the response has been created
    return (null);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:47,代码来源:IncludeAction.java


示例6: getMultipartRequestWrapper

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * The multipart object for this request.
 */
public MultipartRequestWrapper getMultipartRequestWrapper() {

    if (this.request == null) {
        return null;
    }
    return (MultipartRequestWrapper) this.request.getAttribute(Globals.MULTIPART_KEY);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:ConfigHelper.java


示例7: doForward

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * <p>Do a forward to specified URI using a <code>RequestDispatcher</code>.
 * This method is used by all internal method needing to do a forward.</p>
 *
 * @param uri Context-relative URI to forward to
 * @param request Current page request
 * @param response Current page response
 * @since Struts 1.1
 */
protected void doForward(
    String uri,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
        
    // Unwrap the multipart request, if there is one.
    if (request instanceof MultipartRequestWrapper) {
        request = ((MultipartRequestWrapper) request).getRequest();
    }

    RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
    if (rd == null) {
        response.sendError(
            HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
            getInternal().getMessage("requestDispatcher", uri));
        return;
    }
    rd.forward(request, response);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:RequestProcessor.java


示例8: processMultipart

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * <p>If this is a multipart request, wrap it with a special wrapper.
 * Otherwise, return the request unchanged.</p>
 *
 * @param request The HttpServletRequest we are processing
 * @return Original or wrapped request as appropriate
 */
protected HttpServletRequest processMultipart(HttpServletRequest request) {
    if (!"POST".equalsIgnoreCase(request.getMethod())) {
        return (request);
    }

    String contentType = request.getContentType();

    if ((contentType != null)
        && contentType.startsWith("multipart/form-data")) {
        return (new MultipartRequestWrapper(request));
    } else {
        return (request);
    }
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:22,代码来源:ComposableRequestProcessor.java


示例9: getMultipartRequestWrapper

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * <p> The multipart object for this request. </p>
 */
public MultipartRequestWrapper getMultipartRequestWrapper() {
    if (this.request == null) {
        return null;
    }

    return (MultipartRequestWrapper) this.request.getAttribute(Globals.MULTIPART_KEY);
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:11,代码来源:ConfigHelper.java


示例10: processMultipart

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * <p>If this is a multipart request, wrap it with a special wrapper.
 * Otherwise, return the request unchanged.</p>
 *
 * @param request The HttpServletRequest we are processing
 * @return A wrapped request, if the request is multipart; otherwise the
 *         original request.
 */
protected HttpServletRequest processMultipart(HttpServletRequest request) {
    if (!"POST".equalsIgnoreCase(request.getMethod())) {
        return (request);
    }

    String contentType = request.getContentType();

    if ((contentType != null)
        && contentType.startsWith("multipart/form-data")) {
        return (new MultipartRequestWrapper(request));
    } else {
        return (request);
    }
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:23,代码来源:RequestProcessor.java


示例11: addTextParameter

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void addTextParameter(HttpServletRequest request, FileItem item) {
    String name = item.getFieldName();
    String value = null;
    boolean haveValue = false;
    String encoding = request.getCharacterEncoding();
    if (encoding != null) {
        try {
            value = item.getString(encoding);
            haveValue = true;
        } catch (Exception e) {
        }
    }
    if (!haveValue) {
        try {
            value = item.getString("ISO-8859-1");
        } catch (java.io.UnsupportedEncodingException uee) {
            value = item.getString();
        }
        haveValue = true;
    }
    if (request instanceof MultipartRequestWrapper) {
        MultipartRequestWrapper wrapper = (MultipartRequestWrapper) request;
        wrapper.setParameter(name, value);
    }
    String[] oldArray = (String[]) elementsText.get(name);
    String[] newArray;
    if (oldArray != null) {
        newArray = new String[oldArray.length + 1];
        System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
        newArray[oldArray.length] = value;
    } else {
        newArray = new String[] { value };
    }
    elementsText.put(name, newArray);
    elementsAll.put(name, newArray);
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:39,代码来源:S2MultipartRequestHandler.java


示例12: getMultipartRequestWrapper

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * The multipart object for this request.
 */
public MultipartRequestWrapper getMultipartRequestWrapper();
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ConfigHelperInterface.java


示例13: getMultipartRequestWrapper

import org.apache.struts.upload.MultipartRequestWrapper; //导入依赖的package包/类
/**
 * <p> The multipart object for this request. </p>
 */
public MultipartRequestWrapper getMultipartRequestWrapper();
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:5,代码来源:ConfigHelperInterface.java



注:本文中的org.apache.struts.upload.MultipartRequestWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FsSyncException类代码示例发布时间:2022-05-23
下一篇:
Java ModifyOperation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap