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 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've been trying to wrap my head around solving this issue but I can't
So I got a problem that I can't wrap my mind around. I'm creating
I just can't seem to wrap my mind around this concept... I want to
I cant seem to find much info on haskells layout features, as I understand
It seems that I can't control the NSApp delegate from within a System Preferences
I can't seems to change the default color of the required field validator. In
Seems like a simple enough question but I can't seem to find the answer.
Seems so basic, I can't believe I don't know this! I just need a
So this seems pretty basic but I can't get it to work. I have
Seems like as really simple thing to do, but I just can't track it

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.