Package javax.servlet

Examples of javax.servlet.ServletRequest


        throws IOException, ServletException {

        // Perform the request
        getNext().invoke(request, response);

        ServletRequest sreq = (ServletRequest) request;
        Throwable throwable =
            (Throwable) sreq.getAttribute(Globals.EXCEPTION_ATTR);

        ServletResponse sresp = (ServletResponse) response;
        if (sresp.isCommitted()) {
            return;
        }
View Full Code Here


        //the ServletRequest with a class other than HttpServletRequestWrapper
        //this will fail.
        //todo: fix this to work in PortletRequest as well
        if(facesContext.getExternalContext().getRequest() instanceof ServletRequest)
        {
            ServletRequest multipartRequest = (ServletRequest)facesContext.getExternalContext().getRequest();
            while (multipartRequest != null &&
                   !(multipartRequest instanceof MultipartRequestWrapper))
            {
                if (multipartRequest instanceof HttpServletRequestWrapper)
                {
View Full Code Here

     */
    public void doFilter(ServletRequest request, ServletResponse response)
        throws IOException, ServletException {

        if( Globals.IS_SECURITY_ENABLED ) {
            final ServletRequest req = request;
            final ServletResponse res = response;
            try {
                java.security.AccessController.doPrivileged(
                    new java.security.PrivilegedExceptionAction() {
                        public Object run()
View Full Code Here

                filter = filterConfig.getFilter();
                support.fireInstanceEvent(InstanceEvent.BEFORE_FILTER_EVENT,
                                          filter, request, response);
               
                if( Globals.IS_SECURITY_ENABLED ) {
                    final ServletRequest req = request;
                    final ServletResponse res = response;
                    Principal principal =
                        ((HttpServletRequest) req).getUserPrincipal();

                    Object[] args = new Object[]{req, res, this};
                    SecurityUtil.doAsPrivilege
                        ("doFilter", filter, classType, args);
                   
                    args = null;
                } else
                    filter.doFilter(request, response, this);
                }

                support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                                          filter, request, response);
            } catch (IOException e) {
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                                              filter, request, response, e);
                throw e;
            } catch (ServletException e) {
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                                              filter, request, response, e);
                throw e;
            } catch (RuntimeException e) {
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                                              filter, request, response, e);
                throw e;
            } catch (Throwable e) {
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                                              filter, request, response, e);
                throw new ServletException
                  (sm.getString("filterChain.filter"), e);
            }
            return;
        }

        // We fell off the end of the chain -- call the servlet instance
        try {
            if (Globals.STRICT_SERVLET_COMPLIANCE) {
                lastServicedRequest.set(request);
                lastServicedResponse.set(response);
            }

            support.fireInstanceEvent(InstanceEvent.BEFORE_SERVICE_EVENT,
                                      servlet, request, response);
            if ((request instanceof HttpServletRequest) &&
                (response instanceof HttpServletResponse)) {
                   
                if( Globals.IS_SECURITY_ENABLED ) {
                    final ServletRequest req = request;
                    final ServletResponse res = response;
                    Principal principal =
                        ((HttpServletRequest) req).getUserPrincipal();
                    Object[] args = new Object[]{req, res};
                    SecurityUtil.doAsPrivilege("service",
View Full Code Here

    public void insertURL(String servletPath) throws JspException
    {
        if (LOG.isDebugEnabled())
            LOG.debug("Obtaining Tapestry URL for service " + _serviceName + " at " + servletPath);

        ServletRequest request = _pageContext.getRequest();

        RequestDispatcher dispatcher = request.getRequestDispatcher(servletPath);

        if (dispatcher == null)
            throw new JspException(
                Tapestry.format("URLRetriever.unable-to-find-dispatcher", servletPath));

        request.setAttribute(Tapestry.TAG_SUPPORT_SERVICE_ATTRIBUTE, _serviceName);
        request.setAttribute(Tapestry.TAG_SUPPORT_PARAMETERS_ATTRIBUTE, _serviceParameters);
        request.setAttribute(Tapestry.TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE, servletPath);

        try
        {
            _pageContext.getOut().flush();

            dispatcher.include(request, _pageContext.getResponse());
        }
        catch (IOException ex)
        {
            throw new JspException(
                Tapestry.format("URLRetriever.io-exception", servletPath, ex.getMessage()));
        }
        catch (ServletException ex)
        {
            throw new JspException(
                Tapestry.format("URLRetriever.servlet-exception", servletPath, ex.getMessage()));
        }
        finally
        {
            request.removeAttribute(Tapestry.TAG_SUPPORT_SERVICE_ATTRIBUTE);
            request.removeAttribute(Tapestry.TAG_SUPPORT_PARAMETERS_ATTRIBUTE);
            request.removeAttribute(Tapestry.TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE);
        }

    }
View Full Code Here

*/
public class GaeAuthenticationEntryPointTest {

    /** Test commence(). */
    @Test public void testCommence() throws Exception {
        ServletRequest request = mock(ServletRequest.class);
        ServletResponse response = mock(ServletResponse.class);
        AuthenticationException exception = mock(AuthenticationException.class);
        GaeAuthenticationEntryPoint entryPoint = new GaeAuthenticationEntryPoint();
        entryPoint.commence(request, response, exception)// just make sure it runs (it's a no-op)
    }
View Full Code Here

      Object request = facesContext.getExternalContext().getRequest();
      boolean okay = false;
      if (request instanceof TobagoMultipartFormdataRequest) {
        okay = true;
      } else if (request instanceof HttpServletRequestWrapper) {
        ServletRequest wrappedRequest
            = ((HttpServletRequestWrapper) request).getRequest();
        if (wrappedRequest instanceof TobagoMultipartFormdataRequest) {
          okay = true;
        }
      }
View Full Code Here

                                exchange.getOut().setBody(customer);
                            } else {
                                if ("/customerservice/customers/400".equals(path)) {
                                    // We return the remote client IP address this time
                                    org.apache.cxf.message.Message cxfMessage = inMessage.getHeader(CxfConstants.CAMEL_CXF_MESSAGE, org.apache.cxf.message.Message.class);
                                    ServletRequest request = (ServletRequest) cxfMessage.get("HTTP.REQUEST");
                                    String remoteAddress = request.getRemoteAddr();
                                    Response r = Response.status(200).entity("The remoteAddress is " + remoteAddress).build();
                                    exchange.getOut().setBody(r);
                                    return;
                                }
                                if ("/customerservice/customers/123".equals(path)) {
View Full Code Here

    @Typed(HttpServletRequest.class)
    @DeltaSpike
    @RequestScoped
    public HttpServletRequest getHttpServletRequest()
    {
        ServletRequest request = RequestResponseHolder.REQUEST.get();
        if (request instanceof HttpServletRequest)
        {
            return (HttpServletRequest) request;
        }
        throw new IllegalStateException("The current request is not a HttpServletRequest");
View Full Code Here

    @Produces
    @DeltaSpike
    @RequestScoped
    public HttpSession getHttpSession()
    {
        ServletRequest request = RequestResponseHolder.REQUEST.get();
        if (request instanceof HttpServletRequest)
        {
            return ((HttpServletRequest) request).getSession(true);
        }
        throw new IllegalStateException(
View Full Code Here

TOP

Related Classes of javax.servlet.ServletRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.