Re: Fileupload causes internet explorer 11 to hang

2014-07-15 Thread Sven Meier

Hi,

I've experienced strange problems with later IE versions, when they are 
forced to run under previous (i.e. non-edge) compatibility - up to the 
point that Ajax wasn't working at all :/.


A "X-UA-Compatible" response header is always safer to use than a meta 
tag, since the latter can/will be overwritten by IE depending on its 
settings and the position in the markup.


>now it works fine

Great!

Sven

On 07/16/2014 07:56 AM, ashindler wrote:

Hi Sven,

I added this to my code and now it works fine:

@Override
protected void setHeaders(WebResponse response)
{
response.setHeader("X-UA-Compatible", "IE=edge");
}

Thanks for pointing me in the right direction!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Fileupload-causes-internet-explorer-11-to-hang-tp419p422.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Fileupload causes internet explorer 11 to hang

2014-07-15 Thread ashindler
Hi Sven,

I added this to my code and now it works fine:

@Override
protected void setHeaders(WebResponse response) 
{  
response.setHeader("X-UA-Compatible", "IE=edge");
}

Thanks for pointing me in the right direction!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Fileupload-causes-internet-explorer-11-to-hang-tp419p422.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Fileupload causes internet explorer 11 to hang

2014-07-15 Thread ashindler
Hi Sven,

I am using 6.16.0.

Which X-UA-Compatible meta tag do you believe I should be using?

I tried with:



and



in the header but I still experienced the hanging.

Like I mentioned in chrome I experience no problems at all so I don't
believe it is a problem with my java code.

Regards,

Alex

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Fileupload-causes-internet-explorer-11-to-hang-tp419p421.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Fileupload causes internet explorer 11 to hang

2014-07-15 Thread Sven Meier

Hi,

which Wicket version? Are you using X-UA-Compatible meta tags?

Sven

On 07/15/2014 04:37 PM, ashindler wrote:

Hi,

I have the following code - with google chrome I experience no problems but
in internet explorer 11 the page hangs and gets stuck. I am using the latest
version of wicket.

Any ideas?

Code summary:

 Form uploadForm = new Form("uploadForm");
uploadForm.setMultiPart(true);
uploadForm.setMaxSize(Bytes.kilobytes(100));
uploadForm.add(fileUpload = new FileUploadField("fileUpload"));

uploadForm.add(new AjaxButton("upload", uploadForm){

@Override
public void onSubmit(AjaxRequestTarget target, Form 
uploadForm) {


final FileUpload uploadedFile = 
fileUpload.getFileUpload();
if (uploadedFile != null) {

// write to a new file
File newFile = new File(UPLOAD_FOLDER
+ 
uploadedFile.getClientFileName());

if (newFile.exists()) {
newFile.delete();
}

try {
newFile.createNewFile();
uploadedFile.writeTo(newFile);

}
catch (Exception e) {throw new 
IllegalStateException("Error");}
}


//Upload file to folder in my application
String dataFileName = ((WebApplication)
Application.get()).getServletContext().getRealPath("/")+"WEB-INF\\classes\\ums\\app\\TransitMemshak\\memshak.txt";

//Check if there is a file for upload
File myFile = new File(dataFileName);
if(!myFile.exists()){   
informationDialog.setMessage("There is no 
file to upload!");
informationDialog.show(target);
}

BufferedReader bReader;
try {

bReader = new BufferedReader(new 
FileReader(dataFileName));

String line;
while ((line = bReader.readLine()) != 
null) {

//upload file code and logic
etc here
}

bReader.close();

//Delete file
if(myFile.exists())
myFile.delete();

}

catch (FileNotFoundException e) 
{e.printStackTrace();}
catch (IOException e) {e.printStackTrace();}
catch (ClassNotFoundException e) 
{e.printStackTrace();}
catch (SQLException e) {e.printStackTrace();}

}
@Override
protected void onError(AjaxRequestTarget target, Form 
uploadForm) {

errorDialog.setErrors(CommonTasks.errorDisplay(target, uploadForm));
errorDialog.show(target);
}

});

add(uploadForm);

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Fileupload-causes-internet-explorer-11-to-hang-tp419.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




--

Fileupload causes internet explorer 11 to hang

2014-07-15 Thread ashindler
Hi,

I have the following code - with google chrome I experience no problems but
in internet explorer 11 the page hangs and gets stuck. I am using the latest
version of wicket. 

Any ideas?

Code summary:

Form uploadForm = new Form("uploadForm");   
uploadForm.setMultiPart(true);
uploadForm.setMaxSize(Bytes.kilobytes(100));
uploadForm.add(fileUpload = new FileUploadField("fileUpload"));

uploadForm.add(new AjaxButton("upload", uploadForm){

@Override
public void onSubmit(AjaxRequestTarget target, Form 
uploadForm) {


final FileUpload uploadedFile = 
fileUpload.getFileUpload();
if (uploadedFile != null) {
 
// write to a new file
File newFile = new File(UPLOAD_FOLDER
+ 
uploadedFile.getClientFileName());
 
if (newFile.exists()) {
newFile.delete();
}
 
try {
newFile.createNewFile();
uploadedFile.writeTo(newFile);
 
} 
catch (Exception e) {throw new 
IllegalStateException("Error");}
}


//Upload file to folder in my application
String dataFileName = ((WebApplication)
Application.get()).getServletContext().getRealPath("/")+"WEB-INF\\classes\\ums\\app\\TransitMemshak\\memshak.txt";

//Check if there is a file for upload
File myFile = new File(dataFileName);
if(!myFile.exists()){   
informationDialog.setMessage("There is 
no file to upload!");
informationDialog.show(target);
}

BufferedReader bReader;
try {

bReader = new BufferedReader(new 
FileReader(dataFileName));

String line;
while ((line = bReader.readLine()) != 
null) {

//upload file code and logic
etc here
}

bReader.close();

//Delete file
if(myFile.exists())
myFile.delete();

} 

catch (FileNotFoundException e) 
{e.printStackTrace();}
catch (IOException e) {e.printStackTrace();}
catch (ClassNotFoundException e) 
{e.printStackTrace();}
catch (SQLException e) {e.printStackTrace();}

}
@Override
protected void onError(AjaxRequestTarget target, Form 
uploadForm) {

errorDialog.setErrors(CommonTasks.errorDisplay(target, uploadForm));
errorDialog.show(target);
}

});

add(uploadForm);

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Fileupload-causes-internet-explorer-11-to-hang-tp419.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org