Search in sources :

Example 1 with BaseRequestImpl

use of com.dexels.navajo.server.listener.http.impl.BaseRequestImpl in project navajo by Dexels.

the class TmlStandardServlet method doPost.

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    final LocalClient lc = (LocalClient) getServletContext().getAttribute("localClient");
    if (lc == null) {
        resp.sendError(500, "No local client registered in servlet context");
        return;
    }
    Object certObject = req.getAttribute("javax.servlet.request.X509Certificate");
    String recvEncoding = req.getHeader("Content-Encoding");
    String sendEncoding = req.getHeader("Accept-Encoding");
    AsyncRequest request = new BaseRequestImpl(req, resp, sendEncoding, recvEncoding, certObject, "default");
    TmlStandardRunner tr = new TmlStandardRunner(request, lc);
    getTmlScheduler().run(tr);
// TODO broken? fix
// getTmlScheduler().run(request.instantiateRunnable());
}
Also used : BaseRequestImpl(com.dexels.navajo.server.listener.http.impl.BaseRequestImpl) AsyncRequest(com.dexels.navajo.script.api.AsyncRequest) LocalClient(com.dexels.navajo.script.api.LocalClient)

Example 2 with BaseRequestImpl

use of com.dexels.navajo.server.listener.http.impl.BaseRequestImpl in project navajo by Dexels.

the class TmlRunnableBuilder method constructRequest.

private static AsyncRequest constructRequest(final HttpServletRequest req, HttpServletResponse resp, String instance) throws IOException {
    Object certObject = req.getAttribute("javax.servlet.request.X509Certificate");
    String contentEncoding = req.getHeader("Content-Encoding");
    String acceptEncoding = req.getHeader("Accept-Encoding");
    AsyncRequest request = null;
    if ("POST".equals(req.getMethod())) {
        request = new BaseRequestImpl(req, resp, acceptEncoding, contentEncoding, certObject, instance);
    } else {
        Navajo in = TmlHttpServlet.constructFromRequest(req);
        request = new BaseRequestImpl(in, req, resp, instance);
    }
    return request;
}
Also used : BaseRequestImpl(com.dexels.navajo.server.listener.http.impl.BaseRequestImpl) AsyncRequest(com.dexels.navajo.script.api.AsyncRequest) Navajo(com.dexels.navajo.document.Navajo)

Aggregations

AsyncRequest (com.dexels.navajo.script.api.AsyncRequest)2 BaseRequestImpl (com.dexels.navajo.server.listener.http.impl.BaseRequestImpl)2 Navajo (com.dexels.navajo.document.Navajo)1 LocalClient (com.dexels.navajo.script.api.LocalClient)1