Foros de discusión
URL can only be invoked using POST? [resolved]
Dave Willis, modificado hace 14 años.
URL can only be invoked using POST? [resolved]
Expert Mensajes: 301 Fecha de incorporación: 13/07/09 Mensajes recientes15: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:
<form action="<portlet:actionURL windowState=" <%="WindowState.NORMAL.toString()" %>">
<portlet:param name="struts_action" value="/sports/sweetie/view" />
<portlet:param name="sweetieId" value="<%= String.valueOf(sweetie.getSweetieId()) %>" />
<portlet:param name="redirect" value="<%= currentURL %>" />
" method="post" name="<portlet:namespace />view<%= sweetie.getSweetieId() %>">
<input type="submit" value="VIEW PICS">
</form>
Any ideas? Thanks!
-Dave
Wilson Man, modificado hace 14 años.
RE: URL can only be invoked using POST?
Liferay Master Mensajes: 581 Fecha de incorporación: 21/06/06 Mensajes recientes
in your form element, add this attribute:
method="post"
Dave Willis, modificado hace 14 años.
RE: URL can only be invoked using POST?
Expert Mensajes: 301 Fecha de incorporación: 13/07/09 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, modificado hace 14 años.
RE: URL can only be invoked using POST?
Regular Member Mensajes: 177 Fecha de incorporación: 24/04/09 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, modificado hace 14 años.
RE: URL can only be invoked using POST?
Expert Mensajes: 301 Fecha de incorporación: 13/07/09 Mensajes recientes
Ah. I wondered if that was the case.
Wilson Man, modificado hace 14 años.
RE: URL can only be invoked using POST?
Liferay Master Mensajes: 581 Fecha de incorporación: 21/06/06 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?
anyhow, i take it you have a struts action class that's mapped to the struts_action path right?
Victor Zorin, modificado hace 14 años.
RE: URL can only be invoked using POST?
Liferay Legend Mensajes: 1228 Fecha de incorporación: 14/04/08 Mensajes recientes
Probably missing a processAction(...) method in a mapped class definition:
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.
public void processAction(ActionMapping mapping, ActionForm form,
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, modificado hace 14 años.
RE: URL can only be invoked using POST?
Expert Mensajes: 301 Fecha de incorporación: 13/07/09 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, modificado hace 14 años.
RE: URL can only be invoked using POST? [resolved]
Regular Member Mensajes: 162 Fecha de incorporación: 8/06/07 Mensajes recientes
Then solution for this error is override following method in action class:
- Tarun Kayasth
CIGNEX Technologies Pvt. Ltd.
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, modificado hace 14 años.
RE: URL can only be invoked using POST? [resolved]
Regular Member Mensajes: 115 Fecha de incorporación: 7/07/06 Mensajes recientesTarun 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, modificado hace 14 años.
RE: URL can only be invoked using POST? [resolved]
Regular Member Mensajes: 115 Fecha de incorporación: 7/07/06 Mensajes recientes
using
but using
who knows the cause?
<input type="button" value="<liferay-ui:message key=" select-houser">" onClick="location.href = '<%= HtmlUtil.escape(selectHouserURL) %>';" />
need to overridebut using
<liferay-ui:icon image="select-houser" url="<%= selectHouserURL%>" />
don't needwho knows the cause?
xun ren, modificado hace 13 años.
RE: URL can only be invoked using POST? [resolved]
Junior Member Mensajes: 81 Fecha de incorporación: 1/04/08 Mensajes recientesSohui Gu:
usingneed to override<input type="button" value="<liferay-ui:message key=" select-houser">" onClick="location.href = '<%= HtmlUtil.escape(selectHouserURL) %>';" />
but usingdon't need<liferay-ui:icon image="select-houser" url="<%= selectHouserURL%>" />
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