Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Dave Willis
URL can only be invoked using POST? [resolved]
10 de agosto de 2009 9:26
Respuesta

Dave Willis

Ranking: Expert

Mensajes: 301

Fecha de incorporación: 13 de julio de 2009

Mensajes recientes

115:38:30,270 WARN  [PortletRequestProcessor:168] This URL can only be invoked using POST: /web/guest/home? (really long link that I don't think is relevant)...


I keep getting this warning in the console and I really don't know what it means or if it's affecting anything. I get it when I click the button to go to the next view but it does it by submitting a form via POST so I don't know why it would be telling me that. Here's my form:

1<form action="<portlet:actionURL windowState="<%= WindowState.NORMAL.toString() %>">
2                  <portlet:param name="struts_action" value="/sports/sweetie/view" />
3                  <portlet:param name="sweetieId" value="<%= String.valueOf(sweetie.getSweetieId()) %>" />
4                  <portlet:param name="redirect" value="<%= currentURL %>" />
5              </portlet:actionURL>" method="post" name="<portlet:namespace />view<%= sweetie.getSweetieId() %>">
6    <input type="submit" value="VIEW PICS" />
7</form>


Any ideas? Thanks!
-Dave
Wilson Man
RE: URL can only be invoked using POST?
30 de julio de 2009 11:56
Respuesta

Wilson Man

LIFERAY STAFF

Ranking: Liferay Master

Mensajes: 580

Fecha de incorporación: 21 de junio de 2006

Mensajes recientes

in your form element, add this attribute:
1method="post"
Dave Willis
RE: URL can only be invoked using POST?
30 de julio de 2009 12:39
Respuesta

Dave Willis

Ranking: Expert

Mensajes: 301

Fecha de incorporación: 13 de julio de 2009

Mensajes recientes

I'm not sure I follow. I already have that in the form element. Should I add it in another place as well? In the code snippet above you can see that it follows the action parameter.
Rice Owl
RE: URL can only be invoked using POST?
30 de julio de 2009 14:02
Respuesta

Rice Owl

Ranking: Regular Member

Mensajes: 177

Fecha de incorporación: 23 de abril de 2009

Mensajes recientes

I think the previous poster didn't see the method="post" atrribute. I didn't see it at first either.

Dave Willis:
I'm not sure I follow. I already have that in the form element. Should I add it in another place as well? In the code snippet above you can see that it follows the action parameter.
Dave Willis
RE: URL can only be invoked using POST?
30 de julio de 2009 14:06
Respuesta

Dave Willis

Ranking: Expert

Mensajes: 301

Fecha de incorporación: 13 de julio de 2009

Mensajes recientes

Ah. I wondered if that was the case.
Wilson Man
RE: URL can only be invoked using POST?
30 de julio de 2009 16:30
Respuesta

Wilson Man

LIFERAY STAFF

Ranking: Liferay Master

Mensajes: 580

Fecha de incorporación: 21 de junio de 2006

Mensajes recientes

yeah, i missed that earlier.

anyhow, i take it you have a struts action class that's mapped to the struts_action path right?
Victor Zorin
RE: URL can only be invoked using POST?
30 de julio de 2009 18:03
Respuesta

Victor Zorin

Ranking: Liferay Legend

Mensajes: 1178

Fecha de incorporación: 14 de abril de 2008

Mensajes recientes

Probably missing a processAction(...) method in a mapped class definition:
1public void processAction(ActionMapping mapping, ActionForm form,
2            PortletConfig config, ActionRequest req, ActionResponse res)


Try to change to portlet:renderURL and see if it does not log the warning message.

Struts mapping or action class design is the most likely cause here.
Dave Willis
RE: URL can only be invoked using POST?
31 de julio de 2009 8:47
Respuesta

Dave Willis

Ranking: Expert

Mensajes: 301

Fecha de incorporación: 13 de julio de 2009

Mensajes recientes

I do have an action class that's mapped to an action path and all my classes have both a render method and a processAction method. I have inexplicably stopped receiving this warning though. I still wonder if I have some configuration issue though that may be manifesting itself in other ways, possibly ones that I'm not even aware of.
Tarun S. Kayasth
RE: URL can only be invoked using POST? [resolved]
10 de agosto de 2009 21:47
Respuesta

Tarun S. Kayasth

Ranking: Regular Member

Mensajes: 160

Fecha de incorporación: 8 de junio de 2007

Mensajes recientes

Then solution for this error is override following method in action class:


protected boolean isCheckMethodOnProcessAction() {
return _CHECK_METHOD_ON_PROCESS_ACTION;
}

private static final boolean _CHECK_METHOD_ON_PROCESS_ACTION = false;


- Tarun Kayasth
CIGNEX Technologies Pvt. Ltd.
Sohui Gu
RE: URL can only be invoked using POST? [resolved]
11 de noviembre de 2009 0:02
Respuesta

Sohui Gu

Ranking: Regular Member

Mensajes: 114

Fecha de incorporación: 6 de julio de 2006

Mensajes recientes

Tarun S. Kayasth:
Then solution for this error is override following method in action class:


protected boolean isCheckMethodOnProcessAction() {
return _CHECK_METHOD_ON_PROCESS_ACTION;
}

private static final boolean _CHECK_METHOD_ON_PROCESS_ACTION = false;


- Tarun Kayasth
CIGNEX Technologies Pvt. Ltd.


It works. Thanks, Tarun! But I don't know why?
Sohui Gu
RE: URL can only be invoked using POST? [resolved]
11 de noviembre de 2009 0:08
Respuesta

Sohui Gu

Ranking: Regular Member

Mensajes: 114

Fecha de incorporación: 6 de julio de 2006

Mensajes recientes

using
1<input type="button" value="<liferay-ui:message key="select-houser" />" onClick="location.href = '<%= HtmlUtil.escape(selectHouserURL) %>';" />
need to override

but using
1<liferay-ui:icon image="select-houser" url="<%= selectHouserURL%>" />
don't need

who knows the cause?
xun ren
RE: URL can only be invoked using POST? [resolved]
24 de junio de 2010 2:04
Respuesta

xun ren

Ranking: Junior Member

Mensajes: 82

Fecha de incorporación: 1 de abril de 2008

Mensajes recientes

Sohui Gu:
using
1<input type="button" value="<liferay-ui:message key="select-houser" />" onClick="location.href = '<%= HtmlUtil.escape(selectHouserURL) %>';" />
need to override

but using
1<liferay-ui:icon image="select-houser" url="<%= selectHouserURL%>" />
don't need

who knows the cause?



If you use "liferay-ui:icon", it will create two links, one for image (select-houser), another for the text. What's more, you will find at the end of these two links, there is an attribute: onClick="Liferay.Util.forcePost(this)". That means it will force the method to be post instead of "get" by default. This is a javascript function is this file: portal-source/portal-web/docroot/html/js/liferay/util.js