-3

Web アプリケーションで Wicket フレームワークを使用しています。ユーザー名に "å" や "ö" などの英語以外の文字 (例: Björn) を使用すると、ログインしようとすると次の例外が発生します。

原因: java.lang.IllegalArgumentException: Cookie 値の制御文字です。org.apache.tomcat.util. http.ServerCookie.appendCookieValue(ServerCookie.java:253) org.apache.catalina.connector.Response.addCookie(Response.java:958) org.apache.catalina.connector.ResponseFacade.addCookie(ResponseFacade.java:341) org.apache.wicket.protocol.http.WebResponse.addCookie(WebResponse.java:86) で org.apache.wicket.markup.html.form.persistence.CookieValuePersister.save(CookieValuePersister.java:277) で org.apache .wicket.markup.html.form.persistence.CookieValuePersister.save(CookieValuePersister.java:97) at org.apache.wicket.markup.html.form.Form$12.onFormComponent(Form.java:1291) org.apache.wicket.markup.html.form.FormComponent$AbstractVisitor.formComponent(FormComponent.java:107) で org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:421) でorg.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:408) で org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:385) で org.apache .wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1089) at org.apache.wicket.markup.html.form.Form.persistFormComponentData(Form.java:1280) at org.apache.wicket.markup .html.form.Form.process(Form.java:874) at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) ... 27 個の共通フレームを省略html.form.FormComponent$AbstractVisitor.formComponent(FormComponent.java:107) at org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:421) at org.apache.wicket.markup.html. form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:408) at org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:385) at org.apache.wicket.markup.html.form.Form. org.apache.wicket.markup.html.form.Form.process(Form. java:874) at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) ... 27 個の共通フレームを省略html.form.FormComponent$AbstractVisitor.formComponent(FormComponent.java:107) at org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:421) at org.apache.wicket.markup.html. form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:408) at org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:385) at org.apache.wicket.markup.html.form.Form. org.apache.wicket.markup.html.form.Form.process(Form. java:874) at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) ... 27 個の共通フレームを省略formComponent(FormComponent.java:107) at org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:421) at org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent. java:408) org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:385) で org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1089) でorg.apache.wicket.markup.html.form.Form.persistFormComponentData(Form.java:1280) で org.apache.wicket.markup.html.form.Form.process(Form.java:874) で org.apache .wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) ... 27個の共通フレームを省略formComponent(FormComponent.java:107) at org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:421) at org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent. java:408) org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:385) で org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1089) でorg.apache.wicket.markup.html.form.Form.persistFormComponentData(Form.java:1280) で org.apache.wicket.markup.html.form.Form.process(Form.java:874) で org.apache .wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) ... 27個の共通フレームを省略org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:408) の visitFormComponentsPostOrderHelper(FormComponent.java:421) org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent. java:385) org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1089) で org.apache.wicket.markup.html.form.Form.persistFormComponentData(Form.java:1280) でorg.apache.wicket.markup.html.form.Form.process(Form.java:874) で org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) で ... 27共通枠省略org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:408) の visitFormComponentsPostOrderHelper(FormComponent.java:421) org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent. java:385) org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1089) で org.apache.wicket.markup.html.form.Form.persistFormComponentData(Form.java:1280) でorg.apache.wicket.markup.html.form.Form.process(Form.java:874) で org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) で ... 27共通枠省略org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1089) の visitFormComponentsPostOrder(FormComponent.java:385) org.apache.wicket.markup.html.form.Form.persistFormComponentData(Form. java:1280) org.apache.wicket.markup.html.form.Form.process(Form.java:874) で org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) で... 27 個の共通フレームを省略org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1089) の visitFormComponentsPostOrder(FormComponent.java:385) org.apache.wicket.markup.html.form.Form.persistFormComponentData(Form. java:1280) org.apache.wicket.markup.html.form.Form.process(Form.java:874) で org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808) で... 27 個の共通フレームを省略

ユーザーが英語以外の文字を入力できるようにするにはどうすればよいですか?

4

1 に答える 1

0

のソース コードを見ると、CookieValuePersisterXML への読み込みや保存がまったく行われていません。むしろ、ユーザーのブラウザに設定される Cookie に Cookie を追加することで、Cookie を「永続化」します。

そして、それは本当の問題が何であるかに私たちを導きます. HTTP State Management Mechanism RFC によると、Cookieの値は印刷可能な ASCII 文字として送信する必要があります。値に他の文字が含まれている可能性がある場合は、base64 などでエンコードする必要があります。

それは例外メッセージが言っていることでもありますが、必要に応じて印刷可能なASCIIベースのエンコーディングを使用できます...仕様によって課された制約をモジュロします。

于 2012-06-18T16:06:30.323 に答える