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

  • Home
  • SEARCH
  • 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 797343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:47:22+00:00 2026-05-14T22:47:22+00:00

it seems i cant wrap my Head around how to implment a custom ViewProcessor

  • 0

it seems i cant wrap my Head around how to implment a custom ViewProcessor in Jersey. Ihave the following Resource:

@Path("/events")
public class EventController extends AbstractController {
    private static final Logger LOG = LoggerFactory.getLogger(EventController.class);

    @Resource(name = "eventService")
    private EventService eventService;

    public void setEventService(EventService eventService) {
        this.eventService = eventService;
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    public Viewable viewEventsAsHtml() {
        Map<String, String> model = new HashMap<String, String>();
        model.put("msg", "test");
        return new Viewable("/events.jsp", model);
    }
}

since i want to organize my jsp views in “/WEB-INF/views/jsp” i extended JSPTemplateProcessor thusly:

public class CJJspTemplateProcessor extends JSPTemplateProcessor {
    private static final Logger LOG = LoggerFactory.getLogger(CJJspTemplateProcessor.class);

    private final String basePath = "/WEB-INF/views/jsp";

    public CJJspTemplateProcessor(@Context ResourceConfig resourceConfig) {
        super(resourceConfig);
    }

    @Override
    public String resolve(String name) {
        String path;
        if (!name.endsWith(".jsp")) {
            name += ".jsp";
        }
        path = basePath + name;
        LOG.debug("resolving " + name + " to " + path);
        return path;
    }
}

but when i navigate to the event resource i get an 404, although i can see that the TemplateProcessor resolved the right path for the jsp in the logfiles.

plx help 🙂

  • 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-14T22:47:23+00:00Added an answer on May 14, 2026 at 10:47 pm

    You don’t need a custom TemplateProcessor to do this simple add the following to the filter element in your web.xml.

    <filter>
        <init-param>
            <param-name>com.sun.jersey.config.property.JSPTemplatesBasePath</param-name>
            <param-value>/WEB-INF/views/jsp</param-value>
        </init-param>
    </filter>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to wrap my head around Xcode's file organization - or lack there
I want to have some layout a bit like this [text tabel][edittext] i cant
I'm a somewhat experienced PHP scripter, however I just dove into parsing XML and
If there is, I certainly don't see it. We are doing magnetic stripe reads
Note: I will not be using salts. Thanks for your advice though! I'm testing
I'm trying to understand the reason for a rule when converting. I'm sure there
I have a java application that needs to connect to a server. Its rather
I have a site set up complete with an index, etc. I would like
Im tring to simulate a slideup animation.The idea is to slideup and slidedown the
Is it good practice to use dropdown lists for navigation? I am making a

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.