Re: [Wicket-user] Output Stream Encoding
ahh ofcourse the problem is that the browser doesn't sent the encoding back to the serverin which it does sent the data.That is a problem yes. Because then you need to remember per session (== browser)what kind of encoding you did set. And use that again. (also in the WicketServlet.doGet())But i think the best thing is to use UTF-8 all the way. Why people want to use another encoding i don't know.johanOn 9/6/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: see http://www.wicket-wiki.org.uk/wiki/index.php/Markup_encoding and http://www.crazysquirrel.com/computing/general/form-encoding.jspxJuergenOn 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote:> what could cause problems then? It should work i think, He wants to look > what the> browser sent it under accept encoding and use that encoding if possible> else use the normal default (utf-8)>>> On 9/6/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote:> >> but this is exactly what caused the problems as far as I remember. I'm> not a encodings expert, but does UTF-8 not support JIS characters?> > Juergen>> On 9/6/06, Johan Compagner < [EMAIL PROTECTED]> wrote:> > i think that is a global default..> >> > He does want to set the encoding based on the current request. > > See my previous reply.> >> >> > johan> >> >> >> > On 9/6/06, Juergen Donnerstag <[EMAIL PROTECTED] > wrote:> > >> > you may remember that we lots of issues before we did that because> > browsers behave differently. If someone would search the mail archive> > for wicket, there were some links to articles which nicely described > > the issues associated.> >> >> > >> It is already implemented The default is UTF-8 and can be configured> > >> via> >> getRequestCycleSettings().setResponseRequestEncoding(String) > > >> > >> > >I do not want to use the default. I want to set the default> > endcoding. I do not want > Wicket to set the default. I want Wicket to> > use what I set. > >> > "I don't want to use the default" => ok, set your own default> >> > "I want to set the default endcoding": ok call> >> getRequestCycleSettings().setResponseRequestEncoding(String) > >> > "I do not want Wicket to set the default. I want Wicket to use what I> > set. ". Yes, call> >> getRequestCycleSettings().setResponseRequestEncoding(String) > >> > What are you trying to say?> >> > Juergen> >> > On 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote:> > > Maybe this line: > > >> > > // Determine encoding> > >> > > final String encoding => > >> >> application.getRequestCycleSettings().getResponseRequestEncoding(); > > >> > > in configureResponse> > >> > > should be transfered into its own protected overridable method:> > >> > > protected String getEncoding() > > > {> > >return> > >> >> application.getRequestCycleSettings().getResponseRequestEncoding();> > > }> > >> > > and then in configure response: > > >> > > // Determine encoding> > > final String encoding = getEncoding();> > >> > > then you can at runtime get the right encoding.> > > > > > johan> > >> > >> > >> > >> > > On 9/6/06, Imran M Yousuf < [EMAIL PROTECTED]> wrote: > > > >> > >> > > Hi dear Users,> > >> > > I have a requirement that I need to cofigure the language encoding based> > on> > > the Request Header "accept-charset". If this is not available than we > have> > > our default charset. Now I am overriding the configureResponse() and NOT> > > calling super.configureResponse(). But I am using the same lines used in> > the> > > source code and please find the code used in configureResponse at the > end> > of> > > the posting. The problem I am facing is that when I visit the page> through> > a> > > wicket link I get the response output stream open in configureResponse, > > but> > > when I refresh the page the output stream opens after configureResponse> > is> > > executed. As a result in the first case I get garbage character and in> the > > > second case I get correct ouput. Please advice what to do. Currently I> am> > > cofiguring the output stream to Shift_JIS hard codedly. If I can get> this> > > flow to work then dynamically I will read the request's "accept-charset" > > and> > > set it. It is a bit urgent so quick response will be appreciated.> > >> > > Thank you.> > >> > > > > > final RequestCycle cycle = getRequestCycle(); > > > final Application application = cycle.getApplication();> > > final Response response = cycle.getResponse();> > >> > > // Determine encoding > > > @SuppressWarnings("unused")> > > final String encoding => > >> >> application.getRequestCycleSettings().getResponseRequestEncoding(); > > >> > > final String encoding1 = "text/" + getMarkupType() + ";> charset="> > +> > > SHIFT_JIS;> > >> > > // Set content type based on markup type for page > > > ( (WebResponse) response> > > ).getHttpServletResponse().setCharacterEncoding(> > SHIFT_JIS> > > );> > > ( (WebResponse) response> > > ).getHttpServletResponse().setContentT
Re: [Wicket-user] Output Stream Encoding
see http://www.wicket-wiki.org.uk/wiki/index.php/Markup_encoding and http://www.crazysquirrel.com/computing/general/form-encoding.jspx Juergen On 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > what could cause problems then? It should work i think, He wants to look > what the > browser sent it under accept encoding and use that encoding if possible > else use the normal default (utf-8) > > > On 9/6/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: > > > but this is exactly what caused the problems as far as I remember. I'm > not a encodings expert, but does UTF-8 not support JIS characters? > > Juergen > > On 9/6/06, Johan Compagner < [EMAIL PROTECTED]> wrote: > > i think that is a global default.. > > > > He does want to set the encoding based on the current request. > > See my previous reply. > > > > > > johan > > > > > > > > On 9/6/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: > > > > > you may remember that we lots of issues before we did that because > > browsers behave differently. If someone would search the mail archive > > for wicket, there were some links to articles which nicely described > > the issues associated. > > > > > > >> It is already implemented The default is UTF-8 and can be configured > > >> via > > > getRequestCycleSettings().setResponseRequestEncoding(String) > > > > > > > > >I do not want to use the default. I want to set the default > > endcoding. I do not want > Wicket to set the default. I want Wicket to > > use what I set. > > > > "I don't want to use the default" => ok, set your own default > > > > "I want to set the default endcoding": ok call > > > getRequestCycleSettings().setResponseRequestEncoding(String) > > > > "I do not want Wicket to set the default. I want Wicket to use what I > > set. ". Yes, call > > > getRequestCycleSettings().setResponseRequestEncoding(String) > > > > What are you trying to say? > > > > Juergen > > > > On 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > > > Maybe this line: > > > > > > // Determine encoding > > > > > > final String encoding = > > > > > > application.getRequestCycleSettings().getResponseRequestEncoding(); > > > > > > in configureResponse > > > > > > should be transfered into its own protected overridable method: > > > > > > protected String getEncoding() > > > { > > >return > > > > > > application.getRequestCycleSettings().getResponseRequestEncoding(); > > > } > > > > > > and then in configure response: > > > > > > // Determine encoding > > > final String encoding = getEncoding(); > > > > > > then you can at runtime get the right encoding. > > > > > > johan > > > > > > > > > > > > > > > On 9/6/06, Imran M Yousuf < [EMAIL PROTECTED]> wrote: > > > > > > > > > > Hi dear Users, > > > > > > I have a requirement that I need to cofigure the language encoding based > > on > > > the Request Header "accept-charset". If this is not available than we > have > > > our default charset. Now I am overriding the configureResponse() and NOT > > > calling super.configureResponse(). But I am using the same lines used in > > the > > > source code and please find the code used in configureResponse at the > end > > of > > > the posting. The problem I am facing is that when I visit the page > through > > a > > > wicket link I get the response output stream open in configureResponse, > > but > > > when I refresh the page the output stream opens after configureResponse > > is > > > executed. As a result in the first case I get garbage character and in > the > > > second case I get correct ouput. Please advice what to do. Currently I > am > > > cofiguring the output stream to Shift_JIS hard codedly. If I can get > this > > > flow to work then dynamically I will read the request's "accept-charset" > > and > > > set it. It is a bit urgent so quick response will be appreciated. > > > > > > Thank you. > > > > > > > > > final RequestCycle cycle = getRequestCycle(); > > > final Application application = cycle.getApplication(); > > > final Response response = cycle.getResponse(); > > > > > > // Determine encoding > > > @SuppressWarnings("unused") > > > final String encoding = > > > > > > application.getRequestCycleSettings().getResponseRequestEncoding(); > > > > > > final String encoding1 = "text/" + getMarkupType() + "; > charset=" > > + > > > SHIFT_JIS; > > > > > > // Set content type based on markup type for page > > > ( (WebResponse) response > > > ).getHttpServletResponse().setCharacterEncoding( > > SHIFT_JIS > > > ); > > > ( (WebResponse) response > > > ).getHttpServletResponse().setContentType( encoding1 ); > > > ( (WebResponse) response > > > ).getHttpServletResponse().setHeader( ACCEPT_CHARSET, > > > SHIFT_JIS ); > > > ( (WebResponse) response > > > ).getHttpServletResponse().setHeader( ACCEPT_LANGUAGE, > > > JA_JP ); > > > // response.setContentType ("text/" + getMarkupType() + "; > > charset=
Re: [Wicket-user] Output Stream Encoding
what could cause problems then? It should work i think, He wants to look what thebrowser sent it under accept encoding and use that encoding if possibleelse use the normal default (utf-8) On 9/6/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: but this is exactly what caused the problems as far as I remember. I'mnot a encodings expert, but does UTF-8 not support JIS characters?JuergenOn 9/6/06, Johan Compagner < [EMAIL PROTECTED]> wrote:> i think that is a global default..>> He does want to set the encoding based on the current request.> See my previous reply.>>> johan On 9/6/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:> >> you may remember that we lots of issues before we did that because > browsers behave differently. If someone would search the mail archive> for wicket, there were some links to articles which nicely described> the issues associated.>>> >> It is already implemented The default is UTF-8 and can be configured > >> via> getRequestCycleSettings().setResponseRequestEncoding(String)> >> >> >I do not want to use the default. I want to set the default> endcoding. I do not want > Wicket to set the default. I want Wicket to > use what I set.>> "I don't want to use the default" => ok, set your own default>> "I want to set the default endcoding": ok call> getRequestCycleSettings().setResponseRequestEncoding(String) >> "I do not want Wicket to set the default. I want Wicket to use what I> set. ". Yes, call> getRequestCycleSettings().setResponseRequestEncoding(String)>> What are you trying to say? >> Juergen>> On 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote:> > Maybe this line:> >> > // Determine encoding > >> > final String encoding => >> application.getRequestCycleSettings().getResponseRequestEncoding();> >> > in configureResponse> >> > should be transfered into its own protected overridable method: > >> > protected String getEncoding()> > {> >return> >> application.getRequestCycleSettings().getResponseRequestEncoding();> > }> >> > and then in configure response: > >> > // Determine encoding> > final String encoding = getEncoding();> >> > then you can at runtime get the right encoding.> >> > johan > >> >> >> >> > On 9/6/06, Imran M Yousuf < [EMAIL PROTECTED]> wrote:> > >> >> > Hi dear Users, > >> > I have a requirement that I need to cofigure the language encoding based> on> > the Request Header "accept-charset". If this is not available than we have> > our default charset. Now I am overriding the configureResponse() and NOT > > calling super.configureResponse(). But I am using the same lines used in> the> > source code and please find the code used in configureResponse at the end> of> > the posting. The problem I am facing is that when I visit the page through > a> > wicket link I get the response output stream open in configureResponse,> but> > when I refresh the page the output stream opens after configureResponse> is> > executed. As a result in the first case I get garbage character and in the > > second case I get correct ouput. Please advice what to do. Currently I am> > cofiguring the output stream to Shift_JIS hard codedly. If I can get this> > flow to work then dynamically I will read the request's "accept-charset" > and> > set it. It is a bit urgent so quick response will be appreciated.> >> > Thank you.> >> > > > final RequestCycle cycle = getRequestCycle(); > > final Application application = cycle.getApplication();> > final Response response = cycle.getResponse();> >> > // Determine encoding> > @SuppressWarnings("unused") > > final String encoding => >> application.getRequestCycleSettings().getResponseRequestEncoding();> >> > final String encoding1 = "text/" + getMarkupType() + "; charset=" > +> > SHIFT_JIS;> >> > // Set content type based on markup type for page> > ( (WebResponse) response> > ).getHttpServletResponse().setCharacterEncoding( > SHIFT_JIS> > );> > ( (WebResponse) response> > ).getHttpServletResponse().setContentType( encoding1 );> > ( (WebResponse) response> > ).getHttpServletResponse().setHeader( ACCEPT_CHARSET, > > SHIFT_JIS );> > ( (WebResponse) response> > ).getHttpServletResponse().setHeader( ACCEPT_LANGUAGE,> > JA_JP );> > // response.setContentType ("text/" + getMarkupType() + "; > charset="> > +> > // encoding);> >> > // Write out an xml declaration if the markup stream and settings> > allow> > final MarkupStream markupStream = findMarkupStream(); > > if( ( markupStream != null ) && ( markupStream.getXmlDeclaration()> > != null )> > && (> >> application.getMarkupSettings().getStripXmlDeclarationFromOutput() > > == false ) )> > {> > response.write( "> > response.write( SHIFT_JIS );> > response.write ( "'?>" );> > }> > System.out.println (( (WebResponse) response> > ).getHttpServletResponse().getCharacter
Re: [Wicket-user] Output Stream Encoding
but this is exactly what caused the problems as far as I remember. I'm not a encodings expert, but does UTF-8 not support JIS characters? Juergen On 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > i think that is a global default.. > > He does want to set the encoding based on the current request. > See my previous reply. > > > johan > > > > On 9/6/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: > > > you may remember that we lots of issues before we did that because > browsers behave differently. If someone would search the mail archive > for wicket, there were some links to articles which nicely described > the issues associated. > > > >> It is already implemented The default is UTF-8 and can be configured > >> via > getRequestCycleSettings().setResponseRequestEncoding(String) > > > > > >I do not want to use the default. I want to set the default > endcoding. I do not want > Wicket to set the default. I want Wicket to > use what I set. > > "I don't want to use the default" => ok, set your own default > > "I want to set the default endcoding": ok call > getRequestCycleSettings().setResponseRequestEncoding(String) > > "I do not want Wicket to set the default. I want Wicket to use what I > set. ". Yes, call > getRequestCycleSettings().setResponseRequestEncoding(String) > > What are you trying to say? > > Juergen > > On 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > > Maybe this line: > > > > // Determine encoding > > > > final String encoding = > > > application.getRequestCycleSettings().getResponseRequestEncoding(); > > > > in configureResponse > > > > should be transfered into its own protected overridable method: > > > > protected String getEncoding() > > { > >return > > > application.getRequestCycleSettings().getResponseRequestEncoding(); > > } > > > > and then in configure response: > > > > // Determine encoding > > final String encoding = getEncoding(); > > > > then you can at runtime get the right encoding. > > > > johan > > > > > > > > > > On 9/6/06, Imran M Yousuf < [EMAIL PROTECTED]> wrote: > > > > > > > Hi dear Users, > > > > I have a requirement that I need to cofigure the language encoding based > on > > the Request Header "accept-charset". If this is not available than we have > > our default charset. Now I am overriding the configureResponse() and NOT > > calling super.configureResponse(). But I am using the same lines used in > the > > source code and please find the code used in configureResponse at the end > of > > the posting. The problem I am facing is that when I visit the page through > a > > wicket link I get the response output stream open in configureResponse, > but > > when I refresh the page the output stream opens after configureResponse > is > > executed. As a result in the first case I get garbage character and in the > > second case I get correct ouput. Please advice what to do. Currently I am > > cofiguring the output stream to Shift_JIS hard codedly. If I can get this > > flow to work then dynamically I will read the request's "accept-charset" > and > > set it. It is a bit urgent so quick response will be appreciated. > > > > Thank you. > > > > > > final RequestCycle cycle = getRequestCycle(); > > final Application application = cycle.getApplication(); > > final Response response = cycle.getResponse(); > > > > // Determine encoding > > @SuppressWarnings("unused") > > final String encoding = > > > application.getRequestCycleSettings().getResponseRequestEncoding(); > > > > final String encoding1 = "text/" + getMarkupType() + "; charset=" > + > > SHIFT_JIS; > > > > // Set content type based on markup type for page > > ( (WebResponse) response > > ).getHttpServletResponse().setCharacterEncoding( > SHIFT_JIS > > ); > > ( (WebResponse) response > > ).getHttpServletResponse().setContentType( encoding1 ); > > ( (WebResponse) response > > ).getHttpServletResponse().setHeader( ACCEPT_CHARSET, > > SHIFT_JIS ); > > ( (WebResponse) response > > ).getHttpServletResponse().setHeader( ACCEPT_LANGUAGE, > > JA_JP ); > > // response.setContentType ("text/" + getMarkupType() + "; > charset=" > > + > > // encoding); > > > > // Write out an xml declaration if the markup stream and settings > > allow > > final MarkupStream markupStream = findMarkupStream(); > > if( ( markupStream != null ) && ( markupStream.getXmlDeclaration() > > != null ) > > && ( > > > application.getMarkupSettings().getStripXmlDeclarationFromOutput() > > == false ) ) > > { > > response.write( " > response.write( SHIFT_JIS ); > > response.write( "'?>" ); > > } > > System.out.println (( (WebResponse) response > > ).getHttpServletResponse().getCharacterEncoding()); > > > > // Set response locale from session locale > > response.setLocale( getSession().g
Re: [Wicket-user] Output Stream Encoding
i think that is a global default..He does want to set the encoding based on the current request.See my previous reply.johanOn 9/6/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: you may remember that we lots of issues before we did that becausebrowsers behave differently. If someone would search the mail archivefor wicket, there were some links to articles which nicely describedthe issues associated. >> It is already implemented The default is UTF-8 and can be configured>> via getRequestCycleSettings().setResponseRequestEncoding(String)>>>I do not want to use the default. I want to set the default endcoding. I do not want > Wicket to set the default. I want Wicket touse what I set."I don't want to use the default" => ok, set your own default"I want to set the default endcoding": ok call getRequestCycleSettings().setResponseRequestEncoding(String)"I do not want Wicket to set the default. I want Wicket to use what Iset. ". Yes, callgetRequestCycleSettings().setResponseRequestEncoding(String) What are you trying to say?JuergenOn 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote:> Maybe this line:>> // Determine encoding >> final String encoding => application.getRequestCycleSettings().getResponseRequestEncoding();>> in configureResponse>> should be transfered into its own protected overridable method: >> protected String getEncoding()> {>return> application.getRequestCycleSettings().getResponseRequestEncoding();> }>> and then in configure response:> > // Determine encoding> final String encoding = getEncoding();>> then you can at runtime get the right encoding.>> johan> On 9/6/06, Imran M Yousuf < [EMAIL PROTECTED]> wrote:> >>> Hi dear Users,>> I have a requirement that I need to cofigure the language encoding based on> the Request Header "accept-charset". If this is not available than we have > our default charset. Now I am overriding the configureResponse() and NOT> calling super.configureResponse(). But I am using the same lines used in the> source code and please find the code used in configureResponse at the end of > the posting. The problem I am facing is that when I visit the page through a> wicket link I get the response output stream open in configureResponse, but> when I refresh the page the output stream opens after configureResponse is > executed. As a result in the first case I get garbage character and in the> second case I get correct ouput. Please advice what to do. Currently I am> cofiguring the output stream to Shift_JIS hard codedly. If I can get this > flow to work then dynamically I will read the request's "accept-charset" and> set it. It is a bit urgent so quick response will be appreciated.>> Thank you.>> > final RequestCycle cycle = getRequestCycle();> final Application application = cycle.getApplication();> final Response response = cycle.getResponse();>> // Determine encoding > @SuppressWarnings("unused")> final String encoding => application.getRequestCycleSettings().getResponseRequestEncoding();>> final String encoding1 = "text/" + getMarkupType() + "; charset=" + > SHIFT_JIS;>> // Set content type based on markup type for page> ( (WebResponse) response> ).getHttpServletResponse().setCharacterEncoding( SHIFT_JIS> );> ( (WebResponse) response > ).getHttpServletResponse().setContentType( encoding1 );> ( (WebResponse) response> ).getHttpServletResponse().setHeader( ACCEPT_CHARSET,> SHIFT_JIS );> ( (WebResponse) response > ).getHttpServletResponse().setHeader( ACCEPT_LANGUAGE,> JA_JP );> // response.setContentType ("text/" + getMarkupType() + "; charset="> +> // encoding); >> // Write out an xml declaration if the markup stream and settings> allow> final MarkupStream markupStream = findMarkupStream();> if( ( markupStream != null ) && ( markupStream.getXmlDeclaration()> != null )> && (> application.getMarkupSettings().getStripXmlDeclarationFromOutput()> == false ) )> {> response.write( "> response.write( SHIFT_JIS );> response.write( "'?>" );> }> System.out.println (( (WebResponse) response> ).getHttpServletResponse().getCharacterEncoding());>> // Set response locale from session locale> response.setLocale( getSession().getLocale() ); > >> Imran>> -> Using Tomcat but need to do more? Need to support web services, security?> Get stuff done quickly with pre-integrated technology to make your job > easier> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> ___> Wicket-user mailing list> Wicket-user@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/wicket-user>>
Re: [Wicket-user] Output Stream Encoding
you may remember that we lots of issues before we did that because browsers behave differently. If someone would search the mail archive for wicket, there were some links to articles which nicely described the issues associated. >> It is already implemented The default is UTF-8 and can be configured >> via getRequestCycleSettings().setResponseRequestEncoding(String) > > >I do not want to use the default. I want to set the default endcoding. I do not want > Wicket to set the default. I want Wicket to use what I set. "I don't want to use the default" => ok, set your own default "I want to set the default endcoding": ok call getRequestCycleSettings().setResponseRequestEncoding(String) "I do not want Wicket to set the default. I want Wicket to use what I set. ". Yes, call getRequestCycleSettings().setResponseRequestEncoding(String) What are you trying to say? Juergen On 9/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > Maybe this line: > > // Determine encoding > > final String encoding = > application.getRequestCycleSettings().getResponseRequestEncoding(); > > in configureResponse > > should be transfered into its own protected overridable method: > > protected String getEncoding() > { >return > application.getRequestCycleSettings().getResponseRequestEncoding(); > } > > and then in configure response: > > // Determine encoding > final String encoding = getEncoding(); > > then you can at runtime get the right encoding. > > johan > > > > > On 9/6/06, Imran M Yousuf < [EMAIL PROTECTED]> wrote: > > > > Hi dear Users, > > I have a requirement that I need to cofigure the language encoding based on > the Request Header "accept-charset". If this is not available than we have > our default charset. Now I am overriding the configureResponse() and NOT > calling super.configureResponse(). But I am using the same lines used in the > source code and please find the code used in configureResponse at the end of > the posting. The problem I am facing is that when I visit the page through a > wicket link I get the response output stream open in configureResponse, but > when I refresh the page the output stream opens after configureResponse is > executed. As a result in the first case I get garbage character and in the > second case I get correct ouput. Please advice what to do. Currently I am > cofiguring the output stream to Shift_JIS hard codedly. If I can get this > flow to work then dynamically I will read the request's "accept-charset" and > set it. It is a bit urgent so quick response will be appreciated. > > Thank you. > > > final RequestCycle cycle = getRequestCycle(); > final Application application = cycle.getApplication(); > final Response response = cycle.getResponse(); > > // Determine encoding > @SuppressWarnings("unused") > final String encoding = > application.getRequestCycleSettings().getResponseRequestEncoding(); > > final String encoding1 = "text/" + getMarkupType() + "; charset=" + > SHIFT_JIS; > > // Set content type based on markup type for page > ( (WebResponse) response > ).getHttpServletResponse().setCharacterEncoding( SHIFT_JIS > ); > ( (WebResponse) response > ).getHttpServletResponse().setContentType( encoding1 ); > ( (WebResponse) response > ).getHttpServletResponse().setHeader( ACCEPT_CHARSET, > SHIFT_JIS ); > ( (WebResponse) response > ).getHttpServletResponse().setHeader( ACCEPT_LANGUAGE, > JA_JP ); > // response.setContentType ("text/" + getMarkupType() + "; charset=" > + > // encoding); > > // Write out an xml declaration if the markup stream and settings > allow > final MarkupStream markupStream = findMarkupStream(); > if( ( markupStream != null ) && ( markupStream.getXmlDeclaration() > != null ) > && ( > application.getMarkupSettings().getStripXmlDeclarationFromOutput() > == false ) ) > { > response.write( " response.write( SHIFT_JIS ); > response.write( "'?>" ); > } > System.out.println (( (WebResponse) response > ).getHttpServletResponse().getCharacterEncoding()); > > // Set response locale from session locale > response.setLocale( getSession().getLocale() ); > > > Imran > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > - > Using T
Re: [Wicket-user] Output Stream Encoding
Maybe this line: // Determine encoding final String encoding = application.getRequestCycleSettings().getResponseRequestEncoding();in configureResponseshould be transfered into its own protected overridable method: protected String getEncoding(){ return application.getRequestCycleSettings().getResponseRequestEncoding();}and then in configure response: // Determine encoding final String encoding = getEncoding();then you can at runtime get the right encoding.johanOn 9/6/06, Imran M Yousuf < [EMAIL PROTECTED]> wrote:Hi dear Users, I have a requirement that I need to cofigure the language encoding based on the Request Header "accept-charset". If this is not available than we have our default charset. Now I am overriding the configureResponse() and NOT calling super.configureResponse(). But I am using the same lines used in the source code and please find the code used in configureResponse at the end of the posting. The problem I am facing is that when I visit the page through a wicket link I get the response output stream open in configureResponse, but when I refresh the page the output stream opens after configureResponse is executed. As a result in the first case I get garbage character and in the second case I get correct ouput. Please advice what to do. Currently I am cofiguring the output stream to Shift_JIS hard codedly. If I can get this flow to work then dynamically I will read the request's "accept-charset" and set it. It is a bit urgent so quick response will be appreciated. Thank you. final RequestCycle cycle = getRequestCycle(); final Application application = cycle.getApplication(); final Response response = cycle.getResponse(); // Determine encoding @SuppressWarnings("unused") final String encoding = application.getRequestCycleSettings().getResponseRequestEncoding(); final String encoding1 = "text/" + getMarkupType() + "; charset=" + SHIFT_JIS; // Set content type based on markup type for page ( (WebResponse) response ).getHttpServletResponse().setCharacterEncoding( SHIFT_JIS ); ( (WebResponse) response ).getHttpServletResponse().setContentType( encoding1 ); ( (WebResponse) response ).getHttpServletResponse().setHeader( ACCEPT_CHARSET, SHIFT_JIS ); ( (WebResponse) response ).getHttpServletResponse().setHeader( ACCEPT_LANGUAGE, JA_JP ); // response.setContentType ("text/" + getMarkupType() + "; charset=" + // encoding); // Write out an xml declaration if the markup stream and settings allow final MarkupStream markupStream = findMarkupStream(); if( ( markupStream != null ) && ( markupStream.getXmlDeclaration() != null ) && ( application.getMarkupSettings().getStripXmlDeclarationFromOutput() == false ) ) { response.write( " response.write( SHIFT_JIS ); response.write( "'?>" ); } System.out.println (( (WebResponse) response ).getHttpServletResponse().getCharacterEncoding()); // Set response locale from session locale response.setLocale( getSession().getLocale() );Imran -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Output Stream Encoding
Thanks Jurgern.Dear Users I am confirming my experience on this issue:When I load a Link, i.e. request header referrer is null I get the configure response without the Output stream being opened. So even if I set the output stream encoding from the filter it gets overriden and it writes in the default encoding which is UTF-8. When I come to the page without a referrer I get the output stream not opened, so from wherever I set the configuration it prevails.> It is already implemented The default is UTF-8 and can be configured > via getRequestCycleSettings().setResponseRequestEncoding(String)I do not want to use the default. I want to set the default endcoding. I do not want Wicket to set the default. I want Wicket to use what I set. Please advice.Imran - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Output Stream Encoding
On 9/6/06, Imran M Yousuf <[EMAIL PROTECTED]> wrote: > Hi dear Users, > > I have a requirement that I need to cofigure the language encoding based on > the Request Header "accept-charset". If this is not available than we have > our default charset. It is already implemented The default is UTF-8 and can be configured via getRequestCycleSettings().setResponseRequestEncoding(String) Juergen > Now I am overriding the configureResponse() and NOT > calling super.configureResponse(). But I am using the same lines used in the > source code and please find the code used in configureResponse at the end of > the posting. The problem I am facing is that when I visit the page through a > wicket link I get the response output stream open in configureResponse, but > when I refresh the page the output stream opens after configureResponse is > executed. As a result in the first case I get garbage character and in the > second case I get correct ouput. Please advice what to do. Currently I am > cofiguring the output stream to Shift_JIS hard codedly. If I can get this > flow to work then dynamically I will read the request's "accept-charset" and > set it. It is a bit urgent so quick response will be appreciated. > > Thank you. > > > final RequestCycle cycle = getRequestCycle(); > final Application application = cycle.getApplication(); > final Response response = cycle.getResponse(); > > // Determine encoding > @SuppressWarnings("unused") > final String encoding = > application.getRequestCycleSettings().getResponseRequestEncoding(); > > final String encoding1 = "text/" + getMarkupType() + "; charset=" + > SHIFT_JIS; > > // Set content type based on markup type for page > ( (WebResponse) response > ).getHttpServletResponse().setCharacterEncoding( SHIFT_JIS > ); > ( (WebResponse) response > ).getHttpServletResponse().setContentType( encoding1 ); > ( (WebResponse) response > ).getHttpServletResponse().setHeader( ACCEPT_CHARSET, > SHIFT_JIS ); > ( (WebResponse) response > ).getHttpServletResponse().setHeader( ACCEPT_LANGUAGE, > JA_JP ); > // response.setContentType ("text/" + getMarkupType() + "; charset=" > + > // encoding); > > // Write out an xml declaration if the markup stream and settings > allow > final MarkupStream markupStream = findMarkupStream(); > if( ( markupStream != null ) && ( markupStream.getXmlDeclaration() > != null ) > && ( > application.getMarkupSettings().getStripXmlDeclarationFromOutput() > == false ) ) > { > response.write( " response.write( SHIFT_JIS ); > response.write( "'?>" ); > } > System.out.println(( (WebResponse) response > ).getHttpServletResponse().getCharacterEncoding()); > > // Set response locale from session locale > response.setLocale( getSession().getLocale() ); > > > Imran > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user