org.apache.wicket.util.lang.Bytes Java Examples

The following examples show how to use org.apache.wicket.util.lang.Bytes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeParser.java    From wicket-spring-boot with Apache License 2.0 5 votes vote down vote up
public static Bytes parse(Long size, SessionUnit sessionUnit){
	switch(sessionUnit){
	case BYTES:
		return Bytes.bytes(size);
	case KILOBYTES:
		return Bytes.kilobytes(size);
	case MEGABYTES:
		return Bytes.megabytes(size);
	case TERABYTES:
		return Bytes.terabytes(size);
	}
	throw new WicketSpringBootException("Could not parse size with session unit " + size + " " + sessionUnit);
}
 
Example #2
Source File: MyPictures.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public FileUploadForm(String id, String userUuid, FeedbackPanel fileFeedback) {
	super(id);

	this.userUuid = userUuid;
	this.fileFeedback = fileFeedback;

	// set form to multipart mode
	setMultiPart(true);

	setMaxSize(Bytes.megabytes(sakaiProxy.getMaxProfilePictureSize()
			* ProfileConstants.MAX_GALLERY_FILE_UPLOADS));
}
 
Example #3
Source File: CSVPullWizardBuilder.java    From syncope with Apache License 2.0 5 votes vote down vote up
public CSVPullWizardBuilder(final CSVPullSpec defaultItem, final PageReference pageRef) {
    super(defaultItem, pageRef);

    this.maxUploadSize = SyncopeWebApplication.get().getMaxUploadFileSizeMB() == null
            ? null
            : Bytes.megabytes(SyncopeWebApplication.get().getMaxUploadFileSizeMB());
}
 
Example #4
Source File: MyPictures.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public FileUploadForm(String id, String userUuid, FeedbackPanel fileFeedback) {
	super(id);

	this.userUuid = userUuid;
	this.fileFeedback = fileFeedback;

	// set form to multipart mode
	setMultiPart(true);

	setMaxSize(Bytes.megabytes(sakaiProxy.getMaxProfilePictureSize()
			* ProfileConstants.MAX_GALLERY_FILE_UPLOADS));
}
 
Example #5
Source File: LicenseErrorPage.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public UploadLicenseForm(String id) {
	super(id);
	
	// set this form to multipart mode (allways needed for uploads!)
          setMultiPart(true);

          // add one file input field
          add(fileUploadField = new FileUploadField("fileInput"));

          // set maximum size to 100K
          setMaxSize(Bytes.kilobytes(100));
}
 
Example #6
Source File: HttpResourceStream.java    From syncope with Apache License 2.0 4 votes vote down vote up
@Override
public Bytes length() {
    return responseHolder.getInputStream() == null
            ? Bytes.bytes(0)
            : null;
}
 
Example #7
Source File: SetupImportForm.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
public SetupImportForm(final SetupPage parentPage)
{
  super(parentPage, "importform");
  initUpload(Bytes.megabytes(100));
  csrfTokenHandler = new CsrfTokenHandler(this);
}
 
Example #8
Source File: ScriptingForm.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
public ScriptingForm(final ScriptingPage parentPage)
{
  super(parentPage);
  initUpload(Bytes.megabytes(1));
}
 
Example #9
Source File: ScriptEditForm.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
public ScriptEditForm(final ScriptEditPage parentPage, final ScriptDO data)
{
  super(parentPage, data);
  initUpload(Bytes.megabytes(1));
}
 
Example #10
Source File: ReportObjectivesForm.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
public ReportObjectivesForm(final ReportObjectivesPage parentPage)
{
  super(parentPage);
  initUpload(Bytes.megabytes(10));
}
 
Example #11
Source File: ByteArrayResourceStream.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Bytes length()
{
  return Bytes.bytes(content.length);
}
 
Example #12
Source File: AbstractForm.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
protected void initUpload(final Bytes maxSize)
{
  // set this form to multipart mode (always needed for uploads!)
  setMultiPart(true);
  setMaxSize(maxSize);
}
 
Example #13
Source File: AbstractImportForm.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
public AbstractImportForm(final P parentPage)
{
  super(parentPage);
  initUpload(Bytes.megabytes(10));
  importFilter = new ImportFilter();
}
 
Example #14
Source File: ByteArrayResourceStream.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
@Override
public Bytes length() {
    return Bytes.bytes(content.length);
}