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 8227361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:06:18+00:00 2026-06-07T16:06:18+00:00

How do I catch these invalid URLs so that I return a proper error

  • 0

How do I catch these invalid URLs so that I return a proper error resource?

Thanks.

Basically, I want to override the “The resource not found Page.” and instead I want to return an XML describing the error.

  • 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-06-07T16:06:19+00:00Added an answer on June 7, 2026 at 4:06 pm

    It depends a bit in which JAX-RS implementation you are using.

    If you are using RESTEasy, you can create an ExceptionMapper that catches org.jboss.resteasy.spi.NotFoundException. That enables you to build and return a custom javax.ws.rs.core.Response

    public class MyExceptionMapper implements ExceptionMapper<NotFoundException> {
    
        @Override
        public Response toResponse(NotFoundException exception) {
            return Response.status(exception.getErrorCode()).build();
        }
    }
    

    I’m a bit unsure on how to do this with Jersey, but maybe you can create an ExceptionMapper that catches com.sun.jersey.api.NotFoundException.

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

Sidebar

Related Questions

I am getting the error The return URL specified for request redirection is invalid
Is there some sort of exception in Java to catch an invalid Date object?
When we wrap a bunch of statements in a try/catch and one of these
Is there any way to catch key combination ctrl + x + return in
I've been told that there is some overhead in using the Java try-catch mechanism.
Getting these error when I run the android application: Instead of getting the statuses
i have some business logic that traps some logically invalid situations, e.g. trying to
I am trying to debug a DML error that is happening in one environment,
Ideally I want to be using the CreateObject delegate because the code generating these
I am working on table that prints addresses from a MySQL database. I'm not

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.