/portal-impl/src/com/liferay/portlet/helloworld/HelloWorldPortlet.java

https://github.com/spreddy/liferay-portal · Java · 53 lines · 25 code · 12 blank · 16 comment · 0 complexity · cdc738f90e5b1779832ade433caed46c MD5 · raw file

  1. /**
  2. * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. package com.liferay.portlet.helloworld;
  15. import com.liferay.portal.kernel.util.ContentTypes;
  16. import com.liferay.portal.kernel.util.ReleaseInfo;
  17. import java.io.IOException;
  18. import java.io.PrintWriter;
  19. import javax.portlet.ActionRequest;
  20. import javax.portlet.ActionResponse;
  21. import javax.portlet.GenericPortlet;
  22. import javax.portlet.RenderRequest;
  23. import javax.portlet.RenderResponse;
  24. /**
  25. * @author Brian Wing Shun Chan
  26. */
  27. public class HelloWorldPortlet extends GenericPortlet {
  28. @Override
  29. public void processAction(
  30. ActionRequest actionRequest, ActionResponse actionResponse) {
  31. }
  32. @Override
  33. public void doView(
  34. RenderRequest renderRequest, RenderResponse renderResponse)
  35. throws IOException {
  36. renderResponse.setContentType(ContentTypes.TEXT_HTML_UTF8);
  37. PrintWriter writer = renderResponse.getWriter();
  38. writer.print("Welcome to " + ReleaseInfo.getReleaseInfo() + ".");
  39. writer.close();
  40. }
  41. }