Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Prompt file upload in bean plugin? #4137

JShelton ·

Is it possible to prompt for a file to be uploaded from a bean prompt plugin?

  • replies 4
  • views 46
  • stars 0
robinshen ADMIN ·

Please annotate appropriate getter method with "com.pmease.quickbuild.annotation.FileInput", for instance:

class Bean {
  private String file;

  @FileInput
  public String getFile() {
    return file;
  }
 
  public void setFile(String file) {
    this.file = file;
  }
}

The result will be path to uploaded file.

JShelton ·

Attempting to upload any type of file using bean prompt plugin gives a red error page with a java IllegalStateException on the first try, but going back in the browser and uploading again will succeed. Any tips on getting past this error legitimately, without browser workaround?

This appears to occur in Quickbuild 8 and 9.

CODE

@Editable(name="Manifest.zip", order=90)
public class Manifest implements AdvPromptOptions {
		
	private String manifestFile;
	
	@Editable
	@FileInput(fileTypes=".zip")
	public String getManifest() {
		return manifestFile;
	}
	
	public void setManifest(String manifestFile) {
		this.manifestFile = manifestFile;
	}
}

ERROR

Message: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at [ [Component id = form]] on component [ [Component id = form]] threw an exception

Root cause:

java.lang.IllegalStateException: ServletRequest does not contain multipart content. One possible solution is to explicitly call Form.setMultipart(true), Wicket tries its best to auto-detect multipart forms but there are certain situation where it cannot.
	 at org.apache.wicket.protocol.http.servlet.MultipartServletWebRequestImpl.<init>(MultipartServletWebRequestImpl.java:127)
	 at org.apache.wicket.protocol.http.servlet.MultipartServletWebRequestImpl.<init>(MultipartServletWebRequestImpl.java:90)
	 at org.apache.wicket.protocol.http.servlet.ServletWebRequest.newMultipartWebRequest(ServletWebRequest.java:389)
	 at org.apache.wicket.markup.html.form.Form.handleMultiPart(Form.java:1265)
	 at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:689)
	 at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:670)
	 at java.lang.reflect.Method.invoke(Unknown Source)
	 at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:272)
	 at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:220)
	 at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:179)
	 at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:165)
	 at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:719)
	 at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
	 at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
	 at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
	 at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
	 at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:159)
	 at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	 at com.pmease.quickbuild.web.MainServlet.service(MainServlet.java:135)
	 at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	 at org.eclipse.equinox.http.helper.FilterServletAdaptor$FilterChainImpl.doFilter(FilterServletAdaptor.java:56)
	 at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)
	 at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:365)
	 at org.eclipse.equinox.http.helper.FilterServletAdaptor.service(FilterServletAdaptor.java:37)
	 at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
	 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
	 at com.pmease.quickbuild.Quickbuild$DisableTraceFilter.doFilter(Quickbuild.java:1139)
	 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	 at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
	 at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
	 at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	 at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	 at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	 at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	 at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
	 at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	 at org.eclipse.jetty.server.Server.handle(Server.java:499)
	 at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
	 at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
	 at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
	 at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	 at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	 at java.lang.Thread.run(Unknown Source)
robinshen ADMIN ·

This works fine at my side. What browser are you using?

JShelton ·

Occurs in both Firefox and Chrome for me. Have disabled custom plugins to see if that may have been affecting it, but no luck.