private URI getRequestUri(final Request request, final URI baseUri) { try { final String serverAddress = getServerAddress(baseUri); String uri = ContainerUtils.getHandlerPath(request.getTarget()); final String queryString = request.getQuery().toString(); if (queryString != null) { uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString); } return new URI(serverAddress + uri); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
/** * This can be used to get the URI specified for this HTTP request. * This corresponds to the either the full HTTP URI or the path * part of the URI depending on how the client sends the request. * * @return the URI address that this HTTP request is targeting */ public String getTarget() { return request.getTarget(); }
/** * This can be used to get the URI specified for this HTTP request. * This corresponds to the either the full HTTP URI or the path * part of the URI depending on how the client sends the request. * * @return the URI address that this HTTP request is targeting */ public String getTarget() { return request.getTarget(); }
/** * This can be used to get the URI specified for this HTTP request. * This corresponds to the either the full HTTP URI or the path * part of the URI depending on how the client sends the request. * * @return the URI address that this HTTP request is targeting */ public String getTarget() { return request.getTarget(); }
/** * Returns the full request URI. * * @return The full request URI. */ @Override public String getRequestUri() { return this.request.getTarget(); }
public String getTarget() { return request.getTarget(); }
public static String getUndecodedPath(Request request) { String path = request.getTarget(); int queryIndex = path.indexOf('?'); if (queryIndex != -1) { path = path.substring(0, queryIndex); } return path; } }
public SimpleRestxRequest(HttpSettings httpSettings, String apiPath, Request request) { super(httpSettings); this.apiPath = apiPath; this.request = request; String path = request.getTarget().substring(apiPath.length()); if (path.indexOf("?") != -1) { path = path.substring(0, path.indexOf("?")); } this.restxPath = path; }
public SimpleRestxRequest(HttpSettings httpSettings, String apiPath, Request request) { super(httpSettings); this.apiPath = apiPath; this.request = request; String path = request.getTarget().substring(apiPath.length()); if (path.indexOf("?") != -1) { path = path.substring(0, path.indexOf("?")); } this.restxPath = path; }
private void checkTasks() { long l; for( Task t : this.dispatchStage.queue ) { // check enqueue time l = System.currentTimeMillis() - t.enqueueTime; if( l > maxQueueTimeMillis ) { // bif it log.warn( "XXX task is too long in queue: " + l + "ms. " + t ); log.warn( "Queue Size: " + dispatchStage.queue.size() ); log.warn( "listing contents of queue -" ); for( Task q : dispatchStage.queue ) { log.warn( " - " + q.request.getTarget() ); } log.warn( "---" ); this.dispatchStage.queue.remove( t ); respondError( t ); } else { if( t.startTime > 0 ) { // check process time l = System.currentTimeMillis() - t.startTime; if( l > maxProcessTimeMillis ) { log.warn( "**** task is too long being processed: " + l + "ms. " + t ); t.thisThread.interrupt(); } } } } }
private void checkTasks() { long l; for (Task t : this.dispatchStage.queue) { // check enqueue time l = System.currentTimeMillis() - t.enqueueTime; if (l > maxQueueTimeMillis) { // bif it log.warn("XXX task is too long in queue: " + l + "ms. " + t); log.warn("Queue Size: " + dispatchStage.queue.size()); log.warn("listing contents of queue -"); for (Task q : dispatchStage.queue) { log.warn(" - " + q.request.getTarget()); } log.warn("---"); this.dispatchStage.queue.remove(t); respondError(t); } else { if (t.startTime > 0) { // check process time l = System.currentTimeMillis() - t.startTime; if (l > maxProcessTimeMillis) { log.warn("**** task is too long being processed: " + l + "ms. " + t); t.thisThread.interrupt(); } } } } } }
@Override public void handle(Request request, Response response) { try { if (request.getTarget().startsWith(routerPath)) { router.route( new SimpleRestxRequest(httpSettings, routerPath, request), new SimpleRestxResponse(response)); } else { response.getPrintStream().print("Not found..."); response.getPrintStream().close(); } } catch (IOException e) { throw new RuntimeException(e); } } };
@Override public void run() { thisThread = Thread.currentThread(); startTime = System.currentTimeMillis(); try { httpManager.process(getMiltonRequest(), getMiltonResponse()); //response.commit(); //response.getOutputStream().flush(); miltonResponse.close(); } catch (Exception e) { log.error("exception processing request: " + request.getTarget(), e); try { respondFinalError(this); } catch (Exception e2) { log.error("exception was thrown in processing, and again an exception was thrown generating error content", e2); } } }
@Override public void handle(Request request, Response response) { try { if (request.getTarget().startsWith(routerPath)) { router.route( new SimpleRestxRequest(httpSettings, routerPath, request), new SimpleRestxResponse(response)); } else { response.getPrintStream().print("Not found..."); response.getPrintStream().close(); } } catch (IOException e) { throw new RuntimeException(e); } } };
private URI getRequestUri(final Request request, final URI baseUri) { try { final String serverAddress = getServerAddress(baseUri); String uri = ContainerUtils.getHandlerPath(request.getTarget()); final String queryString = request.getQuery().toString(); if (queryString != null) { uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString); } return new URI(serverAddress + uri); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e); result.setAttribute("status", "failed"); result.setAttribute("msg", e.toString()); SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e); rsp.setCode(500); result.setAttribute("status", "failed"); rsString = XMLUtils.toXMLString(doc); } catch (TransformerException e) { SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e); rsp.close();
SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), err); result.setAttribute("status", "failed"); result.setAttribute("msg", err.toString()); rsString = XMLUtils.toXMLString(doc); } catch (TransformerException e2) { SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e2); try { rsp.close(); } catch (IOException e) { SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e); rsp.close(); } catch (IOException e) { SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e); result.setAttribute("status", "failed"); result.setAttribute("msg", e.toString()); SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e); rsp.setCode(500); result.setAttribute("status", "failed"); rsString = XMLUtils.toXMLString(doc); } catch (TransformerException e) { SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e); rsp.close();
public void handle(Request request, Response response) { WebApplication target = application; final URI baseUri = getBaseUri(request); final URI requestUri = baseUri.resolve(request.getTarget()); try { final ContainerRequest cRequest = new ContainerRequest( target, request.getMethod(), baseUri, requestUri, getHeaders(request), request.getInputStream()); target.handleRequest(cRequest, new Writer(request, response)); } catch (Exception ex) { throw new RuntimeException(ex); } finally { close(response); } }