Skip to content

Instantly share code, notes, and snippets.

@nixn

nixn/Servlet.php Secret

Created December 26, 2018 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nixn/9509e2d87acb924c150a92c4ecfdb675 to your computer and use it in GitHub Desktop.
Save nixn/9509e2d87acb924c150a92c4ecfdb675 to your computer and use it in GitHub Desktop.
appserver HelloWorld Servlet
<?php
// file /opt/appserver/webapps/hello/WEB-INF/classes/nix/Hello/Servlet.php
namespace nix\Hello;
use AppserverIo\Psr\Servlet\Annotations\Route;
use AppserverIo\Psr\Servlet\Http\HttpServlet;
use AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface as Request;
use AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface as Response;
/**
* @Route(name="hi", urlPattern={"/hi.do"})
*/
class Servlet extends HttpServlet
{
public function doGet(Request $request, Response $response)
{
$response->appendBodyStream("Hello from servlet!");
}
}
@nixn
Copy link
Author

nixn commented Dec 26, 2018

error: appserver stderr | [2018-12-26 18:38:13] - 1fe5dbbb9d3f (error): exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The annotation "@AppserverIo\Psr\Servlet\Annotations\Route" in class nix\Hello\Servlet does not exist, or could not be auto-loaded.' in /opt/appserver/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment