Refine search
@Override public void destroy() { super.destroy(); appHandler.onShutdown(this); appHandler = null; }
@Override public void start() { super.start(); appHandler.onStartup(this); }
request.setRequestExecutorProvider(getRequestExecutorProvider()); request.setSessionCookieName(getSessionCookieName()); request.setSessionManager(getSessionManager(request)); response.setErrorPageGenerator(getErrorPageGenerator(request)); if (request.requiresAcknowledgement()) { if (!sendAcknowledgment(request, response)) { return true; final HttpRequestPacket httpRequestPacket = request.getRequest(); final RequestURIRef requestURIRef = httpRequestPacket.getRequestURIRef(); requestURIRef.setDefaultURIEncoding(requestURIEncoding); requestURIRef.getDecodedRequestURIBC(allowEncodedSlash); } catch (CharConversionException e) { response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500); response.setDetailMessage("Invalid URI: " + e.getMessage()); return true; request.parseSessionId(); return runService(request, response); } catch (Exception t) { LOGGER.log(Level.WARNING,
boolean doHandle(final Request request, final Response response) throws Exception { response.setErrorPageGenerator(getErrorPageGenerator(request)); final HttpHandler rh = rootHttpHandlerLocal.httpHandler; rootHttpHandlerLocal.pathUpdater.update(this, rh, request); return rh.doHandle(request, response); final RequestURIRef uriRef = request.getRequest().getRequestURIRef(); uriRef.setDefaultURIEncoding(getRequestURIEncoding()); final DataChunk decodedURI = uriRef.getDecodedRequestURIBC( isAllowEncodedSlash()); final MappingData mappingData = request.obtainMappingData(); mapper.mapUriWithSemicolon(request.getRequest(), decodedURI, mappingData, return httpHandler.doHandle(request, response); } else { response.sendError(404); response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Internal server error", t);
@Override public void service(Request request, Response response) throws Exception { if (request.getMethod().equals(Method.GET) && request.getRequestURI().endsWith("application.wsadl")) { getWsadlJaxbContext().createMarshaller().marshal(engine.getWsadlApplication(), response.getWriter()); response.setStatus(200); response.setContentType(ContentType.newContentType("application/wsadl+xml")); return; } if (staticHttpHandler != null) { staticHttpHandler.service(request, response); } else { response.sendError(404); } } }
@Override public void run() { final SuspendStatus suspendStatus = response.initSuspendStatus(); HttpHandler.this); service(request, response); wasSuspended = suspendStatus.getAndInvalidate(); } catch (Throwable e) { LOGGER.log(Level.FINE, "service exception", e); if (!response.isCommitted()) { response.reset(); try { HtmlHelper.setErrorAndSendErrorPage(
@Override public String resolve(final Request request) { try { final RequestURIRef uriRef = request.getRequest().getRequestURIRef(); uriRef.setDefaultURIEncoding(httpHandler.getRequestURIEncoding()); final DataChunk decodedURI = uriRef.getDecodedRequestURIBC( httpHandler.isAllowEncodedSlash()); final int pos = decodedURI.indexOf(';', 0); return pos < 0 ? decodedURI.toString() : decodedURI.toString(0, pos); } catch (CharConversionException e) { throw new IllegalStateException(e); } }
private boolean runService(final Request request, final Response response) throws Exception { final Executor threadPool = getRequestExecutorProvider().getExecutor(request); final HttpServerFilter httpServerFilter = request.getServerFilter(); final Connection connection = request.getContext().getConnection(); final SuspendStatus suspendStatus = response.initSuspendStatus(); service(request, response); return !suspendStatus.getAndInvalidate(); } else { final FilterChainContext ctx = request.getContext(); ctx.suspend();
createContext("/", new HttpHandler(){ @Override void handle(final HttpExchange exchange) throws IOException { // use getRequestURI() } });
/** * Override parent's {@link HttpHandler#sendAcknowledgment(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response)} * to let {@link ExpectationHandler} (if one is registered) process the expectation. */ @Override protected boolean sendAcknowledgment(Request request, Response response) throws IOException { return expectationHandler != null || super.sendAcknowledgment(request, response); }
@Override public Object call() throws Exception { httpHandler.service(request, response); return null; } }
HttpHandler http = new HttpHandler(); String jsonSrc = http.makeServiceCall("https://api.wheretheiss.at/v1/satellites/25544"); JSONObject jsonObj = new JSONObject(jsonSrc); String value = jsonObj.getString("latitude");
HttpHandler httpHandler = new HttpHandler(); jsonStr = httpHandler.runHttpRequest(url_MAPS); try { JSONArray jsonArray = new JSONArray(jsonStr); // Getting JSON Array node // looping through for (int i = 0; i < jsonArray.length(); i++) { jsonObj = jsonArray.getJSONObject(i); String title = jsonObj.getString(TAG_TITLE); responseList.add(title); } } catch (JSONException e) { e.printStackTrace(); }
request.setRequestExecutorProvider(getRequestExecutorProvider()); request.setSessionCookieName(getSessionCookieName()); request.setSessionManager(getSessionManager(request)); response.setErrorPageGenerator(getErrorPageGenerator(request)); if (request.requiresAcknowledgement()) { if (!sendAcknowledgment(request, response)) { return true; final HttpRequestPacket httpRequestPacket = request.getRequest(); final RequestURIRef requestURIRef = httpRequestPacket.getRequestURIRef(); requestURIRef.setDefaultURIEncoding(requestURIEncoding); requestURIRef.getDecodedRequestURIBC(allowEncodedSlash); } catch (CharConversionException e) { response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500); response.setDetailMessage("Invalid URI: " + e.getMessage()); return true; request.parseSessionId(); return runService(request, response); } catch (Exception t) { LOGGER.log(Level.WARNING,
boolean doHandle(final Request request, final Response response) throws Exception { response.setErrorPageGenerator(getErrorPageGenerator(request)); final HttpHandler rh = rootHttpHandlerLocal.httpHandler; rootHttpHandlerLocal.pathUpdater.update(this, rh, request); return rh.doHandle(request, response); final RequestURIRef uriRef = request.getRequest().getRequestURIRef(); uriRef.setDefaultURIEncoding(getRequestURIEncoding()); final DataChunk decodedURI = uriRef.getDecodedRequestURIBC( isAllowEncodedSlash()); final MappingData mappingData = request.obtainMappingData(); mapper.mapUriWithSemicolon(request.getRequest(), decodedURI, mappingData, return httpHandler.doHandle(request, response); } else { response.sendError(404); response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Internal server error", t);
@Override public void run() { final SuspendStatus suspendStatus = response.initSuspendStatus(); HttpHandler.this); service(request, response); wasSuspended = suspendStatus.getAndInvalidate(); } catch (Throwable e) { LOGGER.log(Level.FINE, "service exception", e); if (!response.isCommitted()) { response.reset(); try { HtmlHelper.setErrorAndSendErrorPage(
@Override public String resolve(final Request request) { try { final RequestURIRef uriRef = request.getRequest().getRequestURIRef(); uriRef.setDefaultURIEncoding(httpHandler.getRequestURIEncoding()); final DataChunk decodedURI = uriRef.getDecodedRequestURIBC( httpHandler.isAllowEncodedSlash()); final int pos = decodedURI.indexOf(';', 0); return pos < 0 ? decodedURI.toString() : decodedURI.toString(0, pos); } catch (CharConversionException e) { throw new IllegalStateException(e); } }
private boolean runService(final Request request, final Response response) throws Exception { final Executor threadPool = getRequestExecutorProvider().getExecutor(request); final HttpServerFilter httpServerFilter = request.getServerFilter(); final Connection connection = request.getContext().getConnection(); final SuspendStatus suspendStatus = response.initSuspendStatus(); service(request, response); return !suspendStatus.getAndInvalidate(); } else { final FilterChainContext ctx = request.getContext(); ctx.suspend();