commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morg...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty AbstractMethodHandlerTag.java HttpContextTag.java JellyResourceHandlerTag.java JettyHttpServerTag.java NotFoundHandlerTag.java RealmTag.java ResourceHandlerTag.java ResponseBodyTag.java ResponseCodeTag.java ResponseHeaderTag.java SecurityHandlerTag.java SocketListenerTag.java
Date Sun, 26 Jan 2003 04:42:38 GMT
morgand     2003/01/25 20:42:38

  Modified:    jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty
                        AbstractMethodHandlerTag.java HttpContextTag.java
                        JellyResourceHandlerTag.java
                        JettyHttpServerTag.java NotFoundHandlerTag.java
                        RealmTag.java ResourceHandlerTag.java
                        ResponseBodyTag.java ResponseCodeTag.java
                        ResponseHeaderTag.java SecurityHandlerTag.java
                        SocketListenerTag.java
  Log:
  converted jetty taglib from Exception to JellyTagException
  
  Revision  Changes    Path
  1.4       +3 -3      jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/AbstractMethodHandlerTag.java
  
  Index: AbstractMethodHandlerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/AbstractMethodHandlerTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractMethodHandlerTag.java	11 Dec 2002 12:40:59 -0000	1.3
  +++ AbstractMethodHandlerTag.java	26 Jan 2003 04:42:38 -0000	1.4
  @@ -61,7 +61,7 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -85,13 +85,13 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           JellyResourceHandlerTag parentTag =
               (JellyResourceHandlerTag) findAncestorWithClass(
                   JellyResourceHandlerTag.class);
   
           if ( parentTag == null ) {
  -            throw new JellyException( "<" + getMethodHandled().toLowerCase() +
  +            throw new JellyTagException( "<" + getMethodHandled().toLowerCase() +
                                         "Request> tag must be enclosed inside a <jellyResourceHandler>
tag" );
           }
   
  
  
  
  1.3       +16 -5     jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/HttpContextTag.java
  
  Index: HttpContextTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/HttpContextTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpContextTag.java	30 Oct 2002 13:22:45 -0000	1.2
  +++ HttpContextTag.java	26 Jan 2003 04:42:38 -0000	1.3
  @@ -61,7 +61,7 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -71,7 +71,9 @@
   import org.mortbay.http.SecurityConstraint.Authenticator;
   import org.mortbay.util.Resource;
   
  +import java.io.IOException;
   import java.net.URL;
  +import java.net.MalformedURLException;
   
   /**
    * Declare a context for a Jetty http server
  @@ -106,12 +108,12 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           JettyHttpServerTag httpserver = (JettyHttpServerTag) findAncestorWithClass(
               JettyHttpServerTag.class);
           if ( httpserver == null ) {
  -            throw new JellyException( "<httpContext> tag must be enclosed inside
a <server> tag" );
  +            throw new JellyTagException( "<httpContext> tag must be enclosed inside
a <server> tag" );
           }
   
           // allow nested tags first, e.g body
  @@ -121,8 +123,17 @@
   
           // convert the resource string to a URL
           // (this makes URL's relative to the location of the script
  -        URL baseResourceURL = getContext().getResource(getResourceBase());
  -        _context.setBaseResource(Resource.newResource(baseResourceURL));
  +        try {
  +            URL baseResourceURL = getContext().getResource(getResourceBase());
  +            _context.setBaseResource(Resource.newResource(baseResourceURL));
  +        } 
  +        catch (MalformedURLException e) {
  +            throw new JellyTagException(e);
  +        }
  +        catch (IOException e) {
  +            throw new JellyTagException(e);
  +        }
  +        
           if (null != getRealmName()) {
               _context.setRealmName(getRealmName());
           }
  
  
  
  1.3       +3 -3      jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/JellyResourceHandlerTag.java
  
  Index: JellyResourceHandlerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/JellyResourceHandlerTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JellyResourceHandlerTag.java	30 Oct 2002 13:22:44 -0000	1.2
  +++ JellyResourceHandlerTag.java	26 Jan 2003 04:42:38 -0000	1.3
  @@ -61,7 +61,7 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -88,11 +88,11 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           HttpContextTag httpContext = (HttpContextTag) findAncestorWithClass(
               HttpContextTag.class);
           if ( httpContext == null ) {
  -            throw new JellyException( "<jellyResourceHandler> tag must be enclosed
inside a <httpContext> tag" );
  +            throw new JellyTagException( "<jellyResourceHandler> tag must be enclosed
inside a <httpContext> tag" );
           }
   
           _jellyResourceHttpHandler =
  
  
  
  1.5       +39 -22    jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/JettyHttpServerTag.java
  
  Index: JettyHttpServerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/JettyHttpServerTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JettyHttpServerTag.java	11 Dec 2002 12:40:59 -0000	1.4
  +++ JettyHttpServerTag.java	26 Jan 2003 04:42:38 -0000	1.5
  @@ -61,8 +61,11 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  +import java.io.IOException;
  +import java.net.UnknownHostException;
   import java.net.URL;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   import org.apache.commons.logging.LogFactory;
  @@ -74,6 +77,7 @@
   import org.mortbay.http.handler.NotFoundHandler;
   import org.mortbay.http.handler.ResourceHandler;
   import org.mortbay.util.Log;
  +import org.mortbay.util.MultiException;
   import org.mortbay.util.OutputStreamLogSink;
   import org.mortbay.util.Resource;
   
  @@ -148,7 +152,7 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           try {
               URL logFileURL = getContext().getResource(getLogFileName());
  @@ -161,26 +165,34 @@
           // allow nested tags first, e.g body
           invokeBody(xmlOutput);
   
  -        // if no listeners create a default port listener
  -        if (_server.getListeners().length == 0) {
  -            SocketListener listener=new SocketListener();
  -            listener.setPort(DEFAULT_PORT);
  -            listener.setHost(DEFAULT_HOST);
  -            _server.addListener(listener);
  -        }
  -
  -        // if no context/s create a default context
  -        if (_server.getContexts().length == 0) {
  -            log.info("Creating a default context");
  -            // Create a context
  -            HttpContext context = _server.getContext(DEFAULT_HOST,
  -                                                    DEFAULT_CONTEXT_PATH);
  -
  -            // Serve static content from the context
  -            URL baseResourceURL = getContext().getResource(DEFAULT_RESOURCE_BASE);
  -            Resource resource = Resource.newResource(baseResourceURL);
  -            context.setBaseResource(resource);
  -            _server.addContext(context);
  +        try {
  +            // if no listeners create a default port listener
  +            if (_server.getListeners().length == 0) {
  +                SocketListener listener=new SocketListener();
  +                listener.setPort(DEFAULT_PORT);
  +                listener.setHost(DEFAULT_HOST);
  +                _server.addListener(listener);
  +            }
  +
  +            // if no context/s create a default context
  +            if (_server.getContexts().length == 0) {
  +                log.info("Creating a default context");
  +                // Create a context
  +                HttpContext context = _server.getContext(DEFAULT_HOST,
  +                                                        DEFAULT_CONTEXT_PATH);
  +
  +                // Serve static content from the context
  +                URL baseResourceURL = getContext().getResource(DEFAULT_RESOURCE_BASE);
  +                Resource resource = Resource.newResource(baseResourceURL);
  +                context.setBaseResource(resource);
  +                _server.addContext(context);
  +            }
  +        }
  +        catch (UnknownHostException e) {
  +            throw new JellyTagException(e);
  +        }
  +        catch (IOException e) {
  +            throw new JellyTagException(e);
           }
   
           // check that all the contexts have at least one handler
  @@ -197,7 +209,12 @@
           }
   
           // Start the http server
  -        _server.start();
  +        try {
  +            _server.start();
  +        }
  +        catch (MultiException e) {
  +            throw new JellyTagException(e);
  +        }
   
           // set variable to value if required
           if (getVar() != null) {
  
  
  
  1.4       +2 -2      jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/NotFoundHandlerTag.java
  
  Index: NotFoundHandlerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/NotFoundHandlerTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NotFoundHandlerTag.java	11 Dec 2002 12:40:59 -0000	1.3
  +++ NotFoundHandlerTag.java	26 Jan 2003 04:42:38 -0000	1.4
  @@ -61,7 +61,7 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   import org.mortbay.http.handler.NotFoundHandler;
  @@ -89,7 +89,7 @@
           HttpContextTag httpContext = (HttpContextTag) findAncestorWithClass(
               HttpContextTag.class);
           if ( httpContext == null ) {
  -            throw new JellyException( "<notFoundHandler> tag must be enclosed inside
a <httpContext> tag" );
  +            throw new JellyTagException( "<notFoundHandler> tag must be enclosed
inside a <httpContext> tag" );
           }
           NotFoundHandler notFoundHandler = new NotFoundHandler();
           httpContext.addHandler(notFoundHandler);
  
  
  
  1.3       +12 -6     jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/RealmTag.java
  
  Index: RealmTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/RealmTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RealmTag.java	30 Oct 2002 13:22:44 -0000	1.2
  +++ RealmTag.java	26 Jan 2003 04:42:38 -0000	1.3
  @@ -61,12 +61,13 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
   import org.mortbay.http.HashUserRealm;
   
  +import java.io.IOException;
   import java.net.URL;
   
   /**
  @@ -95,20 +96,25 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           JettyHttpServerTag httpserver = (JettyHttpServerTag) findAncestorWithClass(
               JettyHttpServerTag.class);
           if ( httpserver == null ) {
  -            throw new JellyException( "<realm> tag must be enclosed inside a <server>
tag" );
  +            throw new JellyTagException( "<realm> tag must be enclosed inside a <server>
tag" );
           }
           if (null == getName() || null == getConfig()) {
  -            throw new JellyException( "<realm> tag must have a name and a config"
);
  +            throw new JellyTagException( "<realm> tag must have a name and a config"
);
           }
   
           // convert the config string to a URL
           // (this makes URL's relative to the location of the script
  -        URL configURL = getContext().getResource(getConfig());
  -        httpserver.addRealm( new HashUserRealm(getName(), configURL.toString() ) );
  +        try {
  +            URL configURL = getContext().getResource(getConfig());
  +            httpserver.addRealm( new HashUserRealm(getName(), configURL.toString() ) );
  +        } catch (IOException e) {
  +            throw new JellyTagException(e);
  +        }
  +        
           invokeBody(xmlOutput);
       }
   
  
  
  
  1.3       +3 -3      jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/ResourceHandlerTag.java
  
  Index: ResourceHandlerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/ResourceHandlerTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResourceHandlerTag.java	30 Oct 2002 13:22:44 -0000	1.2
  +++ ResourceHandlerTag.java	26 Jan 2003 04:42:38 -0000	1.3
  @@ -61,7 +61,7 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -91,11 +91,11 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           HttpContextTag httpContext = (HttpContextTag) findAncestorWithClass(
               HttpContextTag.class);
           if ( httpContext == null ) {
  -            throw new JellyException( "<resourceHandler> tag must be enclosed inside
a <httpContext> tag" );
  +            throw new JellyTagException( "<resourceHandler> tag must be enclosed
inside a <httpContext> tag" );
           }
           ResourceHandler resourceHandler = new ResourceHandler();
           if (getAllowedMethods() != null) {
  
  
  
  1.4       +14 -8     jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/ResponseBodyTag.java
  
  Index: ResponseBodyTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/ResponseBodyTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ResponseBodyTag.java	25 Nov 2002 18:40:43 -0000	1.3
  +++ ResponseBodyTag.java	26 Jan 2003 04:42:38 -0000	1.4
  @@ -61,7 +61,9 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import java.io.IOException;
  +
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -82,20 +84,24 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           // get the response from the context
           HttpResponse httpResponse = (HttpResponse) getContext().getVariable("response");
           if (null == httpResponse) {
  -            throw new JellyException("HttpResponse variable not available in Jelly context");
  +            throw new JellyTagException("HttpResponse variable not available in Jelly context");
           }
   
           ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer(1500);
  -        writer.write(getBodyText());
  -        writer.flush();
  -        httpResponse.setContentLength(writer.size());
  -        writer.writeTo(httpResponse.getOutputStream());
  -
  +        try {
  +             writer.write(getBodyText());
  +             writer.flush();
  +             httpResponse.setContentLength(writer.size());
  +             writer.writeTo(httpResponse.getOutputStream());
  +        } 
  +        catch (IOException e) {
  +            throw new JellyTagException(e);
  +        }
       }
   }
   
  
  
  
  1.2       +4 -4      jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/ResponseCodeTag.java
  
  Index: ResponseCodeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/ResponseCodeTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResponseCodeTag.java	31 Oct 2002 15:08:10 -0000	1.1
  +++ ResponseCodeTag.java	26 Jan 2003 04:42:38 -0000	1.2
  @@ -61,7 +61,7 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -84,16 +84,16 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           if (getValue() <= 100) {
  -            throw new JellyException("<responseCode> tag must have a value of at
least 100");
  +            throw new JellyTagException("<responseCode> tag must have a value of
at least 100");
           }
   
           // get the response from the context
           HttpResponse httpResponse = (HttpResponse) getContext().getVariable("response");
           if (null == httpResponse) {
  -            throw new JellyException("HttpResponse variable not available in Jelly context");
  +            throw new JellyTagException("HttpResponse variable not available in Jelly context");
           }
   
           // set response code
  
  
  
  1.3       +4 -4      jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/ResponseHeaderTag.java
  
  Index: ResponseHeaderTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/ResponseHeaderTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResponseHeaderTag.java	30 Oct 2002 13:22:44 -0000	1.2
  +++ ResponseHeaderTag.java	26 Jan 2003 04:42:38 -0000	1.3
  @@ -61,7 +61,7 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -87,16 +87,16 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           if (null == getName()) {
  -            throw new JellyException("<responseHeader> tag must have a name");
  +            throw new JellyTagException("<responseHeader> tag must have a name");
           }
   
           // get the response from the context
           HttpResponse httpResponse = (HttpResponse) getContext().getVariable("response");
           if (null == httpResponse) {
  -            throw new JellyException("HttpResponse variable not available in Jelly context");
  +            throw new JellyTagException("HttpResponse variable not available in Jelly context");
           }
   
           // if value is valid then set it
  
  
  
  1.4       +16 -5     jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/SecurityHandlerTag.java
  
  Index: SecurityHandlerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/SecurityHandlerTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SecurityHandlerTag.java	11 Dec 2002 12:40:59 -0000	1.3
  +++ SecurityHandlerTag.java	26 Jan 2003 04:42:38 -0000	1.4
  @@ -61,7 +61,7 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -76,7 +76,9 @@
   import org.mortbay.xml.XmlParser;
   
   import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
   
  +import java.io.IOException;
   import java.io.StringReader;
   import java.util.Iterator;
   
  @@ -135,11 +137,11 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           HttpContextTag httpContext = (HttpContextTag) findAncestorWithClass(
               HttpContextTag.class);
           if ( httpContext == null ) {
  -            throw new JellyException( "<securityHandler> tag must be enclosed inside
a <httpContext> tag" );
  +            throw new JellyTagException( "<securityHandler> tag must be enclosed
inside a <httpContext> tag" );
           }
           SecurityHandler securityHandler = new SecurityHandler();
           if (getauthenticationMethod() != null) {
  @@ -156,7 +158,16 @@
           // crate a non-validating parser
           XmlParser xmlParser = new XmlParser(false);
   
  -        XmlParser.Node node = xmlParser.parse(inputSource);
  +        XmlParser.Node node = null;
  +        try {
  +            node = xmlParser.parse(inputSource);
  +        } 
  +        catch (IOException e) {
  +            throw new JellyTagException(e);
  +        } 
  +        catch (SAXException e) {
  +            throw new JellyTagException(e);
  +        }
   
           Iterator iter=node.iterator();
           XmlParser.Node currNode = null;
  @@ -174,7 +185,7 @@
                   } else if ("login-config".equals(name)) {
                       initLoginConfig(currNode, httpContext);
                   } else {
  -                    throw new JellyException("Invalid element in <securityHandler>
tag. Are you using the <constraints> tag?: " + currNode);
  +                    throw new JellyTagException("Invalid element in <securityHandler>
tag. Are you using the <constraints> tag?: " + currNode);
                   }
           }
   
  
  
  
  1.3       +14 -5     jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/SocketListenerTag.java
  
  Index: SocketListenerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jetty/src/java/org/apache/commons/jelly/tags/jetty/SocketListenerTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SocketListenerTag.java	30 Oct 2002 13:22:44 -0000	1.2
  +++ SocketListenerTag.java	26 Jan 2003 04:42:38 -0000	1.3
  @@ -61,7 +61,9 @@
   
   package org.apache.commons.jelly.tags.jetty;
   
  -import org.apache.commons.jelly.JellyException;
  +import java.io.IOException;
  +
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -93,14 +95,21 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           JettyHttpServerTag httpserver = (JettyHttpServerTag) findAncestorWithClass(
               JettyHttpServerTag.class);
           if ( httpserver == null ) {
  -            throw new JellyException( "<socketListener> tag must be enclosed inside
a <server> tag" );
  +            throw new JellyTagException( "<socketListener> tag must be enclosed inside
a <server> tag" );
  +        }
  +        
  +        try {
  +            httpserver.addListener(
  +                new SocketListener(new InetAddrPort(getHost(), getPort())));
  +        } 
  +        catch (IOException e) {
  +            throw new JellyTagException(e);
           }
  -        httpserver.addListener(
  -            new SocketListener(new InetAddrPort(getHost(), getPort())));
  +        
           invokeBody(xmlOutput);
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message