The compile actually created 4 .class files:

CGIServlet$CGIEnvironment.class
CGIServlet$CGIRunner.class
CGIServlet$HTTPHeaderInputStream.class
CGIServlet.class

So, I combined them into CGIServlet.jar....

I'll look at ant deploy.

On Thu, Jun 22, 2023 at 5:29 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Timothy,
>
> On 6/22/23 14:01, Timothy Ward wrote:
> > I am trying to go the route of modifying the CGIServlet from:  h
> > ttps://
> github.com/apache/tomcat/blob/main/java/org/apache/catalina/servlets/CGIServlet.java#L771
> > <
> https://github.com/apache/tomcat/blob/main/java/org/apache/catalina/servlets/CGIServlet.java#L771
> >
> >
> > I got it to compile with my changes and then all the .class files are in
> a
> > CGIServlet.jar file.
> >
> > This may sound stupid, but I've looked around, but for the life of me I
> > don't know what to do with the jar file now.
>
> It would be best to replace CGIServlet.class in catalina.jar. Remember
> it's actually org/apache/catalina/servlets/CGIServlet.class in the JAR
> file.
>
> If you are building Tomcat from source, if you just run "ant deploy"
> you'll get a catalina.jar file that already has everything you need. In
> fact, you'll get a Tomcat deployment (in output/build) that you can use
> directly if you'd like.
>
> -chris
>
> > On Thu, Jun 22, 2023 at 10:04 AM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> >> Timothy,
> >>
> >> On 6/21/23 16:56, Timothy Ward wrote:
> >>> import javax.servlet.http.HttpServletRequest;
> >>> import javax.security.cert.Certificate;
> >>> import javax.security.cert.X509Certificate;
> >>>
> >>> public class GrabCert extends Object
> >>> {
> >>>    public static String getCommonName()
> >>>    {
> >>>     try
> >>>        {
> >>>         X509Certificate[] certs = (X509Certificate[])
> >>>
> >>
> HttpServletRequest().getAttribute("jakarta.servlet.request.X509Certificate");
> >>>        }
> >>>     catch (Exception ex)
> >>>          {
> >>>           System.out.println("Exception caught in getCommonName:");
> >>>           ex.printStackTrace();
> >>>          }
> >>>    }
> >>> }
> >>>
> >>> This end up getting:
> >>>
> >>> [Error]  (1: 0): GrabCert:48: error: cannot find symbol
> >>> [Error]  (1: 0):       X509Certificate[] certs = (X509Certificate[])
> >>>
> >>
> HttpServletRequest().getAttribute("jakarta.servlet.request.X509Certificate");
> >>> [Error]  (1: 0):                                                     ^
> >>> [Error]  (1: 0):   symbol:   method HttpServletRequest()
> >>> [Error]  (1: 0):   location: class GrabCert
> >>> [Error]  (1: 0): 1 error
> >>
> >> Yeah, that method just doesn't exist. Your GrabCert class I guess needs
> >> a getHttpServletRequest method, and something needs to inject the
> >> request into the object as well.
> >>
> >> I think your class needs a lot more support than what you have there.
> >>
> >> -chris
> >>
> >>> On Wed, Jun 21, 2023 at 2:32 PM Christopher Schultz <
> >>> ch...@christopherschultz.net> wrote:
> >>>
> >>>> Timothy,
> >>>>
> >>>> On 6/21/23 13:55, Timothy Ward wrote:
> >>>>> Not sure it's lined up right, lost in copy/paste I think, the ^ seems
> >> to
> >>>> be
> >>>>> initially under the (X509Certificate[]) right before the
> >>>>> getHttpServletRequest(), so I thought it didn't like the
> >>>>> getHttpServletRequest itself, maybe it doesn't like the getAttribute
> >>>> method.
> >>>>
> >>>> The compiler tells you 100% it's getHttpServletRequest.
> >>>>
> >>>> You didn't post the rest of the code, so we have no idea what kind of
> >>>> class this code exists in. My guess is that whatever class this code
> is
> >>>> in does not have a getHttpServletRequest() method to call.
> >>>>
> >>>> If you can post more code, we may be able to help.
> >>>>
> >>>> -chris
> >>>>
> >>>>> On Wed, Jun 21, 2023 at 1:52 PM Rob Sargent <rsarg...@xmission.com>
> >>>> wrote:
> >>>>>
> >>>>>>
> >>>>>>
> >>>>>>> On Jun 21, 2023, at 11:29 AM, Timothy Ward <twardbite...@gmail.com
> >
> >>>>>> wrote:
> >>>>>>>
> >>>>>>> I tried the following:
> >>>>>>>
> >>>>>>> import javax.servlet.http.HttpServletRequest;
> >>>>>>> import javax.security.cert.Certificate;
> >>>>>>> import javax.security.cert.X509Certificate;
> >>>>>>>
> >>>>>>> X509Certificate[] certs = (X509Certificate[])
> >>>>>>>
> >>>>>>
> >>>>
> >>
> getHttpServletRequest().getAttribute("jakarta.servlet.request.X509Certificate");
> >>>>>>>
> >>>>>>> and I'm getting:
> >>>>>>>
> >>>>>>> [Error]  (1: 0): GrabCert:33: error: cannot find symbol,
> >>>>>>> [Error]  (1: 0):       X509Certificate[] certs =
> (X509Certificate[])
> >>>>>>>
> >>>>>>
> >>>>
> >>
> getHttpServletRequest().getAttribute("jakarta.servlet.request.X509Certificate");,
> >>>>>>> [Error]  (1: 0):
> >>   ^,
> >>>>>>> [Error]  (1: 0):   symbol:   method getHttpServletRequest(),
> >>>>>>> [Error]  (1: 0):   location: class GrabCert, [Error]  (1: 0): 1
> error
> >>>>>>>
> >>>>>>
> >>>>>> If I lined that up correctly, it seems to be pointing at
> >> “getAttribute”.
> >>>>>> Is your getHttpServletRequest giving you what you expect?
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>>>>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>>
> >>>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>
> >>
> >
>

Reply via email to