You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antonius Ng <an...@gmail.com> on 2009/09/19 12:11:59 UTC

Rest-plugin with Spring

Hi all,

I am currently developing an application using Struts 2.1.6 + rest-plugin +
spring-plugin + Spring 2.5.6.

The problem that I am facing is that I have not found any way to initialize
the Controller Actions from Spring, because the rest-plugin is built on the
Convention Plugin for automatic configuration of actions.

I have a Controller called com.x.y.z.controller.OrdersController.

The following is my struts.xml
<struts>
    <constant name="struts.objectFactory" value="spring" />
    <constant name="struts.devMode" value="false" />

    <!--  Overwrite Convention -->
    <constant name="struts.mapper.idParameterName" value="uniqueName"/>
    <constant name="struts.convention.action.suffix" value="Controller"/>
    <constant name="struts.convention.action.mapAllMatches" value="true"/>
    <constant name="struts.convention.default.parent.package"
value="rest-default"/>
    <constant name="struts.convention.package.locators" value="controller"/>
    <constant name="struts.convention.package.locators.basePackage"
value="com.x.y.z"/>
 </struts>

Is there anyway that I can initialize this Controller from Spring? Or
perhaps there is anything that I can add to my struts.xml file?

Thanks in advance,
Anton

RE: file download issue

Posted by Tarun Chowdhry <TC...@ipolicynetworks.com>.
Hi Paweł,
You are absolutely right. I was getting the return stream as null. This was so because my file name that I was passing to the getResourceAsStream(..) was not starting with a forward slash.
The path must begin with a "/" and is interpreted as relative to the current context root. This method returns null if no resource exists at the specified path. For example, using a path that doesn't start with a slash, You will get a null return value from:

ServletContext.getResourceAsStream("WEB-INF/resources/yourfilename.cnf").


THANKS A LOT AGAIN.


Kind Regards,
Tarun


-----Original Message-----
From: Paweł Wielgus [mailto:poulwiel@gmail.com]
Sent: Monday, October 19, 2009 4:30 PM
To: Struts Users Mailing List
Subject: Re: file download issue

Hi Tarun,
double check that this InputStream is valid,
i have such exception when i'm downloading not existing files.

Best greetings,
Paweł Wielgus.


2009/10/19 Tarun Chowdhry <TC...@ipolicynetworks.com>:
> Hi,
> Getting the following exception when trying to call the FileUpload code:
> Action class:
> import java.io.*;
> import com.opensymphony.xwork2.ActionSupport;
> import com.opensymphony.xwork2.Action;
> import org.apache.struts2.ServletActionContext;
>
>
>
>
> public class     extends ActionSupport{
>
>        private String filename;
>        public InputStream myStream;
>
>
>        public String getFilename(){
>                return filename;
>        }
>
>        public void setFilename(String u){
>                System.out.println("----------name set to " + u);
>                filename = u ;
>
>        }
>
>        public void setMyStream(InputStream i){
>                myStream = i;
>        }
>
>        public InputStream getMyStream(){
>
>                return ServletActionContext.getServletContext().getResourceAsStream(filename);
>        }
>
> }
>
> Configuration:
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
>
>
> <struts>
>
>        <constant name="struts.devMode" value="true" />
>
>
>        <package name="tarun" namespace="/" extends="struts-default">
>
>
>                <action name="filedownload">
>                        <result>filedownload.jsp</result>
>                </action>
>
>                <action name="startdownload" class="FileDownload">
>                        <result type="stream" name="success">
>                                <param name="inputName">myStream</param>
>                                <param name="contentType">application/octet-stream</param>
>                                <param name="contentDisposition">attachment;filename="lists.text"</param>
>                        </result>
>                </action>
>
>                <action name="login">
>                        <result>login.jsp</result>
>                </action>
>
>                <action name="loginSubmit" class="UserValidator">
>                        <result name="input">login.jsp</result>
>                        <result name="success">success.jsp</result>
>                </action>
>        </package>
>
> </struts>
>
>
>
>
> --------------------------------------------------------------------------------
>
> equest.
>
> exception
>
> javax.servlet.ServletException: Can not find a java.io.InputStream with the name [myStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
>        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
>        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)
>
>
> root cause
>
> java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [myStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
>        org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:189)
>        org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
>        com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
>        com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
>        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
>        org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
>        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:184)
>        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
>        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
>        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
>        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)
>
>
> note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
>
>
> --------------------------------------------------------------------------------
>
> Apache Tomcat/5.5.9
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: file download issue

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Tarun,
double check that this InputStream is valid,
i have such exception when i'm downloading not existing files.

Best greetings,
Paweł Wielgus.


2009/10/19 Tarun Chowdhry <TC...@ipolicynetworks.com>:
> Hi,
> Getting the following exception when trying to call the FileUpload code:
> Action class:
> import java.io.*;
> import com.opensymphony.xwork2.ActionSupport;
> import com.opensymphony.xwork2.Action;
> import org.apache.struts2.ServletActionContext;
>
>
>
>
> public class     extends ActionSupport{
>
>        private String filename;
>        public InputStream myStream;
>
>
>        public String getFilename(){
>                return filename;
>        }
>
>        public void setFilename(String u){
>                System.out.println("----------name set to " + u);
>                filename = u ;
>
>        }
>
>        public void setMyStream(InputStream i){
>                myStream = i;
>        }
>
>        public InputStream getMyStream(){
>
>                return ServletActionContext.getServletContext().getResourceAsStream(filename);
>        }
>
> }
>
> Configuration:
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
>
>
> <struts>
>
>        <constant name="struts.devMode" value="true" />
>
>
>        <package name="tarun" namespace="/" extends="struts-default">
>
>
>                <action name="filedownload">
>                        <result>filedownload.jsp</result>
>                </action>
>
>                <action name="startdownload" class="FileDownload">
>                        <result type="stream" name="success">
>                                <param name="inputName">myStream</param>
>                                <param name="contentType">application/octet-stream</param>
>                                <param name="contentDisposition">attachment;filename="lists.text"</param>
>                        </result>
>                </action>
>
>                <action name="login">
>                        <result>login.jsp</result>
>                </action>
>
>                <action name="loginSubmit" class="UserValidator">
>                        <result name="input">login.jsp</result>
>                        <result name="success">success.jsp</result>
>                </action>
>        </package>
>
> </struts>
>
>
>
>
> --------------------------------------------------------------------------------
>
> equest.
>
> exception
>
> javax.servlet.ServletException: Can not find a java.io.InputStream with the name [myStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
>        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
>        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)
>
>
> root cause
>
> java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [myStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
>        org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:189)
>        org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
>        com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
>        com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
>        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
>        org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
>        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:184)
>        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
>        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
>        com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
>        com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
>        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
>        org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
>        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
>        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)
>
>
> note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
>
>
> --------------------------------------------------------------------------------
>
> Apache Tomcat/5.5.9
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Rest-plugin with Spring

Posted by Antonius Ng <an...@gmail.com>.
Hi Sayantan,

Sure I can share it. I am not sure I am doing it the right way or not, but
here it is.

I created a new class that extends StrutsSpringObjectFactory:

public class RestSpringObjectFactory extends StrutsSpringObjectFactory {
...

Then I override the following method
public Object buildBean(Class clazz, Map<String, Object> extraContext)
throws Exception {
...
//Depending on how you name the bean in Spring applicationContext. If you
name the bean with the classname of the controller, you can do the following
String beanId = clazz.getName();

//Getting bean from Spring
o = appContext.getBean(    beanId     );
...
return o;
...

}

For details, you can refer to the code StrutsSpringObjectFactory. It is very
straightforward. Although I think there maybe a better way to achieve this.

For applicationContext.xml, there is really nothing special. It's just a
normal bean definition:
<bean id=...  class=.... scope="prototype"/>


Cheers,
Antonius

On Mon, Oct 19, 2009 at 12:25 PM, Sayantan Sinha <sa...@tcs.com>wrote:

>
> Hi Antonius,
>
> Thanks for your promp reply. Can you please share the code for the class
> RestSpringObjectFactory? Also, it would be great if you can share your
> applicationContext.xml (spring configuration) file.
>
> Also, please confirm is the spring injection working properly.
>
> Regards,
> Sayantan
>
>
> Antonius Ng-2 wrote:
> >
> > Hi Sayantan,
> >
> > This is how I do it. In struts.xml, I add the following line:
> > <constant name="struts.objectFactory"
> > value="com.sippku.rest.spring.RestSpringObjectFactory" />
> >
> > Cheers,
> > Antonius
> >
> >
> > On Sun, Oct 18, 2009 at 4:42 PM, Sayantan Sinha
> > <sa...@tcs.com>wrote:
> >
> >>
> >> Hi,
> >>
> >> How do you make your application read this new class
> >> RestSpringObjectFactory?
> >> Thanks in advance.
> >>
> >> Regards,
> >> Sayantan
> >>
> >>
> >> Antonius Ng-2 wrote:
> >> >
> >> > Hi again,
> >> >
> >> > I solve this problem by writing a new class: RestSpringObjectFactory
> >> which
> >> > extends StrutsSpringObjectFactory. In that class, i override the
> method
> >> > buildBean(Class clazz, Map<String, Object> extraContext)  to get bean
> >> from
> >> > appContext whenever the class is my controller class.
> >> >
> >> > Cheers,
> >> > Anton
> >> >
> >> > On Sat, Sep 19, 2009 at 5:11 PM, Antonius Ng <an...@gmail.com>
> >> wrote:
> >> >
> >> >> Hi all,
> >> >>
> >> >> I am currently developing an application using Struts 2.1.6 +
> >> rest-plugin
> >> >> +
> >> >> spring-plugin + Spring 2.5.6.
> >> >>
> >> >> The problem that I am facing is that I have not found any way to
> >> >> initialize
> >> >> the Controller Actions from Spring, because the rest-plugin is built
> >> on
> >> >> the
> >> >> Convention Plugin for automatic configuration of actions.
> >> >>
> >> >> I have a Controller called com.x.y.z.controller.OrdersController.
> >> >>
> >> >> The following is my struts.xml
> >> >> <struts>
> >> >>     <constant name="struts.objectFactory" value="spring" />
> >> >>     <constant name="struts.devMode" value="false" />
> >> >>
> >> >>     <!--  Overwrite Convention -->
> >> >>     <constant name="struts.mapper.idParameterName"
> >> value="uniqueName"/>
> >> >>     <constant name="struts.convention.action.suffix"
> >> value="Controller"/>
> >> >>     <constant name="struts.convention.action.mapAllMatches"
> >> >> value="true"/>
> >> >>     <constant name="struts.convention.default.parent.package"
> >> >> value="rest-default"/>
> >> >>     <constant name="struts.convention.package.locators"
> >> >> value="controller"/>
> >> >>     <constant name="struts.convention.package.locators.basePackage"
> >> >> value="com.x.y.z"/>
> >> >>  </struts>
> >> >>
> >> >> Is there anyway that I can initialize this Controller from Spring? Or
> >> >> perhaps there is anything that I can add to my struts.xml file?
> >> >>
> >> >> Thanks in advance,
> >> >> Anton
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Rest-plugin-with-Spring-tp25520270p25945240.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Rest-plugin-with-Spring-tp25520270p25953488.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

file download issue

Posted by Tarun Chowdhry <TC...@ipolicynetworks.com>.
Hi,
Getting the following exception when trying to call the FileUpload code:
Action class:
import java.io.*;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Action;
import org.apache.struts2.ServletActionContext;




public class 	 extends ActionSupport{

	private String filename;
	public InputStream myStream;


	public String getFilename(){
		return filename;
	}

	public void setFilename(String u){
		System.out.println("----------name set to " + u);
		filename = u ;

	}

	public void setMyStream(InputStream i){
		myStream = i;
	}

	public InputStream getMyStream(){

		return ServletActionContext.getServletContext().getResourceAsStream(filename);
	}

}

Configuration:
<?xml version="1.0" encoding="UTF-8" ?> 

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> 


<struts> 
	
	<constant name="struts.devMode" value="true" />
	
	
	<package name="tarun" namespace="/" extends="struts-default">


		<action name="filedownload">
			<result>filedownload.jsp</result>
		</action>
		
		<action name="startdownload" class="FileDownload">
			<result type="stream" name="success">
				<param name="inputName">myStream</param>
				<param name="contentType">application/octet-stream</param>
				<param name="contentDisposition">attachment;filename="lists.text"</param>
			</result>
		</action>

		<action name="login">
			<result>login.jsp</result>
		</action>
		
		<action name="loginSubmit" class="UserValidator">
			<result name="input">login.jsp</result>
			<result name="success">success.jsp</result>
		</action>			
	</package>

</struts>




--------------------------------------------------------------------------------

equest.

exception 

javax.servlet.ServletException: Can not find a java.io.InputStream with the name [myStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)


root cause 

java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [myStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
	org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:189)
	org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
	com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
	com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
	org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:184)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.9

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Rest-plugin with Spring

Posted by Sayantan Sinha <sa...@tcs.com>.
Hi Antonius,

Thanks for your promp reply. Can you please share the code for the class
RestSpringObjectFactory? Also, it would be great if you can share your
applicationContext.xml (spring configuration) file.

Also, please confirm is the spring injection working properly.

Regards,
Sayantan


Antonius Ng-2 wrote:
> 
> Hi Sayantan,
> 
> This is how I do it. In struts.xml, I add the following line:
> <constant name="struts.objectFactory"
> value="com.sippku.rest.spring.RestSpringObjectFactory" />
> 
> Cheers,
> Antonius
> 
> 
> On Sun, Oct 18, 2009 at 4:42 PM, Sayantan Sinha
> <sa...@tcs.com>wrote:
> 
>>
>> Hi,
>>
>> How do you make your application read this new class
>> RestSpringObjectFactory?
>> Thanks in advance.
>>
>> Regards,
>> Sayantan
>>
>>
>> Antonius Ng-2 wrote:
>> >
>> > Hi again,
>> >
>> > I solve this problem by writing a new class: RestSpringObjectFactory
>> which
>> > extends StrutsSpringObjectFactory. In that class, i override the method
>> > buildBean(Class clazz, Map<String, Object> extraContext)  to get bean
>> from
>> > appContext whenever the class is my controller class.
>> >
>> > Cheers,
>> > Anton
>> >
>> > On Sat, Sep 19, 2009 at 5:11 PM, Antonius Ng <an...@gmail.com>
>> wrote:
>> >
>> >> Hi all,
>> >>
>> >> I am currently developing an application using Struts 2.1.6 +
>> rest-plugin
>> >> +
>> >> spring-plugin + Spring 2.5.6.
>> >>
>> >> The problem that I am facing is that I have not found any way to
>> >> initialize
>> >> the Controller Actions from Spring, because the rest-plugin is built
>> on
>> >> the
>> >> Convention Plugin for automatic configuration of actions.
>> >>
>> >> I have a Controller called com.x.y.z.controller.OrdersController.
>> >>
>> >> The following is my struts.xml
>> >> <struts>
>> >>     <constant name="struts.objectFactory" value="spring" />
>> >>     <constant name="struts.devMode" value="false" />
>> >>
>> >>     <!--  Overwrite Convention -->
>> >>     <constant name="struts.mapper.idParameterName"
>> value="uniqueName"/>
>> >>     <constant name="struts.convention.action.suffix"
>> value="Controller"/>
>> >>     <constant name="struts.convention.action.mapAllMatches"
>> >> value="true"/>
>> >>     <constant name="struts.convention.default.parent.package"
>> >> value="rest-default"/>
>> >>     <constant name="struts.convention.package.locators"
>> >> value="controller"/>
>> >>     <constant name="struts.convention.package.locators.basePackage"
>> >> value="com.x.y.z"/>
>> >>  </struts>
>> >>
>> >> Is there anyway that I can initialize this Controller from Spring? Or
>> >> perhaps there is anything that I can add to my struts.xml file?
>> >>
>> >> Thanks in advance,
>> >> Anton
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Rest-plugin-with-Spring-tp25520270p25945240.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Rest-plugin-with-Spring-tp25520270p25953488.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Rest-plugin with Spring

Posted by Antonius Ng <an...@gmail.com>.
Hi Sayantan,

This is how I do it. In struts.xml, I add the following line:
<constant name="struts.objectFactory"
value="com.sippku.rest.spring.RestSpringObjectFactory" />

Cheers,
Antonius


On Sun, Oct 18, 2009 at 4:42 PM, Sayantan Sinha <sa...@tcs.com>wrote:

>
> Hi,
>
> How do you make your application read this new class
> RestSpringObjectFactory?
> Thanks in advance.
>
> Regards,
> Sayantan
>
>
> Antonius Ng-2 wrote:
> >
> > Hi again,
> >
> > I solve this problem by writing a new class: RestSpringObjectFactory
> which
> > extends StrutsSpringObjectFactory. In that class, i override the method
> > buildBean(Class clazz, Map<String, Object> extraContext)  to get bean
> from
> > appContext whenever the class is my controller class.
> >
> > Cheers,
> > Anton
> >
> > On Sat, Sep 19, 2009 at 5:11 PM, Antonius Ng <an...@gmail.com> wrote:
> >
> >> Hi all,
> >>
> >> I am currently developing an application using Struts 2.1.6 +
> rest-plugin
> >> +
> >> spring-plugin + Spring 2.5.6.
> >>
> >> The problem that I am facing is that I have not found any way to
> >> initialize
> >> the Controller Actions from Spring, because the rest-plugin is built on
> >> the
> >> Convention Plugin for automatic configuration of actions.
> >>
> >> I have a Controller called com.x.y.z.controller.OrdersController.
> >>
> >> The following is my struts.xml
> >> <struts>
> >>     <constant name="struts.objectFactory" value="spring" />
> >>     <constant name="struts.devMode" value="false" />
> >>
> >>     <!--  Overwrite Convention -->
> >>     <constant name="struts.mapper.idParameterName" value="uniqueName"/>
> >>     <constant name="struts.convention.action.suffix"
> value="Controller"/>
> >>     <constant name="struts.convention.action.mapAllMatches"
> >> value="true"/>
> >>     <constant name="struts.convention.default.parent.package"
> >> value="rest-default"/>
> >>     <constant name="struts.convention.package.locators"
> >> value="controller"/>
> >>     <constant name="struts.convention.package.locators.basePackage"
> >> value="com.x.y.z"/>
> >>  </struts>
> >>
> >> Is there anyway that I can initialize this Controller from Spring? Or
> >> perhaps there is anything that I can add to my struts.xml file?
> >>
> >> Thanks in advance,
> >> Anton
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Rest-plugin-with-Spring-tp25520270p25945240.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Rest-plugin with Spring

Posted by Sayantan Sinha <sa...@tcs.com>.
Hi,

How do you make your application read this new class
RestSpringObjectFactory?
Thanks in advance.

Regards,
Sayantan


Antonius Ng-2 wrote:
> 
> Hi again,
> 
> I solve this problem by writing a new class: RestSpringObjectFactory which
> extends StrutsSpringObjectFactory. In that class, i override the method
> buildBean(Class clazz, Map<String, Object> extraContext)  to get bean from
> appContext whenever the class is my controller class.
> 
> Cheers,
> Anton
> 
> On Sat, Sep 19, 2009 at 5:11 PM, Antonius Ng <an...@gmail.com> wrote:
> 
>> Hi all,
>>
>> I am currently developing an application using Struts 2.1.6 + rest-plugin
>> +
>> spring-plugin + Spring 2.5.6.
>>
>> The problem that I am facing is that I have not found any way to
>> initialize
>> the Controller Actions from Spring, because the rest-plugin is built on
>> the
>> Convention Plugin for automatic configuration of actions.
>>
>> I have a Controller called com.x.y.z.controller.OrdersController.
>>
>> The following is my struts.xml
>> <struts>
>>     <constant name="struts.objectFactory" value="spring" />
>>     <constant name="struts.devMode" value="false" />
>>
>>     <!--  Overwrite Convention -->
>>     <constant name="struts.mapper.idParameterName" value="uniqueName"/>
>>     <constant name="struts.convention.action.suffix" value="Controller"/>
>>     <constant name="struts.convention.action.mapAllMatches"
>> value="true"/>
>>     <constant name="struts.convention.default.parent.package"
>> value="rest-default"/>
>>     <constant name="struts.convention.package.locators"
>> value="controller"/>
>>     <constant name="struts.convention.package.locators.basePackage"
>> value="com.x.y.z"/>
>>  </struts>
>>
>> Is there anyway that I can initialize this Controller from Spring? Or
>> perhaps there is anything that I can add to my struts.xml file?
>>
>> Thanks in advance,
>> Anton
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Rest-plugin-with-Spring-tp25520270p25945240.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Rest-plugin with Spring

Posted by Antonius Ng <an...@gmail.com>.
Hi again,

I solve this problem by writing a new class: RestSpringObjectFactory which
extends StrutsSpringObjectFactory. In that class, i override the method
buildBean(Class clazz, Map<String, Object> extraContext)  to get bean from
appContext whenever the class is my controller class.

Cheers,
Anton

On Sat, Sep 19, 2009 at 5:11 PM, Antonius Ng <an...@gmail.com> wrote:

> Hi all,
>
> I am currently developing an application using Struts 2.1.6 + rest-plugin +
> spring-plugin + Spring 2.5.6.
>
> The problem that I am facing is that I have not found any way to initialize
> the Controller Actions from Spring, because the rest-plugin is built on the
> Convention Plugin for automatic configuration of actions.
>
> I have a Controller called com.x.y.z.controller.OrdersController.
>
> The following is my struts.xml
> <struts>
>     <constant name="struts.objectFactory" value="spring" />
>     <constant name="struts.devMode" value="false" />
>
>     <!--  Overwrite Convention -->
>     <constant name="struts.mapper.idParameterName" value="uniqueName"/>
>     <constant name="struts.convention.action.suffix" value="Controller"/>
>     <constant name="struts.convention.action.mapAllMatches" value="true"/>
>     <constant name="struts.convention.default.parent.package"
> value="rest-default"/>
>     <constant name="struts.convention.package.locators"
> value="controller"/>
>     <constant name="struts.convention.package.locators.basePackage"
> value="com.x.y.z"/>
>  </struts>
>
> Is there anyway that I can initialize this Controller from Spring? Or
> perhaps there is anything that I can add to my struts.xml file?
>
> Thanks in advance,
> Anton
>