[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-users] ClassCastException of Response to Response
|
I'd like to set the HttpOnly flag on a cookie, so I tried creating a
org.eclipse.jetty.http.HttpCookie, but then I need to cast the
HttpServletResponse that the doGet gets to a
org.eclipse.jetty.server.Response so that I can call addCookie with that
class of cookie.
((org.eclipse.jetty.server.Response) resp).addCookie(ck);
That gives me a ClassCastException, even though it looks like the object
is the right class. I assumed it is because the ClassLoader at the
server level is not the same as at the servlet, but when I tried setting
parentLoaderPriority it didn't help.
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.1.4.v20100610</version>
<configuration>
<webAppConfig>
<parentLoaderPriority>true</parentLoaderPriority>
I tried both true and false.
I have a workaround using reflection, but it is obviously not the right
thing to do. What is the right way to call a method on a
org.eclipse.jetty.server.Response?