Package org.mortbay.jetty

Examples of org.mortbay.jetty.HttpException


                webServiceContainer.getWsdl(request, response);
                jettyRequest.setHandled(true);
            } catch (IOException e) {
                throw e;
            } catch (Exception e) {
                throw (HttpException) new HttpException(500, "Could not fetch wsdl!").initCause(e);
            }
        } else {
            if (isConfidentialTransportGuarantee) {
                if (!req.isSecure()) {
                    throw new HttpException(403, null);
                }
            } else if (isIntegralTransportGuarantee) {
                if (!jettyRequest.getConnection().isIntegral(jettyRequest)) {
                    throw new HttpException(403, null);
                }
            }
            Thread currentThread = Thread.currentThread();
            ClassLoader oldClassLoader = currentThread.getContextClassLoader();
            currentThread.setContextClassLoader(classLoader);
            //hard to imagine this could be anything but null, but....
//            Subject oldSubject = ContextManager.getCurrentCaller();
            try {
                if (authenticator != null) {
                    String pathInContext = org.mortbay.util.URIUtil.canonicalPath(req.getContextPath());
                    if (authenticator.authenticate(realm, pathInContext, jettyRequest, jettyResponse) == null) {
                        throw new HttpException(403, null);
                    }
                } else {
                    //EJB will figure out correct defaultSubject shortly
                    //TODO consider replacing the GenericEJBContainer.DefaultSubjectInterceptor with this line
                    //setting the defaultSubject.
                    ContextManager.popCallers(null);
                }
                try {
                    webServiceContainer.invoke(request, response);
                    jettyRequest.setHandled(true);
                } catch (IOException e) {
                    throw e;
                } catch (Exception e) {
                    throw (HttpException) new HttpException(500, "Could not process message!").initCause(e);
                }
            } finally {
//                ContextManager.setCurrentCaller(oldSubject);
                currentThread.setContextClassLoader(oldClassLoader);
            }
View Full Code Here


                webServiceContainer.getWsdl(request, response);
                //WHO IS RESPONSIBLE FOR CLOSING OUT?
            } catch (IOException e) {
                throw e;
            } catch (Exception e) {
                throw (HttpException) new HttpException(500, "Could not fetch wsdl!").initCause(e);
            }
        } else {
            if (isConfidentialTransportGuarantee) {
                if (!req.isSecure()) {
                    throw new HttpException(403, null);
                }
            } else if (isIntegralTransportGuarantee) {
                if (!jettyRequest.getConnection().isIntegral(jettyRequest)) {
                    throw new HttpException(403, null);
                }
            }
            Thread currentThread = Thread.currentThread();
            ClassLoader oldClassLoader = currentThread.getContextClassLoader();
            currentThread.setContextClassLoader(classLoader);
            //hard to imagine this could be anything but null, but....
//            Subject oldSubject = ContextManager.getCurrentCaller();
            try {
                if (authenticator != null) {
                    String pathInContext = org.mortbay.util.URIUtil.canonicalPath(req.getContextPath());
                    if (authenticator.authenticate(realm, pathInContext, jettyRequest, jettyResponse) == null) {
                        throw new HttpException(403, null);
                    }
                } else {
                    //EJB will figure out correct defaultSubject shortly
                    //TODO consider replacing the GenericEJBContainer.DefaultSubjectInterceptor with this line
                    //setting the defaultSubject.
                    ContextManager.popCallers(null);
                }
                try {
                    webServiceContainer.invoke(request, response);
                    jettyRequest.setHandled(true);
                } catch (IOException e) {
                    throw e;
                } catch (Exception e) {
                    throw (HttpException) new HttpException(500, "Could not process message!").initCause(e);
                }
            } finally {
//                ContextManager.setCurrentCaller(oldSubject);
                currentThread.setContextClassLoader(oldClassLoader);
            }
View Full Code Here

        }

        public void parsedMethod(Buffer method) throws IOException
        {
            if (method == null)
                throw new HttpException(HttpServletResponse.SC_BAD_REQUEST);
            _request.setMethod(method.toString());
        }
View Full Code Here

                webServiceContainer.getWsdl(request, response);
                jettyRequest.setHandled(true);
            } catch (IOException e) {
                throw e;
            } catch (Exception e) {
                throw (HttpException) new HttpException(500, "Could not fetch wsdl!").initCause(e);
            }
        } else {
            if (isConfidentialTransportGuarantee) {
                if (!req.isSecure()) {
                    throw new HttpException(403, null);
                }
            } else if (isIntegralTransportGuarantee) {
                if (!jettyRequest.getConnection().isIntegral(jettyRequest)) {
                    throw new HttpException(403, null);
                }
            }
            Thread currentThread = Thread.currentThread();
            ClassLoader oldClassLoader = currentThread.getContextClassLoader();
            currentThread.setContextClassLoader(classLoader);
            //hard to imagine this could be anything but null, but....
//            Subject oldSubject = ContextManager.getCurrentCaller();
            try {
                if (authenticator != null) {
                    String pathInContext = org.mortbay.util.URIUtil.canonicalPath(req.getContextPath());
                    if (authenticator.authenticate(realm, pathInContext, jettyRequest, jettyResponse) == null) {
                        throw new HttpException(403, null);
                    }
                } else {
                    //EJB will figure out correct defaultSubject shortly
                    //TODO consider replacing the GenericEJBContainer.DefaultSubjectInterceptor with this line
                    //setting the defaultSubject.
                    ContextManager.popCallers(null);
                }
                try {
                    webServiceContainer.invoke(request, response);
                    jettyRequest.setHandled(true);
                } catch (IOException e) {
                    throw e;
                } catch (Exception e) {
                    throw (HttpException) new HttpException(500, "Could not process message!").initCause(e);
                }
            } finally {
//                ContextManager.setCurrentCaller(oldSubject);
                currentThread.setContextClassLoader(oldClassLoader);
            }
View Full Code Here

           
            // Handle the request
            try
            {
                if (dispatch==REQUEST && isProtectedTarget(target))
                    throw new HttpException(HttpServletResponse.SC_NOT_FOUND);
               
                Handler handler = getHandler();
                if (handler!=null)
                    handler.handle(target, request, response, dispatch);
            }
View Full Code Here

        WebUserDataPermission udp = new WebUserDataPermission(req);
        if (realm != null) {
            try {
                defaultAcc.checkPermission(udp);
            } catch (AccessControlException e) {
                throw new HttpException(HttpServletResponse.SC_FORBIDDEN);
            }
            if (authenticator != null) {
                String pathInContext = org.mortbay.util.URIUtil.canonicalPath(req.getContextPath());
                if (authenticator.authenticate(realm, pathInContext, jettyRequest, jettyResponse) == null) {
                    throw new HttpException(HttpServletResponse.SC_FORBIDDEN, null);
                }
            } else {
                //EJB will figure out correct defaultSubject shortly
                //TODO consider replacing the GenericEJBContainer.DefaultSubjectInterceptor with this line
                //setting the defaultSubject.
                ContextManager.popCallers(null);
            }
        }
        if (isWSDLRequest(req)) {
            try {
                webServiceContainer.getWsdl(request, response);
                jettyRequest.setHandled(true);
            } catch (IOException e) {
                throw e;
            } catch (Exception e) {
                throw (HttpException) new HttpException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not fetch wsdl!").initCause(e);
            }
        } else {
            try {
                webServiceContainer.invoke(request, response);
                jettyRequest.setHandled(true);
            } catch (IOException e) {
                throw e;
            } catch (Exception e) {
                throw (HttpException) new HttpException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not process message!").initCause(e);
            }
        }
    }
View Full Code Here

        }

        public void parsedMethod(Buffer method) throws IOException
        {
            if (method == null)
                throw new HttpException(HttpServletResponse.SC_BAD_REQUEST);
            _request.setMethod(method.toString());
        }
View Full Code Here

           
            // Handle the request
            try
            {
                if (dispatch==REQUEST && isProtectedTarget(target))
                    throw new HttpException(HttpServletResponse.SC_NOT_FOUND);
               
                Handler handler = getHandler();
                if (handler!=null)
                    handler.handle(target, request, response, dispatch);
            }
View Full Code Here

           
            // Handle the request
            try
            {
                if (dispatch==REQUEST && isProtectedTarget(target))
                    throw new HttpException(HttpServletResponse.SC_NOT_FOUND);
               
                Handler handler = getHandler();
                if (handler!=null)
                    handler.handle(target, request, response, dispatch);
            }
View Full Code Here

                webServiceContainer.getWsdl(request, response);
                jettyRequest.setHandled(true);
            } catch (IOException e) {
                throw e;
            } catch (Exception e) {
                throw (HttpException) new HttpException(500, "Could not fetch wsdl!").initCause(e);
            }
        } else {
            if (isConfidentialTransportGuarantee) {
                if (!req.isSecure()) {
                    throw new HttpException(403, null);
                }
            } else if (isIntegralTransportGuarantee) {
                if (!jettyRequest.getConnection().isIntegral(jettyRequest)) {
                    throw new HttpException(403, null);
                }
            }
            Thread currentThread = Thread.currentThread();
            ClassLoader oldClassLoader = currentThread.getContextClassLoader();
            currentThread.setContextClassLoader(classLoader);
            //hard to imagine this could be anything but null, but....
//            Subject oldSubject = ContextManager.getCurrentCaller();
            try {
                if (authenticator != null) {
                    String pathInContext = org.mortbay.util.URIUtil.canonicalPath(req.getContextPath());
                    if (authenticator.authenticate(realm, pathInContext, jettyRequest, jettyResponse) == null) {
                        throw new HttpException(403, null);
                    }
                } else {
                    //EJB will figure out correct defaultSubject shortly
                    //TODO consider replacing the GenericEJBContainer.DefaultSubjectInterceptor with this line
                    //setting the defaultSubject.
                    ContextManager.popCallers(null);
                }
                try {
                    webServiceContainer.invoke(request, response);
                    jettyRequest.setHandled(true);
                } catch (IOException e) {
                    throw e;
                } catch (Exception e) {
                    throw (HttpException) new HttpException(500, "Could not process message!").initCause(e);
                }
            } finally {
//                ContextManager.setCurrentCaller(oldSubject);
                currentThread.setContextClassLoader(oldClassLoader);
            }
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.HttpException

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.