You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ove Ranheim <Ov...@fikse.net> on 2002/10/04 16:25:41 UTC
[1.1 b2] How to manage the struts-config programatically?
How to manage the struts-config programatically. I tried both 1.1 beta 2
and the nightly build 20021004.
In my TestPlugin I write;
public void init(ActionServlet servlet, ApplicationConfig config)
throws ServletException
{
ActionConfig ac = null;
ForwardConfig fc = null;
ac = new ActionConfig();
ac.setPath( "/articles" );
ac.setForward( "/layout/main.jsp" );
config.addActionConfig( ac );
fc = new ForwardConfig("articles", "/articles.do", false);
config.addForwardConfig( fc );
ac = new ActionConfig();
ac.setPath( "/sections" );
ac.setForward( "/layout/main.jsp" );
config.addActionConfig( ac );
fc = new ForwardConfig("sections", "/sections.do", false);
config.addForwardConfig( fc );
}
When addressing http://localhost:8080/test/sections.do an exception is
thrown;
16:12:58,015 WARN [jbossweb] WARNING: Exception for /test/articles.do
java.lang.ClassCastException
at
org.apache.struts.action.RequestProcessor.processMapping(RequestProcesso
r.java:632)
at
org.foss.framework.web.admin.SiteRequestProcessor.processMapping(SiteReq
uestProcessor.java:33)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
232)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH
andler.java:284)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:577)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1674)
at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon
text.java:544)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1624)
at org.mortbay.http.HttpServer.service(HttpServer.java:875)
at org.jboss.jetty.Jetty.service(Jetty.java:541)
at
org.mortbay.http.HttpConnection.service(HttpConnection.java:785)
at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:935)
at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:802)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:200
)
at
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:294)
at
org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
at java.lang.Thread.run(Thread.java:536)
- Ove Ranheim
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [1.1 b2] How to manage the struts-config programatically?
Posted by Eddie Bush <ek...@swbell.net>.
No offense here - serious question: Why not just use the config file
and let the action servlet load it?
Ove Ranheim wrote:
>How to manage the struts-config programatically. I tried both 1.1 beta 2
>and the nightly build 20021004.
>
>In my TestPlugin I write;
>
--
Eddie Bush
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [1.1 b2] How to manage the struts-config programatically?
Posted by "Craig R. McClanahan" <cr...@apache.org>.
For backwards compatibility with 1.0, RequestProcessor assumes that your
ActionConfig objects are really ActionMapping objects instead (which is a
subclass of ActionConfig in 1.1). If you change your class names like
this:
* ActionConfig --> ActionMapping
* ForwardConfig --> ActonForward
Things will probably work better.
I'd also be quite interested in the background of what kinds of
dynamic configuration you're doing -- sounds intriguing.
Craig
On Fri, 4 Oct 2002, Ove Ranheim wrote:
> Date: Fri, 4 Oct 2002 16:25:41 +0200
> From: Ove Ranheim <Ov...@fikse.net>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: [1.1 b2] How to manage the struts-config programatically?
>
>
> How to manage the struts-config programatically. I tried both 1.1 beta 2
> and the nightly build 20021004.
>
> In my TestPlugin I write;
>
> public void init(ActionServlet servlet, ApplicationConfig config)
> throws ServletException
> {
>
> ActionConfig ac = null;
> ForwardConfig fc = null;
>
> ac = new ActionConfig();
> ac.setPath( "/articles" );
> ac.setForward( "/layout/main.jsp" );
> config.addActionConfig( ac );
>
> fc = new ForwardConfig("articles", "/articles.do", false);
> config.addForwardConfig( fc );
>
> ac = new ActionConfig();
> ac.setPath( "/sections" );
> ac.setForward( "/layout/main.jsp" );
> config.addActionConfig( ac );
>
> fc = new ForwardConfig("sections", "/sections.do", false);
> config.addForwardConfig( fc );
> }
>
> When addressing http://localhost:8080/test/sections.do an exception is
> thrown;
>
> 16:12:58,015 WARN [jbossweb] WARNING: Exception for /test/articles.do
> java.lang.ClassCastException
> at
> org.apache.struts.action.RequestProcessor.processMapping(RequestProcesso
> r.java:632)
> at
> org.foss.framework.web.admin.SiteRequestProcessor.processMapping(SiteReq
> uestProcessor.java:33)
> at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
> 232)
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
> at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
> at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH
> andler.java:284)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:577)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1674)
> at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon
> text.java:544)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1624)
> at org.mortbay.http.HttpServer.service(HttpServer.java:875)
> at org.jboss.jetty.Jetty.service(Jetty.java:541)
> at
> org.mortbay.http.HttpConnection.service(HttpConnection.java:785)
> at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:935)
> at
> org.mortbay.http.HttpConnection.handle(HttpConnection.java:802)
> at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:200
> )
> at
> org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:294)
> at
> org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
> at java.lang.Thread.run(Thread.java:536)
>
>
> - Ove Ranheim
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>