[JBoss Seam] - Servlet Emulation and Request content problem
by E6Fred
Hi,
I'm trying to emulate a servlet behavior with JSF and Seam.
The goal of this, is to expose an URL in my application to which I could post data using a simple HTML Form or an ESB.
I added the following in the pages.xml file :
<page view-id="/connect.xhtml" action="#{connector.doRequest}"/>
The HTML form I use to test this is as simple as :
<html>
| <body>
| <form name="myForm" action="http://localhost:8080/myApp/connect.faces" method="POST' enctype="multipart/form-data">
| <input type="file" name="myFile"/>
| <input type="submit"/>
| </form>
| </body>
| </html>
connector is a Stateless bean that exposes a doRequest method :
In this method, I'm trying to analyze the content of the http request that has been posted
public void doRequest(){
| FacesContext context = FacesContext.getCurrentInstance();
| HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
| System.out.println("contentlength = "+request.getContentLength())
| byte[] data = new byte[2048];
| int count;
| InputStream is = request.getInputStream();
| count = is.read(data,0,2048);
| while(count != -1){
| System.out.write(data,0,count);
| count = is.read(data,0,2048);
| }
| }
The 'request.getContentLength()' returns a value that seems to be correct (non-zero and approximately the size of the uploaded file)
but when I try to read the request content, the first 'is.read(data,0,2048)' call returns '-1' as if the stream was empty :(
I tried to add a SeamMultipartFilter but it didn't change anything
Do you think the way I proceed is able to work ?
Is there any configuration I could add somewhere to make things work ?
Thanks
Fred
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035378#4035378
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035378
19 years
[JBoss Seam] - Re: Multiple Domain Quesiton
by rjstanford
I agree - let me explain myself a little better. With this setup, there's effectively one control application that contains a large number of potentially useful URLs. The display sites, generated by the same app, contain a much smaller list of URLs.
When a non-control user (who doesn't even know that the control site exists) visits a random URL, ie: "http://theirsite.com/foo", they receive a 404 error. If they visit a URL that on the control site (ie: http://control.com/admin), that will return them an error message saying that they're not logged in - standard security practice. If they visit "http://theirsite.com/admin") though, even though to the app its a legitimate endpoint, I wish to present them with a 404 error since its not known to their URL.
One way to do this would be to have a test in the SecurityException (or however Seam security is best implemented) that normally redirects to the login page that consumes the exception and rethrows a page not found exception. That doesn't seem particularly "correct", per se, so I was curious as to whether there was a known, better solution.
Its not going to be quite as messy as it sounds, by the way - all of the domains will have the same structure as far as pages existing or not existing, with the exception of the "control" domain.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035377#4035377
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035377
19 years
[JBoss jBPM] - Re: 3.2 scheduler in ear
by brittm
I'm seeing this:
10:46:39,984 DEBUG [EjbSchedulerService] creating timer timer(myTimeout,10:46:39,983)
| ...
| 10:46:40,166 DEBUG [Services] executing default save operations
| 10:46:40,166 DEBUG [HibernateSaveOperation] saving process instance
| 10:46:40,166 DEBUG [SaveLogsOperation] flushing logs to logging service.
| 10:46:40,250 DEBUG [CascadeSaveOperation] cascading save of 'org.jbpm.graph.exe.ProcessInstance@462718'
| 10:46:40,267 DEBUG [JbpmContext] closing JbpmContext
| 10:46:40,267 DEBUG [Services] closing service 'persistence': org.jbpm.persistence.jta.JtaDbPersistenceService@be1539
| 10:46:40,268 DEBUG [DbPersistenceService] committing hibernate transaction
| 10:46:40,424 DEBUG [Services] closing service 'scheduler': org.jbpm.scheduler.ejbtimer.EjbSchedulerService@1731840
| 10:46:40,424 DEBUG [EjbSchedulerService] removing the timer service session bean
| 10:46:40,425 DEBUG [Services] closing service 'tx': org.jbpm.tx.TxService@13d2b1c
| 10:46:40,425 DEBUG [Services] closing service 'logging': org.jbpm.logging.db.DbLoggingService@d97a79
| 10:46:40,425 DEBUG [Services] closing service 'authentication': org.jbpm.security.authentication.DefaultAuthenticationService@1f7d5c3
|
But from TimerServiceBean.ejbTimeout() I'm never seeing this happen:
log.debug("ejb timer "+ejbTimer+" fires");
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035375#4035375
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035375
19 years