/wui/branches/2.0
import org.apache.tapestry5.ioc.annotations.Value; |
import org.apache.tapestry5.services.Request; |
import org.apache.tapestry5.upload.services.UploadedFile; |
import org.linid.dm.wui.model.exception.InvalidPhotoFormatException; |
import org.linid.dm.wui.t5lib.services.JpegFileFormatChecker; |
|
public class PhotoEditor { |
|
/** |
* upload file |
* @throws InvalidPhotoFormatException |
*/ |
public void onSuccess() |
public void onSuccess() throws InvalidPhotoFormatException |
{ |
if(userUid!=null){ |
if (!checkFileFormat()) { |
throw new RuntimeException("Invalid format, JPEG expected"); |
throw new InvalidPhotoFormatException("Invalid format, JPEG expected"); |
} else { |
File copied = new File(photoDirectory,userUid+PHOTO_EXT); |
file.write(copied); |
package org.linid.dm.wui.model.exception; |
|
public class InvalidPhotoFormatException extends Exception { |
|
private static final long serialVersionUID = -4858649318595970856L; |
|
public InvalidPhotoFormatException() { |
super(); |
} |
|
public InvalidPhotoFormatException(String message, Throwable cause) { |
super(message, cause); |
} |
|
public InvalidPhotoFormatException(String message) { |
super(message); |
} |
|
public InvalidPhotoFormatException(Throwable cause) { |
super(cause); |
} |
} |