Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7604673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:58:24+00:00 2026-05-30T23:58:24+00:00

I had created a Proxy Server (Fwd and Reverse) using Java sockets. which would

  • 0

I had created a Proxy Server (Fwd and Reverse) using Java sockets.

which would listen to Incoming Request on 8080 configured in browser and forward them to another Proxy Server2.

And Read the Response sent by the server2 and write it to the browser.

Meanwhile code will be logging requests and response and also blocking certain predefined request types from browser.

Now I want to do this using Jetty and also support HTTPS request.

I searched for example but I found none.

This starts server at 8080 which I have configured as proxy port in Browser’s proxy setting.

 import org.eclipse.jetty.server.Server;

import Handler.HelloHandler;

public class StartJetty
{
    public static void main(String[] args) throws Exception
    {
        Server server = new Server(8080);

        server.setHandler(new HelloHandler());
        server.start();
        server.join();
    }
}

This is the handler which I use to listen to request and write response back to browser.

package Handler;

import java.io.IOException;

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

 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.handler.AbstractHandler;

public class HelloHandler extends AbstractHandler
{
    final String _greeting;
          final String _body;

          public HelloHandler()
          {
              _greeting="Hello World";
              _body=null;
          }

          public HelloHandler(String greeting)
          {
              _greeting=greeting;
              _body=null;
          }

          public HelloHandler(String greeting,String body)
          {
              _greeting=greeting;
              _body=body;
          }

          public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
          {
              response.setContentType("text/html;charset=utf-8");
              response.setStatus(HttpServletResponse.SC_OK);
              baseRequest.setHandled(true);

              response.getWriter().println("<h1>"+_greeting+"</h1>");
              if (_body!=null)
                  response.getWriter().println(_body);
          }
}

Once I have the response I want to forward it to proxy server, wait for its response and write it back to the Browser. I need help with that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:58:26+00:00Added an answer on May 30, 2026 at 11:58 pm

    In the jetty-servlets artifact there is a ProxyServlet that will do async proxy work for you.

    I would just give that a try and see if it fits your needs.

    In the tests of that project is an AsyncProxyServer that you can just start up and give a whirl.

    The underlying continuation and jetty clients used for the proxying are extensible through the customize methods.

    http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java?h=jetty-8

    and

    http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/AsyncProxyServer.java?h=jetty-8

    good luck

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming you had some kind of factory-created resource that would still belong to the
On my previous machine I had IIS6 installed and created a web project using
I had created a webpage using asp.net mvc3 razor. I have two master pages
I had created a web part on MOSS 2007 which displays a organizational chart
Basically I had created my application entirely using code behind and now I'm migrating
Akka Typed actors are created in two parts using JDK proxies, whereby the proxy
I had created one HTML page for my experiance. In this i had use
I had created a zip file (together with directory) under Windows as follow (Code
Doug McCune had created something that was exactly what I needed ( http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/ )
I have a smallish utility library I made that I had created in TFS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.