代码示例:
public class CountingFactorizer implements Servlet {
private BigInteger lastNumber;
private BigInteger[] lastFactors;
public synchronized void service(ServletRequest req, ServletResponse resp) {
BigInteger i = extractFromRequest(req);
if (i.equals(lastNumber))
encodeIntoResponse(resp, lastFactors);
else {
BigInteger[] factors = factor(i);
lastNumber = i;
lastFactors = factors;
encodeIntoResponse(resp, factors);
}
}
}
它说无法解析符号" servlet" 。
我下载了servlet.jar并将其导入IDE,但是 extractFromRequest 和 encodeIntoResponse 方法仍然无法解析。
请告诉我如何解决它。
我的Java Enrivonment: Java SE8