Created
September 4, 2012 09:24
-
-
Save topolik/3619076 to your computer and use it in GitHub Desktop.
redirect after exception from serve resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void serveResource( | |
ResourceRequest resourceRequest, ResourceResponse resourceResponse) | |
throws PortletException { | |
try { | |
... generate csv | |
... set response headers | |
... write csv | |
} catch (Exception e) { | |
SessionErrors.add(resourceRequest, e.getClass().getName()); | |
// see http://issues.liferay.com/browse/LPS-13039 | |
// if (liferay version is <= 6.1.0 GA1) { | |
((com.liferay.portal.kernel.portlet.LiferayPortletResponse) resourceResponse).getHttpServletResponse().setStatus(302); | |
// } else { | |
// resourceResponse.setProperty(ResourceResponse.HTTP_STATUS_CODE, "302"); | |
// } | |
resourceResponse.addProperty("Location", resourceResponse.createRenderURL().toString()); | |
return; | |
} | |
} |
+1
Thanks! :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1 @MagmaRules