What's the best way to define some values based on the URL?
Let's say for example I want all my URLs for servlets to take the form:
http://mysite.com/module/action?arguments
What's the most scalable way to handle mapping the values in place of "module" and "action"? For example, I might have a "forum" module and have an action to "deleteThread", called like so:
http://mysite.com/forum/deleteThread?id=321
I know I can just parse it myself, but is there a better way to handle this via some settings in web.xml or similar? All my requests go through a Front Controller which needs to know which module and action have been requested so that it can run the appropriate action controller.
Cheers,
Chris
At the risk of repeat-posting, I'll clarify. Say I create a file named routing.xml which defines some routes like this:
<routing-config>
<route>
<name>Standard rule</name>
<description>
This route maps the first two parts in the path with the module and action
</description>
<url-pattern>/:module/:action.do</url-pattern>
</route>
<route>
<name>Default Index</name>
<description>
Allows the module to be specified without the action for "Index" actions.
</description>
<url-pattern>/:module.do</url-pattern>
<request-parameters>
<parameter key="action" value="Index" />
</request-parameters>
</route>
<route>
<name>Homepage</name>
<description>
Loads the Home page
</description>
<url-pattern>/</url-pattern>
<request-parameters>
<parameter key="module" value="Home" />
<parameter key="action" value="Index" />
</request-parameters>
</route>
</routing-config>The bits like ":module" which be represented by the actual name of the module in the URL. Does anyone know if something like this already exists? :)
I wrote this exact same thing in PHP5 just a few weeks ago but I really don't have the motivation to write it all over again in Java :P On a side-note, things like this usually come with helpers for turning unclean URIs into clean URIs.
Similar Messages
-
Best way to select distinct values based on another column?
I have a table with three columns: id (NUMBER), data_dt (DATE), and data_value (NUMBER).
There is a primary key on id and data_dt.
I want to select the record with the latest data_dt for each unique id.
What is the best way to do this?
I have three different methods, but there may be something I am missing.
First:
SELECT *
FROM
SELECT id, data_dt, data_value,
FIRST_VALUE(data_dt)
OVER (PARTITION BY id ORDER BY data_dt DESC) AS last_data_dt
FROM the_table
WHERE data_dt = last_data_dt;(I use ORDER BY...DESC instead of just ORDER BY so I don't need the ROWS BETWEEN clause)
Second:
SELECT t1.*
FROM the_table t1
JOIN
SELECT id, MAX(data_dt) AS last_data_dt
FROM the_table
GROUP BY id
) t2 ON (t2.id = t1.id AND t2.data_dt = t1.data_dt);Third:
SELECT t1.*
FROM the_table t1
WHERE t1.data_dt =
SELECT MAX(t2.data_dt)
FROM the_table t2
WHERE t2.id = t1.id
);-- DonHi,
There are more possible scenario's, for example:
select t1.*
from the_table t1
where not exists ( select null
from the_table t2
and t2.data_dt > t1.data_dt
What is the best way to do this?Only you can tell:
Test all scenario's, check the execution plans, set timing on and pick the best/fastest one ;-)
If it's not clear, please post the execution plans here. -
What is the best way to define constants in SOA ?
Hi,
What is the best way to define constants in SOA/BPEL ?I want to define at composite level. I have several BPELs in my composite. I have lot of Status and some other codes I need to check/compare/assign in assign activity and xslt transformations
Ii can use BPEL preferences , but they only applies to that particular BPEL. I want to define all my codes in one place at composite level.
Thanks
--Sreeny
Edited by: sreeny on May 29, 2012 8:59 AM -
What is the best way to digitise some work manuals onto my iPad?
What is the best way to digitise some work manuals onto my iPad? Thanks in advance.
I honestly don't know if there's an app out there that can handle documents that large.
Adobe has a free PDF app but i'm not sure if it allows authoring. And taking 200 separate scans and getting them put together into one book may require more resources than the iPad has.
The ipads only have so much computing power and RAM, so if I were doing it I'd see if the place that scans them will sort them by chapters/topics of your manual. So say each manual is 10 20 page sections (or however it breaks out)
There are a lot of free pdf files on various sites (even the apple site has manuals for their stuff). Download some of those and try to open them on your iPad. See where the upper limit is of what your iPad will handle. Then use that as a guide to how you have the copy place break them up. -
What is the best way to define this missing variable?????
I think I am almost there with this question, thanks for working with me on this: trying to make buttons go target cue points in video
I get this error code:
ReferenceError: Error #1065: Variable seek_btn is not defined.
import fl.video.*;
// Video component instance name
var flvControl:FLVPlayback = display;
var flvSource:String = "lou.flv";
// Set video
flvControl.source = flvSource;
// Add seek functionality to the button
function seekHandler(event:MouseEvent):void
flvControl.seekToNavCuePoint("lou1")
seek_btn.addEventListener(MouseEvent.CLICK, seekHandler);
seek_btn1.cuePointName = new String();
seek_btn1.cuePointName = "lou1";
seek_btn1.addEventListener(MouseEvent.CLICK, onButtonPress);
seek_btn2.cuePointName = new String();
seek_btn2.cuePointName = "lou2";
seek_btn2.addEventListener(MouseEvent.CLICK, onButtonPress);
// onButtonPress function
function onButtonPress(evt:MouseEvent):void {
flvControl.seekToNavCuePoint(evt.target.cuePointName);Definitely.... you are trying to assign a listener to something that does not exist
seek_btn.addEventListener(MouseEvent.CLICK, seekHandler);
If you do not have a seek_btn, the best way to define the missing variable is to create the seek_btn object. If you don't plan to, then rather than define it, get rid of any code that uses it. -
Best Way to Define Employee Numbering For Different Countries
HI all
I am working on for a project which will be for Multiple countries.But Each country has different Instances.Now the questions is What could be the Best way to Define Employee numbering for all the Regions ? As for as My knowledge goes It would be Number prefixed by Country.Then How we can have Alpha numeric in employee Coding ? We need to have Fast Formula to Ahieve this task.If any body has come across this scenario please share your thoughts .Any thoughts are greatly Appreciated.
Cheers
Kumar csIf you have each country on a different instance and you want employees to retain their employee number on transfer between countries, I believe you have two options:
i) Use manual numbering. One recent change to the system is that you can update the numbering profile from Auto to Manual and back to Auto again. So you could potentially leverage this manual workaround when a cross BG transfer happens.
ii) Bespoke module to export all emp numbers into a 'central repository', e.g., flat file, that can be accessed by all instances, imported regularly and then referenced by your Fast Formula. You would also need processing to determine when a person is a transfer from another BG or a new hire; probably have to be some control field on flex. Basically, this is a requirement made difficult by the decision to host each legislation on a different instance; I would never recommend clients to go down this route but I guess it's too late in your case.
If cross BG transfers are not common, e.g., less than 5 a week, I would recommend option 1. -
Hi
I am evaluating Kodo in the prospect to migrate an existing application
which uses a different JDO implementation and I am currently wondering
what is the best way to define the mapping.
So far, we have only used __.jdo__ metadata file with default values and
some jdo extension. Then we delegate to the JDO implementation the task to
define the schema and create it in the relationnal database.
I am trying to reproduce the same process with KODO. But :
- I am encountering some problem with the kodo extension.(but they are
certainly some mistake from my part, I will introduce some at the end of
this email)
- I understand that kodo can use a mapping file.
Here are my very first questions
- Which method should I use. Only JDO extension, or mapping file.
- if I use the mapping file, is it possible to only specify info for
fields which are different than default behavior of kodo
- If I use the jdo extension only how can I :
specify the name of a table for a particular class?
specify the name of a join table?
Specify the name of a column for a particular java field?
Is there a way to configure the mapping tool to use a custom naming
convention for the whole project (for a particular package)?
I already made a small evaluation of kodo 7 month ago with version 3.1.0,
but with this version, there was a bug discussed in this forum which
forced me to use the mapping file. But I had to define the complete
mapping, which was a huge task especially when you have to repeat field
mapping for sub classes. My first tests with kodo 3.2.2 works with jdo
extension, but I still have some issues as you can see from my questions.
Thank you for your answer.
Nicolas GANDRIAU
Environment description
Kodo 3.2.2 evaluation
MySQL 4.1.4-gamma'-Max'
MySQL Connector/J 3.0.15-ga
JDK 1.4.2_05 de Sun
Linux Kernel 2.6.8 (Mandrake 10.1)
IDEA 4.5.2Nicolas,
You need to define which mapping file using the kodo.jdbc.MappingFactory
extension. Note that with either format that the mapping information
must be complete (or you can have Kodo create them for you):
http://solarmetric.com/Software/Documentation/3.2.2/docs/ref_guide_conf_kodo.html#kodo.jdbc.MappingFactory
The metadata mapping factory is more verbose though all of your
information is in a single file. .mapping files are more consise but
need to be deployed in addition to your .jdo metadata.
Nicolas GANDRIAU wrote:
Hi
I am evaluating Kodo in the prospect to migrate an existing application
which uses a different JDO implementation and I am currently wondering
what is the best way to define the mapping.
So far, we have only used __.jdo__ metadata file with default values and
some jdo extension. Then we delegate to the JDO implementation the task to
define the schema and create it in the relationnal database.
I am trying to reproduce the same process with KODO. But :
- I am encountering some problem with the kodo extension.(but they are
certainly some mistake from my part, I will introduce some at the end of
this email)
- I understand that kodo can use a mapping file.
Here are my very first questions
- Which method should I use. Only JDO extension, or mapping file.
- if I use the mapping file, is it possible to only specify info for
fields which are different than default behavior of kodo
- If I use the jdo extension only how can I :
specify the name of a table for a particular class?
specify the name of a join table?
Specify the name of a column for a particular java field?
Is there a way to configure the mapping tool to use a custom naming
convention for the whole project (for a particular package)?
I already made a small evaluation of kodo 7 month ago with version 3.1.0,
but with this version, there was a bug discussed in this forum which
forced me to use the mapping file. But I had to define the complete
mapping, which was a huge task especially when you have to repeat field
mapping for sub classes. My first tests with kodo 3.2.2 works with jdo
extension, but I still have some issues as you can see from my questions.
Thank you for your answer.
Nicolas GANDRIAU
Environment description
Kodo 3.2.2 evaluation
MySQL 4.1.4-gamma'-Max'
MySQL Connector/J 3.0.15-ga
JDK 1.4.2_05 de Sun
Linux Kernel 2.6.8 (Mandrake 10.1)
IDEA 4.5.2
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com -
What's he best way to include Adobe PDFs on my blog?
What's he best way to include Adobe PDFs on my blog?
I create worksheets as a teacher and would like to share them from my blog. Currently I am linking to Scribd etc to share PDFs. If I upload the worksheets as an image is there a way to adjust the size/resolution of the PDF for easier viewing?
Thanks!PDFs are just files. Can you upload files to your blog space? If yes, just upload the PDFs then, in a blog entry, provide the web link (URL) for each file (PDF).
Or, place the PDFs into your free acrobat.com "files" storage (5GB free). You have one as you have an Adobe ID (needed to make your post here eh).
https://cloud.acrobat.com/
You can have acrobat.com provide a "share" link to the PDF. Place that into a blog entry.
Or - same idea as above (use a "file share" service) -- Microsoft's OneDrive, Adobe's Creative Cloud, Google drive, DropBox, others ...
Be well... -
Is there a way to hide some reports based on the selected values in prompt.
Hi Experts,
Is there a way to hide some reports based on the selected values in prompt.
For ex. if a year is selected in the prompt then the report should display year wise report.
If a year and half year both are selected in the drop down from prompt section then 2 reports should come.. One for year wise and another for half year wise.Kindly look into this.
Regards
AshishHi,
Use presentation values in prompts for year,half,qtr and month.Example- For year-y is presentation variable in the same way for halfyear-h,qtr-q and month-m.
create four intermediate reports.Example-Report r1 with only year column,r2 with only halfyear column,r3 with qtr column and r4 with month column.
Make column in each report(r1,r2,r3,r4) is equal to their presentation variables(y,h,q,m).
Use four sections.
Section1-Place report that should come when only year.
section2-Place report that should come for year and halfyear.
Section3-Place report that should come for year,halfyear and qtr.
Section4-Place report that should come for year,halfyear,qtr and month.
Apply guided navigation for each section selecting guided navigation-
For section1-
properties->Guided navigation->check this Reference Source Request(Yes)->select report r1(year)->check this Show Section(if request returns row)
In the same way do for remaining section2(select r2),section3(select r3) and section4(select r4)
Thanks,
Srikanth
http://bintelligencegroup.wordpress.com/ -
What is a best way to write SQL ?
Sample Case
drop table t;
drop table b;
create table t ( a varchar2(4), b number, c varchar2(1));
insert into t values ('A00', 10, 'R');
insert into t values ('A01', 11, 'R');
insert into t values ('A02', 12, 'R');
insert into t values ('A03', 13, 'R');
insert into t values ('A00', 10, 'P');
insert into t values ('A01', 11, 'P');
insert into t values ('A02', 12, 'P');
insert into t values ('A03', 13, 'P');
commit;
create table b ( j varchar(4), k varchar2(1), l varchar2(5), m number(3), n varchar2(5), o number(3));
insert into b values ('A00', 'P', 'FIXED', 100, 'FLOAT', 60);
insert into b values ('A01', 'P', 'FIXED', 101, 'FIXED', 30);
insert into b values ('A02', 'R', 'FLOAT', 45, 'FLOAT', 72);
insert into b values ('A03', 'R', 'FIXED', 55, 'FLOAT', 53);
commit;
10:19:13 SQL> select * from t;
A B C
A00 10 R
A01 11 R
A02 12 R
A03 13 R
A00 10 P
A01 11 P
A02 12 P
A03 13 P
8 rows selected.
10:19:19 SQL> select * from b;
J K L M N O
A00 P FIXED 100 FLOAT 60
A01 P FIXED 101 FIXED 30
A02 R FLOAT 45 FLOAT 72
A03 R FIXED 55 FLOAT 53
1/ In table t each reference having 2 records one with P another is with R
2/ In table b each refrence merged into single record and there are many records which are not existing in table t
3/ both t and j tables can be joined using a = j
4/ If from table t for a reference indicator is 'P' then if have to pick up l and m columns, if it is 'R' then I have to pick up n and o columns
5/ I want output in following format
A00 P FIXED 100
A00 R FLOAT 60
A01 P FIXED 101
A01 R FIXED 30
A02 P FLOAT 72
A02 R FLOAT 45
A03 P FLOAT 53
A03 R FIXED 55
6/ Above example is a sample ouput, In above example I have picked up only l,m,n,o columns, but in real example there are many columns ( around 40 ) to be selected. ( using "case when" may not be practical )
Kindly suggest me what is a best way to write SQL ?
thanks & regards
pjpIs this?
select b.j,t.c as k,decode(t.c,'P',l,n) as l,decode(t.c,'P',m,o) as m
from t,b
where t.a=b.j
order by j,k
J K L M
A00 P FIXED 100
A00 R FLOAT 60
A01 P FIXED 101
A01 R FIXED 30
A02 P FLOAT 45
A02 R FLOAT 72
A03 P FIXED 55
A03 R FLOAT 53
8 rows selected.
or is this?
select b.j,t.c as k,decode(t.c,b.k,l,n) as l,decode(t.c,b.k,m,o) as m
from t,b
where t.a=b.j
order by j,k
J K L M
A00 P FIXED 100
A00 R FLOAT 60
A01 P FIXED 101
A01 R FIXED 30
A02 P FLOAT 72
A02 R FLOAT 45
A03 P FLOAT 53
A03 R FIXED 55
8 rows selected. -
I'm running firefox 35.01 on macpro OS 10.7.5 what is th best way to do ftp?
Do you mean '''F'''ile '''T'''ransfer '''P'''rotocol (FTP) ?
Please give more details. -
Best way to extract XML value wiith an xpath
Hello,
I wonder what is the best way to extract text value from XmlType with an xpath.
I need to insert a row inside a table where the row's data come from xpath extractions of an XmlType. I do a lot of (approximative 20) :
EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elem1').
EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elemI').
EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elem20').
inside the insert statement
Is this way is the best or is there a more optimal way ?
For example extracting the node '/an/xpath/to/extract/' and sarting from this node extracting "elem1", ... , "elemI", "elemN" children.
Thanks for your help,
Regards,
NicolasHi Nicolas,
The answer depends on your actual storage method (binary, OR, CLOB?), and db version.
You can try XMLTable, it might be better in this case :
SELECT x.elem1, x.elem2, ... , x.elem20
FROM your_table t
, XMLTable(
'/an/xpath/to/extract'
passing t.myxmltype
columns elem1 varchar2(30) path 'elem1'
, elem2 varchar2(30) path 'elem2'
, elem20 varchar2(30) path 'elem20'
) x
; -
Best way to change TreeMap value?
Hello,
I am wondering what is the best way to change a value in a TreeMap? I have retrieved a value by .get on the key i.e.
String aString = (TreeMap) aTreeMap.get(aKey);but would now like to change aString and ?.put? it back into the map?
How would I do this?
Thank you,
Poot.but would now like to change aString and ?.put? it
back into the map?Do I just have to keep a note on the (key,value) - especially key - change the value and then .put(key,value) back in? Though I'll need to remove the initial pairing if I do this since TreeMap won't allow duplicate keys!
There must be an easier way as this.
Thank you for your reply,
Regards,
Poot. -
What is the url for executing PL/SQL via 9i http
what is the URL for 9i http server pl/sql routines that I just compiled? I don't run 9ias just the 9i http server
http://machine:port/?????????/procedure_name
thnx
endredo this if you are still having problemd
CREATE AND SETUP NEW USER
The second step is to create an application user that will
own the code for this example. Connect to SQL*PLUS as a user with
DBA rights, and execute the following commands:connect
SQL> CREATE USER user IDENTIFIED by user;
SQL> GRANT CONNECT, RESOURCE TO user;
CONFIGURE DAD IN THE PL/SQL GATEWAY
The third step is to create a new DAD.
Enter the PL/SQL gateway configuration menu. The generic address to the
page is
http://<machin:port/pls/admin_/gateway.htm
The is specified in your plsql.conf file. By default the address
will be
http://..:/pls/admin_/gateway.htm
(Replace ..: with the valid entry for your
configuration, e.g. www.acme.com:8080).
Click on the link 'Gateway Database Access Descriptor Settings' to access
your DAD settings. Then press the link 'Add for WebDB 2.x configuration'
to create a new DAD. Enter the following values:
Parameter Value
Database Access Descriptor Name give name
Schema Name the user you created
Oracle User Name the user you created
Oracle Password the password of the user
Oracle Connect String <- found in your
tnsnames.ora
Document Table documents
Document Access Procedure user.package.procedure
Extensions to be uploaded as LONG RAW
Leave the other parameters as they are. If you are not using an 8i database
or need to use the LONG RAW datatype for
some reason, you can place an '*' in the "Extensions to be uploaded as LONG
RAW" field. You can also limit this to
specific file name extensions such as jpg or pdf by entering the extensions
and using a comma to separate the
values. Click the OK button to save the DAD configuration.
Hope this helps -
what is the URL for icloud webmail from an ipad2
There are other browers available in the app store, I've heard that some of them can access icloud.com. I don't know which ones.
Also, can't you just add your account in mail? You can always delete it when home - it won't mess things up for her. ... unless there are "security" issues involved.
Maybe you are looking for
-
Email Links In Smartforms emailed as a PDF
All, I have written a program that creates a smartform as a PDF attachment which gets sent as an email. Part of the content contains URL's for the recipient to click and navigate to an page on our erecruitment system. The problem is that the url is o
-
Can't see anything in iWork 08 after installing it on my new MacBook Pro
I recently reinstalled IWork 08 in my new MacBook Pro. I was using it on my old MacBook Pro, which my wife now has. When I open any of the programs, everything is white. If I double click any text that may be in the file, it can be viewed as highli
-
Some process running - CE 7.2
Hi All, I installed CE 7.2 from SDN. But when i start the server, it displays "Some processes running" for server1 in MMC . When i access the server through internet explorer, i get ICM running but no server connected error. I installed the server on
-
Cover appearing incorrectly (newbie question)
Hi, I'm creating my first epub-using EPUB 3, making it reflowable, so it should be pretty straightforward. I've got most everything working, including the TOC. It's great. But the cover is not exporting in the expected way. When I open the epub in iB
-
Indesign 2014 Constantly feels like it is refreshing
Hi, I have just updated to Indesign 2014 and it now seems to constantly flicker every few seconds as though it is trying to update or refresh, is there any thing to stop this?