Package org.mortbay.http

Examples of org.mortbay.http.HttpException


                 if (handler.handle(pathInContext, "", new RequestAdapter(request), new ResponseAdapter(response))) {
                    request.setHandled(true);
                    return;
                }
            } catch (RequestHandlerException e) {
                throw new HttpException(e.getCode(), e.getMessage());
            }
           
      }
     
        if(!request.isConfidential()) {
View Full Code Here


                    break;
                }
                Thread.currentThread().setContextClassLoader(oldLoader);
            } catch (RequestHandlerException e) {
                log.error("Failed to handle request. Status code " + e.getCode());
                throw new HttpException(e.getCode(), e.getMessage());
            }
        }
    }
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.isConfidential()) {
                    throw new HttpException(403);
                }
            } else if (isIntegralTransportGuarantee) {
                if (!req.isIntegral()) {
                    throw new HttpException(403);
                }
            }
            Thread currentThread = Thread.currentThread();
            ClassLoader oldClassLoader = currentThread.getContextClassLoader();
            currentThread.setContextClassLoader(classLoader);
            try {
                if (authenticator != null) {
                    String pathInContext = org.mortbay.util.URI.canonicalPath(req.getPath());
                    if (authenticator.authenticate(realm, pathInContext, req, res) == null) {
                        throw new HttpException(403);
                    }
                }
                try {
                    webServiceContainer.invoke(request, response);
                    req.setHandled(true);
                } catch (IOException e) {
                    throw e;
                } catch (Exception e) {
                    throw (HttpException) new HttpException(500, "Could not process message!").initCause(e);
                }
            } finally {
                currentThread.setContextClassLoader(oldClassLoader);
            }
        }
View Full Code Here

//       Authenticator authenticator = getAuthenticator();
        Principal user = null;
        if (!unauthenticated && !forbidden) {
            if (realm == null) {
//               log.warn("Realm Not Configured");
                throw new HttpException(HttpResponse.__500_Internal_Server_Error, "Realm Not Configured");
            }


            // Handle pre-authenticated request
            if (authenticator != null) {
                // User authenticator.
                user = authenticator.authenticate(realm, pathInContext, request, response);
            } else {
                // don't know how authenticate
//               log.warn("Mis-configured Authenticator for " + request.getPath());
                throw new HttpException(HttpResponse.__500_Internal_Server_Error, "Mis-configured Authenticator for " + request.getPath());
            }

            return user;
        } else if (authenticator instanceof FormAuthenticator && pathInContext.endsWith(FormAuthenticator.__J_SECURITY_CHECK)) {
            /**
             * This could be a post request to __J_SECURITY_CHECK.
             */
            if (realm == null) {
//               log.warn("Realm Not Configured");
                throw new HttpException(HttpResponse.__500_Internal_Server_Error, "Realm Not Configured");
            }
            return authenticator.authenticate(realm, pathInContext, request, response);
        }

        /**
 
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.isConfidential()) {
                    throw new HttpException(403);
                }
            } else if (isIntegralTransportGuarantee) {
                if (!req.isIntegral()) {
                    throw new HttpException(403);
                }
            }
            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.URI.canonicalPath(req.getPath());
                    if (authenticator.authenticate(realm, pathInContext, req, res) == null) {
                        throw new HttpException(403);
                    }
                } else {
                    //EJB will figure out correct defaultSubject shortly
                    //TODO consider replacing the GenericEJBContainer.DefaultSubjectInterceptor with this line
                    //setting the defaultSubject.
                    ContextManager.setCurrentCaller(null);
                }
                try {
                    webServiceContainer.invoke(request, response);
                    req.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.isConfidential()) {
                    throw new HttpException(403);
                }
            } else if (isIntegralTransportGuarantee) {
                if (!req.isIntegral()) {
                    throw new HttpException(403);
                }
            }
            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.URI.canonicalPath(req.getPath());
                    if (authenticator.authenticate(realm, pathInContext, req, res) == null) {
                        throw new HttpException(403);
                    }
                } 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);
                    req.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.isConfidential()) {
                    throw new HttpException(403);
                }
            } else if (isIntegralTransportGuarantee) {
                if (!req.isIntegral()) {
                    throw new HttpException(403);
                }
            }
            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.URI.canonicalPath(req.getPath());
                    if (authenticator.authenticate(realm, pathInContext, req, res) == null) {
                        throw new HttpException(403);
                    }
                } 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);
                    req.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

        Authenticator authenticator = getAuthenticator();
        Principal user = null;
        if (!unauthenticated && !forbidden) {
            if (realm == null) {
                log.warn("Realm Not Configured");
                throw new HttpException(HttpResponse.__500_Internal_Server_Error, "Realm Not Configured");
            }


            // Handle pre-authenticated request
            if (authenticator != null) {
                // User authenticator.
                user = authenticator.authenticate(realm, pathInContext, request, response);
            } else {
                // don't know how authenticate
                log.warn("Mis-configured Authenticator for " + request.getPath());
                throw new HttpException(HttpResponse.__500_Internal_Server_Error, "Mis-configured Authenticator for " + request.getPath());
            }

            return user;
        } else if (authenticator instanceof FormAuthenticator && pathInContext.endsWith(FormAuthenticator.__J_SECURITY_CHECK)) {
            /**
             * This could be a post request to __J_SECURITY_CHECK.
             */
            if (realm == null) {
                log.warn("Realm Not Configured");
                throw new HttpException(HttpResponse.__500_Internal_Server_Error, "Realm Not Configured");
            }
            return authenticator.authenticate(realm, pathInContext, request, response);
        }

        /**
 
View Full Code Here

                try {
                    if (newTransactionContext != null) {
                        if (newTransactionContext != transactionContextManager.getContext()) {
                            transactionContextManager.getContext().rollback();
                            newTransactionContext.rollback();
                            throw new HttpException(500, "WRONG EXCEPTION! returned from servlet call with wrong tx context");
                        }
                        newTransactionContext.commit();

                    } else {
                        if (oldTransactionContext != transactionContextManager.getContext()) {
                            if (transactionContextManager.getContext() != null) {
                                transactionContextManager.getContext().rollback();
                            }
                            throw new HttpException(500, "WRONG EXCEPTION! returned from servlet call with wrong tx context");
                        }
                    }
                } catch (SystemException e) {
                    throw (HttpException) new HttpException(500, "WRONG EXCEPTION!").initCause(e);
                } catch (HeuristicMixedException e) {
                    throw (HttpException) new HttpException(500, "WRONG EXCEPTION!").initCause(e);
                } catch (HeuristicRollbackException e) {
                    throw (HttpException) new HttpException(500, "WRONG EXCEPTION!").initCause(e);
                } catch (RollbackException e) {
                    throw (HttpException) new HttpException(500, "WRONG EXCEPTION!").initCause(e);
                } finally {
                    //this is redundant when we enter with an inheritable context and nothing goes wrong.
                    transactionContextManager.setContext(oldTransactionContext);
                }
            }
View Full Code Here

                        transactionContextManager.setContext(null);
                        try {
                            transactionContext.commit();
                        } catch (Exception e) {
                            //TODO this is undoubtedly the wrong error code!
                            throw (HttpException) new HttpException(500, "Problem committing unspecified transaction context").initCause(e);
                        }
                    }
                }
            } finally {
                try {
View Full Code Here

TOP

Related Classes of org.mortbay.http.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.