You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Saskia Heesen <sa...@gmx.de> on 2006/08/31 21:16:11 UTC
Cookies in Javaflow
Hello all
I would like to read cookies in Java. However, I get a type mismatch or a cast exception. Here is my code:
import org.apache.cocoon.components.flow.java.AbstractContinuable;
import org.apache.cocoon.components.flow.java.VarMap;
import org.apache.cocoon.forms.flow.java.FormInstance;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Cookie;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.forms.formmodel.Field;
import org.apache.cocoon.environment.Response;
public class Cookie extends AbstractContinuable {
public void doCookie() {
FormInstance form = new FormInstance ("fields.xml");
Request request = getRequest();
Cookie[] cookies = request.getCookies();
In eclipse, I can't generate Java bytecode. I get the message: The import org.apache.cocoon.environment.Cookie conflicts with a type defined in the same file. How can I avoid the conflict?
I tried to use HttpCookie instead of Cookie. Then, there is a cast exception in this line:
HttpCookie[] cookies = (HttpCookie[]) request.getCookies();
Do you have any hint?
Thanks in advance.
Saskia
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cookies in Javaflow
Posted by Torsten Curdt <tc...@apache.org>.
> import org.apache.cocoon.environment.Cookie;
>
> public class Cookie extends AbstractContinuable {
>
> public void doCookie() {
...
> Cookie[] cookies = request.getCookies();
>
> In eclipse, I can't generate Java bytecode. I get the message: The import org.apache.cocoon.environment.Cookie conflicts with a type defined in the same file. How can I avoid the conflict?
This is a general java question.
Problem is that the "Cookie" you are referring to is the flow class
not the imported one you are after. Either use the full qualified name
or rename your flow class.
cheers
--
Torsten
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org