Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341694

Summary: ajp component not work
Product: [RT] Jetty Reporter: weijx <weijx2003>
Component: serverAssignee: Greg Wilkins <gregw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gady2003, jetty-inbox
Version: 7.2.2   
Target Milestone: 7.2.x   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description weijx CLA 2011-04-02 06:45:51 EDT
Build Identifier: jetty7.3.1

I use apache httpd server with module_jk and jetty, but I can not access app from apache httpd server which deployed in jetty.

I see the Ajp13Generator.java file and find that the _buffer field must have 7 bytes before real data. 

the super class will init _buffer field some time ,but without 7 bytes before, this method is :

    /**
     * @return Returns the contentBufferSize.
     */
    public int getContentBufferSize()
    {
        if (_buffer==null)
            _buffer=_buffers.getBuffer();
        return _buffer.capacity();
    }

    /* ------------------------------------------------------------ */
    /**
     * @param contentBufferSize The contentBufferSize to set.
     */
    public void increaseContentBufferSize(int contentBufferSize)
    {
        if (_buffer==null)
            _buffer=_buffers.getBuffer();
        if (contentBufferSize > _buffer.capacity())
        {
            Buffer nb = _buffers.getBuffer(contentBufferSize);
            nb.put(_buffer);
            _buffers.returnBuffer(_buffer);
            _buffer = nb;
        }
    }

I inherit Ajp13Generator.java and override the method below: 

    public void increaseContentBufferSize(int contentBufferSize)
    {
       // do nothing
    }
    
    public int getContentBufferSize()
    {
    	initContent();
    	return _buffer.capacity();
    }

so I can access app from apache httpd server, so yours must init _buffers Correctly in Ajp13Generator.

class: org.eclipse.jetty.ajp.Ajp13Generator
field: _buffers


Reproducible: Always
Comment 1 Greg Wilkins CLA 2011-04-06 18:24:48 EDT
I've applied a similar fix for 7.4.0

thanks
Comment 2 Michael Gorovoy CLA 2011-06-27 16:41:02 EDT
*** Bug 349430 has been marked as a duplicate of this bug. ***