Dammit.. I found this article:
http://www.thewirelessfaq.com/why_does_a_normal_http_302_redirect_not_work_with_wap
Talks something about redirects.. so I tried to set
setRedirect(false); and it works now.
Funny. Since I have hacked rid of 302 redirects because google don't like them:
// Force 302 redirect status code into 301 'permanent redirect'
Field statusField = HttpStatus.class.getDeclaredField("__responseLine");
statusField.setAccessible(true);
Buffer[] responseLine = (Buffer[]) statusField.get(HttpStatus.class);
byte[] bytes = responseLine[302].toString().replace("302",
"301").getBytes();
responseLine[302] = new
ByteArrayBuffer(bytes,0,bytes.length,Buffer.IMMUTABLE);
Apparently wap don't like 301's either... or maybe there is something
funny in the headers that it don't like.
**
Martin
2009/2/20 Martin Makundi <[email protected]>:
> Hi!
>
> Currently my problem is that the Nokia3510i simulator does not react
> properly to setResponsePage(WapMainPage.class). For some (yet unknown)
> reason the requestcycle processes an empty request which results in
> PageExpiredException:
>
> [RequestParameters componentPath=3:loginForm pageMapName=null
> versionNumber=0 interfaceName=IFormSubmitListener componentId=null
> behaviorId=null urlDepth=-1 parameters={}
> onlyProcessIfPathActive=false]
>
> If I try the same pages with firefox it works fine, the
> setResponsePage opens the WapMainPage.wml and it validates just fine.
> I am begnnining to pull my hair now ... did you experience anything
> like this?
>
> Here are some of my 'compositions', the login form is processed quite
> fine and the session is intialized etc... but the
> setResponsePage(WapMainPage.class) after successful login
> (loginForm#onSubmit) does not work with the wap simulator:
>
> :::::::::::
>
> add(loginForm = new LoginForm(true) {
> /**
> * @see
> org.apache.wicket.markup.html.form.Form#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
> org.apache.wicket.markup.ComponentTag)
> */
> @Override
> protected void onComponentTagBody(MarkupStream markupStream,
> ComponentTag openTag) {
> renderComponentTagBody(markupStream, openTag);
> }
> });
> loginForm.setRenderBodyOnly(true);
>
>
> :::::::::::::
>
> public class WapSubmitComponent extends Button {
> private static final long serialVersionUID = 1L;
>
> /**
> * @param id
> * @param model
> */
> public WapSubmitComponent(String id, IModel<String> model) {
> super(id, model);
> }
>
> /**
> * @param id
> */
> public WapSubmitComponent(String id) {
> super(id);
> }
>
> /**
> * @see
> org.apache.wicket.markup.html.form.Button#onComponentTag(org.apache.wicket.markup.ComponentTag)
> */
> @Override
> protected void onComponentTag(ComponentTag tag) {
> // nothing
> }
>
> /**
> * @see
> org.apache.wicket.MarkupContainer#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
> org.apache.wicket.markup.ComponentTag)
> */
> @Override
> protected void onComponentTagBody(MarkupStream markupStream,
> ComponentTag openTag) {
> super.onComponentTagBody(markupStream, openTag);
> // Check whether to add tag body
> if (getDefaultModelObject() != null) {
> getResponse().write(getDefaultModelObject().toString());
> }
> getResponse().write("\r\n<go method=\"");
> getResponse().write(getMethod());
> getResponse().write("\" href=\"");
> getResponse().write(getForm().urlFor(IFormSubmitListener.INTERFACE));
> getResponse().write("\">\r\n");
> {
> // Indicate submitting form-component
> writePostField(getInputName(), "true");
> }
> {
> // Add other enabled form components
> final Form<?> wapForm = getForm();
> wapForm.visitFormComponentsPostOrder(new ValidationVisitor()
> {
> @Override
> public void validate(final FormComponent<?> formComponent)
> {
> final Form<?> form = formComponent.getForm();
> if (formComponent != WapSubmitComponent.this && form ==
> wapForm && form.isEnabled() && form.isEnableAllowed() &&
> form.isVisibleInHierarchy()) {
> String name = formComponent.getInputName();
> writePostField(name, "$(" + name + ")");
> }
> }
> });
> }
> getResponse().write("</go>\r\n");
> }
>
> /**
> *
> */
> void writePostField(String name, String value) {
> getResponse().write(" <postfield name=\"");
> getResponse().write(name);
> getResponse().write("\" value=\"");
> getResponse().write(value);
> getResponse().write("\"/>\r\n");
> }
>
> /**
> * Gets the HTTP submit method that will appear in form markup. If
> no method is specified in the
> * template, "post" is the default. Note that the markup-declared
> HTTP method may not correspond
> * to the one actually used to submit the form; in an Ajax submit,
> for example, JavaScript event
> * handlers may submit the form with a "get" even when the form
> method is declared as "post."
> * Therefore this method should not be considered a guarantee of the
> HTTP method used, but a
> * value for the markup only. Override if you have a requirement to
> alter this behavior.
> *
> * @return the submit method specified in markup.
> */
> protected String getMethod()
> {
> String method = getMarkupAttributes().getString("method");
> return (method != null) ? method : Form.METHOD_POST;
> }
> }
>
>
> **
> Martin
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]