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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:45:20+00:00 2026-05-19T04:45:20+00:00

I am trying to use the library spring-json.1.3.1 in a project that has been

  • 0

I am trying to use the library spring-json.1.3.1 in a project that has been done with Liferay 5.1.2 which includes Spring 2.5.

Following the project website instructions, I managed to make the request hit in my controller, but at the moment of returning the json object back through the modelAndView object it fails with the following error:

java.lang.IllegalArgumentException at com.liferay.portlet.MimeResponseImpl.setContentType(MimeResponseImpl.java:162)

I have checked Liferays source code, and it checks that contentType that its being set is in a harcoded list,if it not it will throw a IllegalArgumentException that it is exactly what os happening.

This is my view resolver code:

<bean id="xmlFileViewResolver" class="org.springframework.web.servlet.view.XmlViewResolver">

/WEB-INF/context/views.xml

1

My views.xml code:

<beans>
   <bean name="jsonView" class="org.springframework.web.servlet.view.json.JsonView"/> 

And my controller:

@SuppressWarnings("unchecked")
@Override
public ModelAndView handleRenderRequest(RenderRequest arg0,
   RenderResponse arg1) throws Exception {

   Map model = new HashMap();
         model.put("firstname", "Peter");
         model.put("secondname", "Schmitt");

   return new ModelAndView("jsonView", model);
} 

Any ideas?

  • 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-19T04:45:21+00:00Added an answer on May 19, 2026 at 4:45 am

    This issue is because you need to set window state as exclusive mode, so it would work:

    <portlet:renderURL var="jsonRequest" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>"><portlet:param name="actionType" value="fetchGames"/></portlet:renderURL>
    

    Piece of code from MimeResponseImpl.java:

    public void setContentType(String contentType) {
        if (Validator.isNull(contentType)) {
            throw new IllegalArgumentException();
        }
    
        Enumeration<String> enu = _portletRequestImpl.getResponseContentTypes();
    
        boolean valid = false;
    
        if (getLifecycle().equals(PortletRequest.RESOURCE_PHASE) ||
            _portletRequestImpl.getWindowState().equals(
                LiferayWindowState.EXCLUSIVE)) {
    
            valid = true;
        }
    

    Let me know if somebody need more help.

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

Sidebar

Related Questions

I'm trying to use this library (which looks very nice) but I'm having difficulty
I'm trying to use curses.h library for the first time, but no matter which
I am trying to parse a string which in JSON format only that keys
I've been trying to use the cpw library for some graphics things. I got
I am trying to use Google's libphonenumber library in my project. I am trying
I'm trying to use the Android JSON library, but the version is old and
I'm trying to use the JSON library to consume twitter information from the get
I'm trying to use jQuery and JSON with a C# Web Service that I
I am trying to compile a program that uses the library Newtonsoft.Json.dll with mono
I'm trying to use a JavaScript library to encrypt data and send that to

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.