8000 CAS-1425: aligned view names to match the jsp filename by jtgasper3 · Pull Request #444 · apereo/cas · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

CAS-1425: aligned view names to match the jsp filename #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 30, 2014
Merged

CAS-1425: aligned view names to match the jsp filename #444

merged 12 commits into from
Aug 30, 2014

Conversation

jtgasper3
Copy link
Contributor

Some view names in default_views.properties have been updated to match the file names of the jsp's. The respective view names in the login-webflow.xml have been updated as well. This pull fixes https://github.com/Jasig/cas/issues/490

@battags
Copy link
Contributor
battags commented Jun 18, 2014

What value is this adding? This means that deployers who previously overrode the file in their local overlay are now no longer overriding that file and will have to rename.

@mmoayyed
Copy link
Member

I think this is an improvement to allow for matching file/view names, so that dynamic view resolvers can be implemented. What I really hope to see is that we remove the property file views, and have the resolver simply just work with the viewname, which is Spring's default. This way, it would make it completely unnecessary for one to include this file in the overlays. Filenames just have to match logical view names. As I mentioned, this would also one to create dynamic view resolvers that would show a different CAS login page, or use a different context path for view names that may be entirely separate, and not limited to just JS/CSS.

@leleuj
Copy link
Contributor
leleuj commented Jun 18, 2014

The renaming is useful only if we go as far as @mmoayyed proposed: why not address that in this pull request?

@jtgasper3
Copy link
Contributor Author

I can go ahead and incorporate the changes that @mmoayyed and @leleuj referenced for your review.


viewServiceSsoErrorView.(class)=org.springframework.web.servlet.view.JstlView
viewServiceSsoErrorView.url=/WEB-INF/view/jsp/default/ui/serviceErrorSsoView.jsp

### CAS statistics view
viewStatisticsView.(class)=org.springframework.web.servlet.view.JstlView
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we keep just this line?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's two lines... And the view is not technically part of the public facing ui. It's in monitoring and not default/ui

viewStatisticsView.(class)=org.springframework.web.servlet.view.JstlView
viewStatisticsView.url=/WEB-INF/view/jsp/monitoring/viewStatistics.jsp

Would you recommend it going somewhere else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really like for them to be gone, so whatever controller is routing to these views should similarly discover the JSP automatically.

@mmoayyed
Copy link
Member

John, I think we could also work on an alternative implementation of a resolver, that resolves a view name by the theme defined in the registry entry. Does that make sense? So for instance, if the theme is defined for a service to be "student", the resolver would look into /web-inf/view/jsp/student directory to find relevant views. This is something that is fairly on-demand.

@mmoayyed
Copy link
Member
mmoayyed commented Jul 2, 2014

@jtgasper3 How are we doing here? Anything I can do to help?

@jtgasper3
Copy link
Contributor Author

Should I include a commented out config for the alternate view resolver in the context file or just define it in documentation on the wiki?

@mmoayyed
Copy link
Member
mmoayyed commented Jul 2, 2014

Docs would be better, I suppose. We do have a section on UI customization and theming, this would be a good addition to that block.

@@ -0,0 +1,24 @@
### Login view (/login)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the filename change...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still struggling to understand why this file is needed. Wouldn't the controller be able to simply map the view name to the file name? Why have the view explicitly here?

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling fea5751 on Unicon:CAS-1425 into * on Jasig:master*.

protected AbstractUrlBasedView buildView(final String viewName) throws Exception {
final RequestContext requestContext = RequestContextHolder.getRequestContext();
final WebApplicationService service = (WebApplicationService) WebUtils.getService(requestContext);
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should make sure the service is not disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is disabled service the same thing as a non-existing service entry? I'd argue that perhaps we should allow admins to apply a different theme/view set to a disabled entry e.g. "The scholarship app is down for repair".)

Either way it is a simple fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, a disabled service is registeredService.isEnabled(). Non-existing services are not allowed to use CAS anyways. The most interesting aspect of this pull is the ability to decorate the login page and I would like to stick to this. Not much else is going to be customized, but we can certainly track what you're describing in a separate issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for a disabled service will be in the next commit.

@jtgasper3
Copy link
Contributor Author

The proposed changes have been committed, with the exception of using the default theme if a service is disabled. It's coded, but I help on the commit until discussion is concluded.

@mmoayyed mmoayyed closed this Jul 15, 2014
@mmoayyed mmoayyed reopened this Jul 15, 2014
@mmoayyed mmoayyed added this to the 4.1 milestone Jul 15, 2014
@jtgasper3
Copy link
Contributor Author

Hi guys,

Is there anything else that can/should be done for this?

@mmoayyed
Copy link
Member

Looks great to me. I'd wait for a couple of days, so that perhaps @leleuj or @battags have a chance to review. and then we should be good to merge.

LOGGER.debug("Prefix {} set for service {} with theme {}", prefix, s 628C ervice, themeId);

//Set the prefix based on the retrieved themeId & resolve the view.
super.setPrefix(prefix);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned about this: super.setPrefix(prefix);. What happens in a multi-threading environment when different services are called at the same time with different associated themes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see where you are coming from. I have fixed that by pulling the buildView code from each of the base classes and incorporated it directly.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 66643d2 on Unicon:CAS-1425 into * on Jasig:master*.

@@ -58,6 +59,8 @@

private String casTicketSuffix;

private String viewPath = "/WEB-INF/view/jsp/monitoring/viewStatistics.jsp";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry... why exactly are we hard-coding a path here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't call it hard coded, but a realistic default. There is a setter that allows for the path of the view to be changed.

@battags
Copy link
Contributor
battags commented Jul 19, 2014

how did we go from aligning view names to a new theme resolver utilizing hard-coded paths?

@@ -158,14 +158,14 @@
the "viewGenericLogin" is the end state for when a user attempts to login without coming directly from a service.
They have only initialized their single-sign on session.
-->
<end-state id="viewGenericLoginSuccess" view="casLoginGenericSuccessView" />
<end-state id="viewGenericLoginSuccess" view="casGenericSuccess" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are all these changing? what benefit are we getting from changing these right now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the idea is to have the same view name as the JSP name. I doesn't change anything for the customized JSP pages, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leleuj, you are correct that this bring together a view's jsp filename with the viewname referenced in the login-webflow.xml. As for customized JSP pages, it shouldn't change anything if the filenames where kept the same.

(Although I've seen some implementors that give the jsp file a unique name and update the default_view.properties be commenting out the default and putting in a replacement. sigh)

@battags
Copy link
Contributor
battags commented Jul 19, 2014

Doesn't hard-coded paths mean that files can't be shared/leveraged across themes?

@leleuj
Copy link
Contributor
leleuj commented Jul 21, 2014

+1

@jtgasper3
Copy link
Contributor Author

@battags, per you last comment:

Doesn't hard-coded paths mean that files can't be shared/leveraged across themes?
Which files do you mean?

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f690c06 on Unicon:CAS-1425 into * on Jasig:master*.

@mmoayyed
Copy link
Member
mmoayyed commented Aug 6, 2014

So, where do we stand on this?

Conflicts:
	cas-server-webapp/src/main/webapp/WEB-INF/cas-servlet.xml
@mmoayyed
Copy link
Member

I merged this PR with master once to bring it up to speed, and also updated docs and comments inside the class RegisteredServiceThemeBasedViewResolver to better reflect its purpose. I think the class should be marked as final, because there's nothing here for to actually extend, and also provided a setter for the path prefix so it's not entirely hardcoded, if one wants to get creative. Also decided to rename the class to try and differentiate between that and the existing service theme resolver.

@mmoayyed
Copy link
Member

Bump. Everything looks good? Plan to merge by Friday?

@mmoayyed
Copy link
Member

Team, planning to merge. Please let me know if you see a blocker with this issue.

mmoayyed added a commit that referenced this pull request Aug 30, 2014
CAS-1425: aligned view names to match the jsp filename
@mmoayyed mmoayyed merged commit e3f60b4 into apereo:master Aug 30, 2014
@mmoayyed mmoayyed deleted the CAS-1425 branch August 30, 2014 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0