Thanks Brill, that solved my problem.
----- Original Message ---- From: Brill Pappin <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, July 7, 2008 10:11:37 PM Subject: Re: Getting Attributes from a Servlet using Wicket try request.getParameter(String)::String getAttribute (if I remember correctly) is an attribute of the session... if you want a parameter passed in via a GET or PORT then you need to use the parameter accessors. Also, I think there is a simpler method of getting access to the Wicket session. Search the forum for my name (about 2 months ago, I don't have it handy), although if Igor reads this he can fill in the details. - Brill Pappin On 7-Jul-08, at 7:19 PM, Giuliano Caliari wrote: > Hello, > > I have a flash application that makes a request to my server through > a servlet. > I have managed to get the servlet in the wicket context and access > the wicket session in the servlet, but I can't get the parameters of > the request. > Any clues of what I am doing wrong? > > Thank you > > Giuliano > > > > Here's my servlet: > > public class StwCommandRequest extends HttpServlet { > > @Override > protected void doPost(HttpServletRequest request, > HttpServletResponse response) throws ServletException, IOException { > ServletOutputStream out = response.getOutputStream(); > Object command2 = request.getAttribute("command"); > Object command = > AbismoWicketWebSession.get().getRequestAttribute(request, "command"); > //Do Stuff > StwController.processRequest(command, > AbismoWicketWebSession.get().getAbismoUser()); > out.print("result=1&msg=Looking"); > } > > @Override > protected void doGet(HttpServletRequest request, > HttpServletResponse response) throws ServletException, IOException { > this.doPost(request, response); > } > } > > > > > My Session: > > public class AbismoWicketWebSession extends WebSession { > private AbismoUser abismoUser; > > public AbismoWicketWebSession(Request request) { > super(request); > } > > public AbismoUser getAbismoUser() { > return abismoUser; > } > > public static AbismoWicketWebSession get() { > return (AbismoWicketWebSession) Session.get(); > } > > public Object getRequestAttribute(HttpServletRequest request, > String attributeName){ > // return getSessionStore().getAttribute(new > ServletWebRequest(request), attributeName); > > return this.getAttribute(attributeName); > } > > } > > > > and My web.xml > > > <?xml version="1.0" encoding="UTF-8"?> > <web-app xmlns="http://java.sun.com/xml/ns/javaee" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" > version="2.5"> > > <display-name>Abismo Server</display-name> > <filter> > <filter-name>AbismoServlets</filter-name> > <filter- > class>org.apache.wicket.protocol.http.servlet.WicketSessionFilter</ > filter-class> > <init-param> > <param-name>filterName</param-name> > <!-- expose the session of the input example app --> > <param-value>AbismoServer</param-value> > </init-param> > </filter> > <filter> > <filter-name>AbismoServer</filter-name> > <filter-class>org.apache.wicket.protocol.http.WicketFilter</ > filter-class> > <init-param> > <param-name>applicationFactoryClassName</param-name> > <param- > value>org.apache.wicket.spring.SpringWebApplicationFactory</param- > value> > </init-param> > </filter> > > <filter-mapping> > <filter-name>AbismoServer</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > <filter-mapping> > <filter-name>AbismoServlets</filter-name> > <url-pattern>/stw/*</url-pattern> > </filter-mapping> > > <context-param> > <param-name>contextConfigLocation</param-name> > <param-value>/WEB-INF/applicationContext.xml</param-value> > </context-param> > > <listener> > > <listener-class>org.springframework.web.context.request.RequestContextListener > > </listener-class> > </listener> > > <listener> > <listener-class>org.springframework.web.context.ContextLoaderListener > </listener-class> > </listener> > > <servlet> > <display-name>StwCommandsRequest</display-name> > <servlet-name>StwCommandRequest</servlet-name> > <servlet-class>StwCommandRequest</servlet-class> > </servlet> > <servlet-mapping> > <servlet-name>StwCommandRequest</servlet-name> > <url-pattern>/stw/*</url-pattern> > </servlet-mapping> > </web-app> > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
