• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frontman 2.0 mapping url's to different command packages

 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following CommandBroker defined:




I want to be able to map:



to only the commands within com.novo.ecommerce.site.commands and then be able to map



to only the commands within com.novo.ecommerce.administration.commands

So i should only be able to access (myPage) by http://127.0.0.1:8080/ecommerce/administration/myPage and not be able to access that command by http://127.0.0.1:8080/ecommerce/store/myPage

currently i can access myPage bye either url, i should only be able to access that command by http://127.0.0.1:8080/ecommerce/administration/myPage

Not sure if i am going by this the wrong way or not i have multiple servlet mappings:



So I am not sure if i am mapping everything correctly
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though I've never done it, you should be able to map multiple instances of the Command Broker.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Though I've never done it, you should be able to map multiple instances of the Command Broker.


I will give that a try but i have one more question pertaining to this.

I have created the following filter:



The point of this filter is to filter everything that comes through the url http://127.0.0.1:8080/ecommerce/account/*

If the customer is not logged in forward to login page, if they are then pass through.

The filter seems to work fine however i am able to access my checkout page through the following url:
http://127.0.0.1:8080/ecommerce/store/checkout

in essence i only want to be able to get to that verb by http://127.0.0.1:8080/ecommerce/account/checkout
passing through the filter to evaluate. Is this still par of the issue from above? Is there a better way to handle these filters in FrontMan?

Below is my current web.xml

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The CommandBroker is a servlet like any other, so filters get applied prior to the CommandBroker gaining control. You should be able to do anything in your filters regardless of the use of FrontMan.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:The CommandBroker is a servlet like any other, so filters get applied prior to the CommandBroker gaining control. You should be able to do anything in your filters regardless of the use of FrontMan.


So how would i prevent the command(verb) checkout from being viewed from any other url besides http://127.0.0.1:8080/ecommerce/account/checkout

i.e. if i try to acces this url it should not exist
http://127.0.0.1:8080/ecommerce/store/checkout

Maybe i am just not wrapping my head around the whole url mapping, i have kept the mappings super simple prior to this project.

Thanks

John

EDIT:

would this be a bad way to handle that situation?

If the command is accessed from a different url pattern but it hits the command class anyway do a redirect to the proper url, this will also ensure it passes through the filter properly.
Do you see any issues with handling it this way?


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Schretz wrote:So how would i prevent the command(verb) checkout from being viewed from any other url besides http://127.0.0.1:8080/ecommerce/account/checkout


Each CommandBroker instance can look in different packages for the defined commands. The CommandBroker for anything other than /account/* shouldn't have a command for checkout.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
John Schretz wrote:So how would i prevent the command(verb) checkout from being viewed from any other url besides http://127.0.0.1:8080/ecommerce/account/checkout


Each CommandBroker instance can look in different packages for the defined commands. The CommandBroker for anything other than /account/* shouldn't have a command for checkout.


I assume this is given that i am map multiple instances of the Command Broker?

Given the alternative of using only one Command Broker would the following be a suitable solution?

If the command is accessed from a different url pattern but it hits the command class anyway do a redirect to the proper url, this will also ensure it passes through the filter properly.
Do you see any issues with handling it this way?



Thanks again for all the help, this will be used on a pretty large scale project.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't do it, personally. Handling dispatch issues is not the job of the command. If you want distinct parts of the app that understand command subsets, I'd try the multiple command broker approach.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds good. You will be happy to know that FrontMan 2.0 is running the admin section of a $1.2M a year revenue ecommerce site. Still cant find a need for another framework, whatever i need extra i have been building on top of this
Implementing it now on the entire site.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Cool!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic