All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.jetty.nested.NestedEndPoint Maven / Gradle / Ivy

There is a newer version: 11.0.0.beta1
Show newest version
// ========================================================================
// Copyright (c) 2010-2011 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at 
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses. 
// ========================================================================
package org.eclipse.jetty.nested;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.bio.StreamEndPoint;

public class NestedEndPoint extends StreamEndPoint
{
    private final HttpServletRequest _outerRequest;
    
    public NestedEndPoint(HttpServletRequest outerRequest, HttpServletResponse outerResponse)
        throws IOException
    {
        super(outerRequest.getInputStream(),outerResponse.getOutputStream());
        _outerRequest=outerRequest;
    }

    public ServletInputStream getServletInputStream()
    {
        return (ServletInputStream)getInputStream();
    }
    @Override
    public String getLocalAddr()
    {
        return _outerRequest.getLocalAddr();
    }

    @Override
    public String getLocalHost()
    {
        return _outerRequest.getLocalName();
    }

    @Override
    public int getLocalPort()
    {
        return _outerRequest.getLocalPort();
    }

    @Override
    public String getRemoteAddr()
    {
        return _outerRequest.getRemoteAddr();
    }

    @Override
    public String getRemoteHost()
    {
        // TODO Auto-generated method stub
        return _outerRequest.getRemoteHost();
    }
    @Override
    public int getRemotePort()
    {
        return _outerRequest.getRemotePort();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy