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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:37:33+00:00 2026-06-08T02:37:33+00:00

So I am updating a Play 1.2.x application with has the following setup –

  • 0

So I am updating a Play 1.2.x application with has the following setup

- controllers
    - api 
        - Documents // create, update, read, delete, list
        ... // more controllers
    - web
        - Documents // list, read, etc...
        .. // more controllers

The controllers in the api package render data as Json which is used by mobile clients (Android, iPhone).

Now I want to have a plain simple html web app consuming the api. So how can I consume the API from the controllers in the web package?

My goal is to avoid rewriting the api controllers logic in the web controllers logic.

Thanks!

  • 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-08T02:37:35+00:00Added an answer on June 8, 2026 at 2:37 am

    Reusing methods between controllers is not the best practice in my opinion. Shared behavior should be coded in the model and both controllers can then use the same model methods.

    Nevertherless if you want to do so, you can extract shared behavior in a public method in your apis controllers wich you can annotate as “@Util” and then call this method from your web controller.

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

Sidebar

Related Questions

Updating, showing, and deleting users, exercises Is there a way to create an Rspec
After updating to php 5.3 one of our systems has developed an interesting bug.
When updating the managedObjectContext is it ok practice to do the save setup in
We are using the Play! framework and I've setup our Jenkins CI to run
MongoDB updating fields in nested array How can I set "play" to "play photo"
Question: Why does my .gif load, but not play when updating using GifSourcePropertyChanged ?
I develop my first android application, so i have a question about its updating.
I have an application on the Android Play Store. I also have a Windows
I have spent the last week or so updating my web application to a
A client has me updating his static site with a few videos. He wants

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.