All,
Is this a bug or am I doing something wrong?
I want to, through Seam Remoting, get a whole chunk of HTML from my .war
WEB-INF. In that way, instead of refreshing the whole page, Seam Remoting would
dynamically update the page's contents while keeping the page's header,
navigation bar, etc (kind-of) 'static'.
I prefer saving this HTML in the WEB-INF rather than hardcoding it in the SLSB
or saving it in a database.
My Action and its interface:
| @Stateless
| @Name("homeAction")
| @Interceptors(SeamInterceptor.class)
| public class HomeAction implements Home {
|
| @In
| private FacesContext facesContext;
|
| private Logger logger;
|
| @PostConstruct
| public void init() {
| this.logger = Logger.getLogger(this.getClass());
| }
|
| public String getUploadPage() {
| try {
| String upload = TemplateReader.toString(facesContext
| .getExternalContext().getResourceAsStream(
| "WEB-INF/templates/upload.tmpl"));
| return upload;
| } catch (IOException e) {
| logger.error("Ikes!!!", e);
| return null;
| }
| }
|
| }
|
| @Local
| public interface Home {
|
| @WebRemote
| public String getUploadPage();
|
| }
|
This code is accessed through Seam Remote by using the following Javascript:
| <script type="text/javascript">
| function showUpload() {
|
SeamRemote.create("homeAction").getUploadPage(showUploadCallback);
| }
|
| function showUploadCallback(template) {
| document.getElementById("dynamic").innerHTML =
template;
| }
| </script>
|
A action button triggers the showUpload() function. Trying to do this gets me
the following exception:
| Caused by: org.jboss.seam.RequiredException: In attribute requires value
for component: homeAction.facesContext
| at org.jboss.seam.Component.getInstanceToInject(Component.java:1188)
| at org.jboss.seam.Component.injectFields(Component.java:859)
| at org.jboss.seam.Component.inject(Component.java:666)
| at
org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:30)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| at
org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
| at
org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at
org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:68)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| at
org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
| at
org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at
org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| at
org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
| at
org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at
org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| at
org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
| at
org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at
org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
| at
org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:120)
| at
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:62)
| at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| ... 47 more
|
Don't know if it will help but here is my web.xml:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <web-app version="2.4"
| xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
| <!-- Seam -->
|
| <listener>
| <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
| </listener>
|
| <servlet>
| <servlet-name>Seam Remoting</servlet-name>
|
<servlet-class>org.jboss.seam.remoting.SeamRemotingServlet</servlet-class>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>Seam Remoting</servlet-name>
| <url-pattern>/seam/remoting/*</url-pattern>
| </servlet-mapping>
|
| <!-- Propagate conversations across redirects -->
| <filter>
| <filter-name>Seam Redirect Filter</filter-name>
|
<filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
| </filter>
|
| <filter-mapping>
| <filter-name>Seam Redirect Filter</filter-name>
| <url-pattern>*.seam</url-pattern>
| </filter-mapping>
|
| <!-- 120 second conversation timeout -->
| <context-param>
|
<param-name>org.jboss.seam.core.manager.conversationTimeout</param-name>
| <param-value>120000</param-value>
| </context-param>
|
| <!-- Global JNDI name pattern for JBoss EJB3 (change for other servers)
-->
| <context-param>
| <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
| <param-value>rsys/#{ejbName}/local</param-value>
| </context-param>
|
| <!-- MyFaces -->
|
| <listener>
|
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
| </listener>
|
| <context-param>
| <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
| <param-value>client</param-value>
| </context-param>
|
| <context-param>
| <param-name>facelets.DEVELOPMENT</param-name>
| <param-value>true</param-value>
| </context-param>
|
| <context-param>
| <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
| <param-value>.xhtml</param-value>
| </context-param>
|
| <servlet>
| <servlet-name>Faces Servlet</servlet-name>
| <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
|
| <!-- My Faces Extensions Filter -->
| <filter>
| <filter-name>extensionsFilter</filter-name>
|
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
| <init-param>
| <param-name>uploadMaxFileSize</param-name>
| <param-value>100m</param-value>
| <!--
| <description>Set the size limit for uploaded files.
| Format: 10 - 10 bytes
| 10k - 10 KB
| 10m - 10 MB
| 1g - 1 GB
| </description>
| -->
| </init-param>
| <init-param>
| <param-name>uploadThresholdSize</param-name>
| <param-value>100k</param-value>
| <!--
| <description>Set the threshold size - files
| below this limit are stored in memory, files above
| this limit are stored on disk.
|
| Format: 10 - 10 bytes
| 10k - 10 KB
| 10m - 10 MB
| 1g - 1 GB
| </description>
| -->
| </init-param>
| <!--
| <init-param>
| <param-name>uploadRepositoryPath</param-name>
| <param-value>/temp</param-value>
| <description>Set the path where the intermediary files will be
stored.
| </description>
| </init-param>
| -->
| </filter>
|
| <filter-mapping>
| <filter-name>extensionsFilter</filter-name>
| <url-pattern>*.seam</url-pattern>
| </filter-mapping>
|
| <!-- MyFaces Tomahawk Library -->
|
| <context-param>
| <param-name>facelets.LIBRARIES</param-name>
| <param-value>/WEB-INF/tomahawk.taglib.xml</param-value>
| </context-param>
|
| <!-- Faces Servlet Mapping -->
|
| <servlet-mapping>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.seam</url-pattern>
| </servlet-mapping>
|
| <!-- JAAS-related configurations -->
|
| <security-constraint>
| <web-resource-collection>
| <web-resource-name>BackOffice</web-resource-name>
| <description>Segurança para áreas do
BackOffice</description>
| <url-pattern>/*</url-pattern>
| <http-method>POST</http-method>
| <http-method>GET</http-method>
| </web-resource-collection>
| <auth-constraint>
| <description>Somente usários do BackOffice pode acessar
esta área</description>
| <role-name>backoffice</role-name>
| </auth-constraint>
| </security-constraint>
|
| <login-config>
| <auth-method>FORM</auth-method>
| <realm-name>risk</realm-name>
| <form-login-config>
| <form-login-page>/login.jsp</form-login-page>
| <form-error-page>/loginError.jsp</form-error-page>
| </form-login-config>
| </login-config>
|
| <security-role>
| <description>O papel (grupo) do BackOffice</description>
| <role-name>backoffice</role-name>
| </security-role>
|
| </web-app>
|
I am using JBoss-4.0.4.RC2 and JBoss SEAM CVS20060418
TIA
Marcio
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3938289#3938289
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3938289
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user