Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-03-06 Thread singh13
Hi, thanks for the reply. 

I tried that but unfortunately I still get the same error. Resetting it did
not alter anything.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-lang-IllegalStateException-Can-t-call-write-CharSequence-after-write-byte-has-been-called-tp4416819p4450786.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-03-05 Thread singh13
Hi, thanks for the reply.

I tried that but unfortunately I still get the same error.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-lang-IllegalStateException-Can-t-call-write-CharSequence-after-write-byte-has-been-called-tp4416819p4446728.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-03-04 Thread singh13
Sorry for another reply but can anybody give me an example solution.

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-lang-IllegalStateException-Can-t-call-write-CharSequence-after-write-byte-has-been-called-tp4416819p190.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-03-04 Thread Martin Grigorov
Hi,

Just try with:
WebResponse response = (WebResponse)getResponse();
response.reset();
OpenIDService.sendDiscoveryResponse(response);

On Sun, Mar 4, 2012 at 10:19 PM, singh13 gso...@gmail.com wrote:
 Sorry for another reply but can anybody give me an example solution.

 Thanks

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/java-lang-IllegalStateException-Can-t-call-write-CharSequence-after-write-byte-has-been-called-tp4416819p190.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-03-02 Thread singh13
I have looked at the DownloadLink class. Would you suggest that i use
something like this:
getRequestCycle().scheduleRequestHandlerAfterCurrent ?

I am passing my response to my discovery method as follows:

OpenIDService.sendDiscoveryResponse((WebResponse)getResponse());

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-lang-IllegalStateException-Can-t-call-write-CharSequence-after-write-byte-has-been-called-tp4416819p4438889.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-02-29 Thread singh13
Hi there,

I am not too sure what you mean about DownloadLink.

I am not using download link in any part of my code. To link to the provider
page i am just using a normal link.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-lang-IllegalStateException-Can-t-call-write-CharSequence-after-write-byte-has-been-called-tp4416819p4432697.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-02-29 Thread Pierre Goupil
Sure. But Martin is just telling you to use this as a code example.

Regards,

Pierre



On Wed, Feb 29, 2012 at 8:33 PM, singh13 gso...@gmail.com wrote:

 Hi there,

 I am not too sure what you mean about DownloadLink.

 I am not using download link in any part of my code. To link to the
 provider
 page i am just using a normal link.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/java-lang-IllegalStateException-Can-t-call-write-CharSequence-after-write-byte-has-been-called-tp4416819p4432697.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Si tu penses que la violence ne résout rien, c'est que tu n'as pas tapé
assez fort.


Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-02-29 Thread Martin Grigorov
On Wed, Feb 29, 2012 at 11:34 PM, Pierre Goupil goupilpie...@gmail.com wrote:
 Sure. But Martin is just telling you to use this as a code example.

Right. See how DownloadLink schedules a new IRequestHandler that cares
to deliver a file as a byte[].


 Regards,

 Pierre



 On Wed, Feb 29, 2012 at 8:33 PM, singh13 gso...@gmail.com wrote:

 Hi there,

 I am not too sure what you mean about DownloadLink.

 I am not using download link in any part of my code. To link to the
 provider
 page i am just using a normal link.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/java-lang-IllegalStateException-Can-t-call-write-CharSequence-after-write-byte-has-been-called-tp4416819p4432697.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Si tu penses que la violence ne résout rien, c'est que tu n'as pas tapé
 assez fort.



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-02-24 Thread singh13
Hi there I am using OpenID4java to implement an OpenID relying party and a
provider.

Whenever I try to access the provider page I get this exception in my
console 

java.lang.IllegalStateException: Can't call write(CharSequence) after
write(byte[]) has been called.

In this method I am creating an XRDS document to send to the relying party.
Could there be an issue with the outputstream

  public static void sendDiscoveryResponse(Response response) throws
IOException {
log.trace(sendDiscoveryResponse() BEGIN...);
WebResponse web = (WebResponse)response;
 web.setContentType(application/xrds+xml);
OutputStream outputStream = web.getOutputStream();
String xrdsResponse = OpenIDService.createXrdsResponse();
//
outputStream.write(xrdsResponse.getBytes());
outputStream.close();
log.trace(sendDiscoveryResponse() END...);
  }

The stack trace is below

Last cause: 0x706: GET failed on
http://localhost:8080/university/ProviderLogIn : 500
WicketMessage: Method onLinkClicked of interface
org.apache.wicket.markup.html.link.ILinkListener targeted at [ [Component id
= LogIn]] on component [ [Component id = LogIn]] threw an exception

Stacktrace

Root cause:

org.openid4java.discovery.yadis.YadisException: 0x706: GET failed on
http://localhost:8080/university/ProviderLogIn : 500
 at
org.openid4java.discovery.yadis.YadisResolver.retrieveXrdsLocation(YadisResolver.java:411)
 at
org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:252)
 at
org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:232)
 at
org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:166)
 at org.openid4java.discovery.Discovery.discover(Discovery.java:147)
 at org.openid4java.discovery.Discovery.discover(Discovery.java:129)
 at
org.openid4java.consumer.ConsumerManager.discover(ConsumerManager.java:542)
 at
com.university.RelyingPartyService.performDiscovery(RelyingPartyService.java:35)
 at com.university.SucessPage.init(SucessPage.java:64)
 at com.university.SucessPage.init(SucessPage.java:24)
 at com.university.MainPage$MainForm$1.onClick(MainPage.java:46)
 at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:188)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
 at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
 at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
 at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
 at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
 at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
 at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
 at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
 at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
 at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
 at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1326)
 at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
 at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
 at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
 at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
 at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
 at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
 at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
 at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
 at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
 at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
 at org.eclipse.jetty.server.Server.handle(Server.java:349)
 at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
 at
org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:904)
 at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:565)
 at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217

Re: java.lang.IllegalStateException: Can't call write(CharSequence) after write(byte[]) has been called.

2012-02-24 Thread Martin Grigorov
Hi,

Servlet specs do not allows to write both to the servletresponse's
outputstream and its writer.
In your code you write to the stream and later somewhere else (maybe
Wicket) writes to the writer.

See the code in DownloadLink to see how it writes the file bytes.
You cannot write your OpenID response together with Wicket page response.

On Fri, Feb 24, 2012 at 12:01 PM, singh13 gso...@gmail.com wrote:
 Hi there I am using OpenID4java to implement an OpenID relying party and a
 provider.

 Whenever I try to access the provider page I get this exception in my
 console

 java.lang.IllegalStateException: Can't call write(CharSequence) after
 write(byte[]) has been called.

 In this method I am creating an XRDS document to send to the relying party.
 Could there be an issue with the outputstream

          public static void sendDiscoveryResponse(Response response) throws
 IOException {
                    log.trace(sendDiscoveryResponse() BEGIN...);
                    WebResponse web = (WebResponse)response;
                     web.setContentType(application/xrds+xml);
                    OutputStream outputStream = web.getOutputStream();
                    String xrdsResponse = OpenIDService.createXrdsResponse();
                    //
                    outputStream.write(xrdsResponse.getBytes());
                    outputStream.close();
                    log.trace(sendDiscoveryResponse() END...);
                  }

 The stack trace is below

 Last cause: 0x706: GET failed on
 http://localhost:8080/university/ProviderLogIn : 500
 WicketMessage: Method onLinkClicked of interface
 org.apache.wicket.markup.html.link.ILinkListener targeted at [ [Component id
 = LogIn]] on component [ [Component id = LogIn]] threw an exception

 Stacktrace

 Root cause:

 org.openid4java.discovery.yadis.YadisException: 0x706: GET failed on
 http://localhost:8080/university/ProviderLogIn : 500
     at
 org.openid4java.discovery.yadis.YadisResolver.retrieveXrdsLocation(YadisResolver.java:411)
     at
 org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:252)
     at
 org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:232)
     at
 org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:166)
     at org.openid4java.discovery.Discovery.discover(Discovery.java:147)
     at org.openid4java.discovery.Discovery.discover(Discovery.java:129)
     at
 org.openid4java.consumer.ConsumerManager.discover(ConsumerManager.java:542)
     at
 com.university.RelyingPartyService.performDiscovery(RelyingPartyService.java:35)
     at com.university.SucessPage.init(SucessPage.java:64)
     at com.university.SucessPage.init(SucessPage.java:24)
     at com.university.MainPage$MainForm$1.onClick(MainPage.java:46)
     at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:188)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at
 org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
     at
 org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
     at
 org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
     at
 org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
     at
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
     at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
     at
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
     at
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
     at
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
     at
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
     at
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
     at
 org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1326)
     at
 org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
     at
 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
     at
 org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
     at
 org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
     at
 org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
     at
 org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
     at
 org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
     at
 org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
     at
 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
     at
 org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110