Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9099867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:43:35+00:00 2026-06-17T00:43:35+00:00

I have a file upload applet in my jsf page. This applet expects an

  • 0

I have a file upload applet in my jsf page. This applet expects an adress where it can send it’s POST request. (I can’t edit this post request to add more fields or something). The post method of my servlet then stores the file. This job can’t be done by a managed bean because the servlet has to be annotated with @MultiPartConfig and I can’t add this annotation to the jsf managed bean. In order to force the upload applet to use the same session I added an URL attribute named jsessionId to the post request according to this topic. Now whenever I try to upload more than one file during a session the applet stops with the error message “The regexp string “^SUCCESS$” was not found in the response body” this is because the applet expects this string in the servlets response in order to know that the upload was successfull.

When I view the debug code of the applet the response contains a lot of html code but not this success string altough I add it in my Servlet code. Here’s the code of my servlet :

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.reset();
    if (!userBean.getUploadedDatasets().isEmpty()) {
        String datasetID = userBean.getUploadedDatasets().getLast().replaceAll("/", "%2F");
        response.sendRedirect(response.encodeRedirectURL("http://____________/faces/details.xhtml?id="+datasetID));
    }
}

/**
 * Handles the HTTP
 * <code>POST</code> method.
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response){
    PrintWriter out = null;
    try {
        Part filePart = request.getPart("item");
        InputStream filecontent = filePart.getInputStream();
        String datasetID = repBean.persistDataset(filecontent, uploadBean.getFolder());
        userBean.getUploadedDatasets().add(datasetID);
        out = response.getWriter();
        out.println("SUCCESS");
    } catch (ServletException ex) {
        Logger.getLogger(RequestHandler.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(RequestHandler.class.getName()).log(Level.SEVERE, null, ex);
    }finally{
        out.close();
    }
}

the doGet method is used as afterUploadURL by the applet (so that’s the url to which is jumped after a file is uploaded)

the applet code is :

          <APPLET
           CODE="wjhk.jupload2.JUploadApplet"
           NAME="JUpload"
           ARCHIVE="wjhk.jupload.jar"
           WIDTH="640"
           HEIGHT="300"
           MAYSCRIPT="true"
           ALT="The java pugin must be installed.">
           <param name="postURL" value="http://________________/request;jsessionid=#{session.id}" />
           <!-- Optionnal, see code comments -->
           <param name="showLogWindow" value="false" />
           <param name="debugLevel" value="99" />
           <param name="httpUploadParameterName" value="item" />
           <param name="nbFilesPerRequest" value="1" />
           <param name="httpUploadParameterType" value="oneFile" />
           <param name="afterUploadURL" value="http://________________/request" />
          </APPLET>

and after trying to upload a second file, the “old” (that’s what I think but I don’t know enough about servlets) response looks like this : http://pastebin.ca/2300999
(too many characters so I had to upload it there)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T00:43:36+00:00Added an answer on June 17, 2026 at 12:43 am

    Your problem is caused because the servlet is sending a redirect on GET (and implicitly also HEAD) request. The following part of the log contains relevant information:

    00064   13:44:42.482      HttpProtocolFinderThread     [DEBUG]      Getting serverProtocol from HEAD request
    00065   13:44:42.485      HttpProtocolFinderThread     [DEBUG]      Checking protocol with URL: http://___________________:8080/application1/request;jsessionid=47440f88e532021656b3724eea33
    00066   13:44:42.501      HttpProtocolFinderThread     [DEBUG]      [initByteArrayEncoder] proxy=DIRECT, proxy.type=DIRECT, useProxy=false, url.host=___________________, url.port=8080
    00067   13:44:42.501      HttpProtocolFinderThread     [DEBUG]      [onAppendHeader] Start
    00068   13:44:42.502      HttpProtocolFinderThread     [DEBUG]      [onAppendHeader] Header appended; Cookie: __utma=132868616.170774110.1354796930.1356109339.1356547898.3; __utmz=132868616.1356547898.3.3.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)
    00069   13:44:42.509      HttpProtocolFinderThread     [DEBUG]      [onAppendHeader] Header appended; User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0
    00070   13:44:42.510      HttpProtocolFinderThread     [DEBUG]      [onAppendHeader] End
    00071   13:44:42.510      HttpProtocolFinderThread     [DEBUG]      [HTTPConnectionHelper append]
    00072   13:44:42.511      HttpProtocolFinderThread     [DEBUG]      Before sendRequest()
    00073   13:44:42.511      HttpProtocolFinderThread     [DEBUG]      Using non SSL socket, direct connection
    00074   13:44:42.538      HttpProtocolFinderThread     [DEBUG]      After sendRequest()
    00075   13:44:42.538      HttpProtocolFinderThread     [DEBUG]      -------------------------------------------------------------------------
    00076   13:44:42.538      HttpProtocolFinderThread     [DEBUG]      -----------------   HEAD message sent (start)  --------------------------
    00077   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      -------------------------------------------------------------------------
    00078   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      HEAD /application1/request;jsessionid=47440f88e532021656b3724eea33 HTTP/1.1
    00078   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      Host: ___________________:8080
    00078   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      Accept: */*
    00078   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      Accept-Encoding: identity
    00078   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      Connection: close
    00078   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      Cookie: __utma=132868616.170774110.1354796930.1356109339.1356547898.3; __utmz=132868616.1356547898.3.3.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)
    00078   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0
    00078   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      
    00079   13:44:42.539      HttpProtocolFinderThread     [DEBUG]      -------------------------------------------------------------------------
    00080   13:44:42.540      HttpProtocolFinderThread     [DEBUG]      -----------------   HEAD message sent (end) -----------------------------
    00081   13:44:42.540      HttpProtocolFinderThread     [DEBUG]      -------------------------------------------------------------------------
    00082   13:44:42.548      HttpProtocolFinderThread     [DEBUG]      -------- Response Headers Start --------
    00083   13:44:42.556      HttpProtocolFinderThread     [DEBUG]      HTTP/1.1 302 Moved Temporarily
    00084   13:44:42.558      HttpProtocolFinderThread     [DEBUG]      Location: http://___________________:8080/application1/faces/details.xhtml;jsessionid=47440f88e532021656b3724eea33?id=%2F37ded64f-f2c9-4b90-99ea-79c34eb140e5
    00085   13:44:42.559      HttpProtocolFinderThread     [DEBUG]      Content-Type: text/html;charset=ISO-8859-1
    00086   13:44:42.566      HttpProtocolFinderThread     [DEBUG]      Content-Language: de-DE
    00087   13:44:42.578      HttpProtocolFinderThread     [DEBUG]      Content-Length: 306
    00088   13:44:42.578      HttpProtocolFinderThread     [DEBUG]      Date: Thu, 10 Jan 2013 12:44:42 GMT
    00089   13:44:42.579      HttpProtocolFinderThread     [DEBUG]      Connection: close
    00090   13:44:42.579      HttpProtocolFinderThread     [DEBUG]      
    00091   13:44:42.580      HttpProtocolFinderThread     [DEBUG]      --------- Response Headers End ---------
    00092   13:44:42.580      HttpProtocolFinderThread     [DEBUG]      This is a HEAD request: we don't care about the bytearrayResponseBody
    00093   13:44:42.584      HttpProtocolFinderThread     [DEBUG]      HEAD status: 302
    00094   13:44:42.585      HttpProtocolFinderThread     [DEBUG]      HEAD protocol: HTTP/1.1
    00095   13:44:42.586      HttpProtocolFinderThread     [DEBUG]      Location read: http://___________________:8080/application1/faces/details.xhtml;jsessionid=47440f88e532021656b3724eea33?id=%2F37ded64f-f2c9-4b90-99ea-79c34eb140e5
    00096   13:44:42.594      HttpProtocolFinderThread     [INFO]       postURL switched from http://___________________:8080/application1/request;jsessionid=47440f88e532021656b3724eea33 to http://___________________:8080/application1/faces/details.xhtml;jsessionid=47440f88e532021656b3724eea33?id=%2F37ded64f-f2c9-4b90-99ea-79c34eb140e5
    

    The applet is basically testing the availability of postURL by a HEAD request and once determined that it’s been redirected, it’s using the redirected URL as new postURL (as per the last line of the copypasted log). However, the redirected URL is pointing to a JSF page which returns a whole bunch of HTML.

    You need to fix your doGet() that it doesn’t perform a redirect, or to add a doHead() which returns effectively nothing. As a HEAD is per the HTTP specification basically a GET without a response body, the default doHead() implementation delegates to the doGet() and discards the response body. Overriding the doHead() should prevent it from delegating to doGet().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background information: I have a file upload applet in my jsf page. This applet
In the web page, I have file upload widget. I need to show this
I have a file upload control <input id=File1 type=file /> in my page... How
I have developed an signed applet that is used to upload a file in
I have created a JSP code where we can upload a .csv file. The
Can someone please show me/link a simple multipart form data, http post file upload
I have a file upload page that takes a file and parses it. Order
I have a file upload application. I want to test my Upload controller. For
I have a GWT screen in which i have a file upload bar,whenever i
I have a HTML file upload field from which I'm reading the file name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.