/** * Handle the specified ServletException encountered while processing * the specified Request to produce the specified Response. Any * exceptions that occur during generation of the exception report are * logged and swallowed. * * @param request The request being processed * @param response The response being generated * @param exception The exception that occurred (which possibly wraps * a root cause exception */ private void exception(Request request, Response response, Throwable exception) { ServletRequest sreq = request.getRequest(); sreq.setAttribute(RequestDispatcher.ERROR_EXCEPTION, exception); ServletResponse sresponse = response.getResponse(); /* GlassFish 6386229 if (sresponse instanceof HttpServletResponse) ((HttpServletResponse) sresponse).setStatus (HttpServletResponse.SC_INTERNAL_SERVER_ERROR); */ // START GlassFish 6386229 ((HttpServletResponse) sresponse).setStatus (HttpServletResponse.SC_INTERNAL_SERVER_ERROR); // END GlassFish 6386229 }
/** * Check for the broken MS WebDAV client and if detected issue a re-direct * that hopefully will cause the non-broken client to be used. */ public int invoke(Request request, Response response) throws IOException, ServletException { HttpServletRequest hreq = (HttpServletRequest)request.getRequest(); HttpServletResponse hres = (HttpServletResponse)response.getResponse(); String ua = hreq.getHeader("User-Agent"); if (ua != null && ua.contains("MiniRedir")) { hres.sendRedirect(buildRedirect(hreq)); return END_PIPELINE; } else { return INVOKE_NEXT; } }
ServletRequest sr = request.getRequest(); HttpServletRequest hsr = null; if (sr instanceof HttpServletRequest)
/** * Extract the desired request property, and pass it (along with the * specified request and response objects) to the protected * <code>process()</code> method to perform the actual filtering. * This method must be implemented by a concrete subclass. * * @param request The servlet request to be processed * @param response The servlet response to be created * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */ public int invoke(Request request, Response response) throws IOException, ServletException { return process(request.getRequest().getRemoteAddr(), request, response); }
/** * Extract the desired request property, and pass it (along with the * specified request and response objects) to the protected * <code>process()</code> method to perform the actual filtering. * This method must be implemented by a concrete subclass. * * @param request The servlet request to be processed * @param response The servlet response to be created * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */ public int invoke(Request request, Response response) throws IOException, ServletException { return process(request.getRequest().getRemoteHost(), request, response); }
null!=request.getRequest().getAttribute(condition)) { return;
private Host preInvoke(Request request, Response response) throws IOException, ServletException { // Select the Host to be used for this Request Host host = request.getHost(); if (host == null) { // BEGIN S1AS 4878272 ((HttpServletResponse) response.getResponse()).sendError (HttpServletResponse.SC_BAD_REQUEST); String msg = MessageFormat.format(rb.getString(LogFacade.NO_HOST_MATCH), request.getRequest().getServerName()); response.setDetailMessage(msg); // END S1AS 4878272 return null; } return host; } }
/** * Appends an access log entry line, with info obtained from the given * request and response objects, to the given CharBuffer. * * @param request The request object from which to obtain access log info * @param response The response object from which to obtain access log info * @param charBuffer The CharBuffer to which to append access log info */ public void appendLogEntry(Request request, Response response, CharBuffer charBuffer) { super.appendLogEntry(request, response, charBuffer); ServletRequest req = request.getRequest(); HttpServletRequest hreq = (HttpServletRequest) req; appendReferer(charBuffer, hreq); charBuffer.put(SPACE); appendUserAgent(charBuffer, hreq); }
public void postInvoke(Request request, Response response) throws IOException, ServletException{ ServletRequest req = request.getRequest(); HttpServletRequest hreq = null; if(req instanceof HttpServletRequest)
/** * Appends an access log entry line, with info obtained from the given * request and response objects, to the given CharBuffer. * * @param request The request object from which to obtain access log info * @param response The response object from which to obtain access log info * @param charBuffer The CharBuffer to which to append access log info */ public void appendLogEntry(Request request, Response response, CharBuffer charBuffer) { ServletRequest req = request.getRequest(); HttpServletRequest hreq = (HttpServletRequest) req; appendClientName(charBuffer, req); charBuffer.put(SPACE); appendClientId(charBuffer, req); charBuffer.put(SPACE); appendAuthUserName(charBuffer, hreq); charBuffer.put(SPACE); appendCurrentDate(charBuffer); charBuffer.put(SPACE); appendRequestInfo(charBuffer, hreq); charBuffer.put(SPACE); appendResponseStatus(charBuffer, response); charBuffer.put(SPACE); appendResponseLength(charBuffer, response); charBuffer.put(SPACE); }
ServletRequest sreq = request.getRequest(); ServletResponse sresp = response.getResponse();
private Context preInvoke(Request request, Response response) throws IOException, ServletException { // Select the Context to be used for this Request Context context = request.getContext(); if (context == null) { // BEGIN S1AS 4878272 ((HttpServletResponse) response.getResponse()).sendError (HttpServletResponse.SC_INTERNAL_SERVER_ERROR); response.setDetailMessage(rb.getString(LogFacade.NO_CONTEXT_TO_PROCESS)); // END S1AS 4878272 return null; } // Bind the context CL to the current thread if( context.getLoader() != null ) { // Not started - it should check for availability first // This should eventually move to Engine, it's generic. Thread.currentThread().setContextClassLoader (context.getLoader().getClassLoader()); } // START GlassFish Issue 1057 // Update the session last access time for our session (if any) HttpServletRequest hreq = (HttpServletRequest) request.getRequest(); hreq.getSession(false); // END GlassFish Issue 1057 context.fireRequestInitializedEvent(hreq); return context; }
throws IOException, ServletException { HttpServletRequest hreq = (HttpServletRequest) request.getRequest(); HttpServletResponse hres = (HttpServletResponse) response.getResponse();
public void invoke(Request request, Response response, ValveContext context) throws IOException, ServletException ServletRequest servRequest = request.getRequest(); if (servRequest instanceof HttpServletRequest)
ServletRequest sr = request.getRequest(); HttpServletRequest hsr = null; if (sr instanceof HttpServletRequest)
HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
private void handleError(Request request, Response response, int statusCode) throws IOException { ServletRequest sreq = request.getRequest(); ServletResponse sres = response.getResponse(); HttpServletResponse hres = (HttpServletResponse)sres;
/** * Processes the specified request, and produces the appropriate * response, by invoking the first valve (if any) of this pipeline, or * the pipeline's basic valve. * * If the request path to process identifies an ad-hoc path, the * web module's ad-hoc pipeline is invoked. * * @param request The request to process * @param response The response to return */ public void invoke(Request request, Response response) throws IOException, ServletException { HttpServletRequest hreq = (HttpServletRequest) request.getRequest(); if (webModule != null && webModule.getAdHocServletName(hreq.getServletPath()) != null) { webModule.getAdHocPipeline().invoke(request, response); } else { RealmAdapter realmAdapter = (RealmAdapter)webModule.getRealm(); if (realmAdapter != null && realmAdapter.isSecurityExtensionEnabled()){ super.doChainInvoke(request, response); } else { super.invoke(request, response); } } }
(HttpServletRequest) request.getRequest();
HttpServletRequest hreq = (HttpServletRequest) request.getRequest(); String sessionId = hreq.getRequestedSessionId(); Manager manager = context.getManager();