[JBoss JIRA] (FORGE-1723) Incorrect web.xml generated for REST
by Arun Gupta (JIRA)
Arun Gupta created FORGE-1723:
---------------------------------
Summary: Incorrect web.xml generated for REST
Key: FORGE-1723
URL: https://issues.jboss.org/browse/FORGE-1723
Project: Forge
Issue Type: Bug
Components: Java EE
Affects Versions: 1.4.4.Final
Reporter: Arun Gupta
Create a project using Forge 1.4.4 as:
[no project] tmp $ new-project --named basic-javaee-forge --topLevelPackage org.forge.samples.javaee --type war
? Use [/Users/arungupta/tmp/basic-javaee-forge] as project directory? [Y/n] y
***SUCCESS*** Created project [basic-javaee-forge] in new working directory [/Users/arungupta/tmp/basic-javaee-forge]
Wrote /Users/arungupta/tmp/basic-javaee-forge
Wrote /Users/arungupta/tmp/basic-javaee-forge/pom.xml
Wrote /Users/arungupta/tmp/basic-javaee-forge/src/main/webapp
Wrote /Users/arungupta/tmp/basic-javaee-forge/src/main/java
Wrote /Users/arungupta/tmp/basic-javaee-forge/src/test/java
Wrote /Users/arungupta/tmp/basic-javaee-forge/src/main/resources
Wrote /Users/arungupta/tmp/basic-javaee-forge/src/test/resources
Wrote /Users/arungupta/tmp/basic-javaee-forge/src/main/java/org/forge/samples/javaee
[basic-javaee-forge] basic-javaee-forge $ rest setup
Use which version of 'jboss-javaee-6.0' ?
1 - [org.jboss.spec:jboss-javaee-6.0:pom::1.0.0.Beta4]
2 - [org.jboss.spec:jboss-javaee-6.0:pom::1.0.0.Beta5]
3 - [org.jboss.spec:jboss-javaee-6.0:pom::1.0.0.Beta6]
4 - [org.jboss.spec:jboss-javaee-6.0:pom::1.0.0.Beta7]
5 - [org.jboss.spec:jboss-javaee-6.0:pom::1.0.0.CR1]
6 - [org.jboss.spec:jboss-javaee-6.0:pom::1.0.0.Final]
7 - [org.jboss.spec:jboss-javaee-6.0:pom::2.0.0.Beta1]
8 - [org.jboss.spec:jboss-javaee-6.0:pom::2.0.0.CR1]
9 - [org.jboss.spec:jboss-javaee-6.0:pom::2.0.0.Final]
10 - [org.jboss.spec:jboss-javaee-6.0:pom::2.1.0.Beta1]
11 - [org.jboss.spec:jboss-javaee-6.0:pom::3.0.0.Beta1]
12 - [org.jboss.spec:jboss-javaee-6.0:pom::3.0.0.Final]
13 - [org.jboss.spec:jboss-javaee-6.0:pom::3.0.1.Final]
14 - [org.jboss.spec:jboss-javaee-6.0:pom::3.0.2.Final]*
? Choose an option by typing the number of the selection [*-default] [0]
***SUCCESS*** Installed [forge.spec.servlet] successfully.
? What root path do you want to use for your resources? [/rest]
***SUCCESS*** Installed [forge.spec.jaxrs.webxml] successfully.
***SUCCESS*** Installed [forge.spec.jaxrs] successfully.
***SUCCESS*** Rest Web Services (JAX-RS) is installed.
Wrote /Users/arungupta/tmp/basic-javaee-forge/pom.xml
Wrote /Users/arungupta/tmp/basic-javaee-forge/src/main/webapp/WEB-INF/web.xml
Generated web.xml is shown below:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>basic-javaee-forge</display-name>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
Deploying this project in JBoss EAP 6.2 gives the error:
17:34:18,770 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/basic-javaee-forge]] (ServerService Thread Pool -- 126) JBWEB000289: Servlet javax.ws.rs.core.Application threw load() exception: javax.servlet.ServletException: JBWEB000260: No servlet class has been specified for servlet javax.ws.rs.core.Application
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1147) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1100) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3591) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3798) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
This is because javax.ws.rs.core.Application is not a Servlet. There is even no need to generated web.xml, a combination of Application and ApplicationPath will be sufficient.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[JBoss JIRA] (FORGE-1722) Adding constraint with regular expression throws an Error
by Arun Gupta (JIRA)
Arun Gupta created FORGE-1722:
---------------------------------
Summary: Adding constraint with regular expression throws an Error
Key: FORGE-1722
URL: https://issues.jboss.org/browse/FORGE-1722
Project: Forge
Issue Type: Feature Request
Components: Parsers / File Manipulation
Affects Versions: 1.4.4.Final
Reporter: Arun Gupta
constraint Pattern --onProperty isbn --regexp "^\d{9}[\d|X]$"
***ERROR*** Exception encountered: org.eclipse.jdt.core.dom.MarkerAnnotation cannot be cast to org.eclipse.jdt.core.dom.NormalAnnotation (type "set VERBOSE true" to enable stack traces)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[JBoss JIRA] (FORGE-1671) Add nested annotation to a constraint annotation
by Lincoln Baxter III (JIRA)
[ https://issues.jboss.org/browse/FORGE-1671?page=com.atlassian.jira.plugin... ]
Lincoln Baxter III updated FORGE-1671:
--------------------------------------
Component/s: Parsers / File Manipulation
> Add nested annotation to a constraint annotation
> ------------------------------------------------
>
> Key: FORGE-1671
> URL: https://issues.jboss.org/browse/FORGE-1671
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE, Parsers / File Manipulation
> Affects Versions: 2.2.0.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> At the moment a constraint annotation does not contain a {{List}} of constraints. So, at the moment, the command {{constraint-new-annotation}} generates the following code :
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "Invalid value";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> {code}
> It should add a nested annotation {{List}} of type array of constraint
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "Invalid value";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
> See class : {{NewAnnotationCommand}}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[JBoss JIRA] (FORGE-1671) Add nested annotation to a constraint annotation
by Lincoln Baxter III (JIRA)
[ https://issues.jboss.org/browse/FORGE-1671?page=com.atlassian.jira.plugin... ]
Lincoln Baxter III commented on FORGE-1671:
-------------------------------------------
A description of this functionality can be found in the spec here: http://beanvalidation.org/1.1/spec/#constraintsdefinitionimplementation-m...
> Add nested annotation to a constraint annotation
> ------------------------------------------------
>
> Key: FORGE-1671
> URL: https://issues.jboss.org/browse/FORGE-1671
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.2.0.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> At the moment a constraint annotation does not contain a {{List}} of constraints. So, at the moment, the command {{constraint-new-annotation}} generates the following code :
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "Invalid value";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> {code}
> It should add a nested annotation {{List}} of type array of constraint
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "Invalid value";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
> See class : {{NewAnnotationCommand}}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[JBoss JIRA] (FORGE-1671) Add nested annotation to a constraint annotation
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1671?page=com.atlassian.jira.plugin... ]
Antonio Goncalves commented on FORGE-1671:
------------------------------------------
Another attempt... but looks like it's impossible to do with Roaster at the moment :
{code}
public class BeanValidationAnnotation {
public static void main(String[] args) {
// This is the inner annotation List
final JavaAnnotationSource listAnnotation = Roaster.create(JavaAnnotationSource.class);
listAnnotation.setName("List");
listAnnotation.addAnnotation(Retention.class).setEnumValue(RUNTIME);
listAnnotation.addAnnotation(Target.class).setEnumValue(METHOD, FIELD, PARAMETER, TYPE);
listAnnotation.addAnnotationElement("Email[] value()");
System.out.println(listAnnotation);
// This is the annotation @Email
final JavaAnnotationSource emailAnnotation = Roaster.create(JavaAnnotationSource.class);
emailAnnotation.setPackage("org.agoncal.proj.constraints").setName("Email");
emailAnnotation.addImport(Payload.class);
emailAnnotation.addAnnotation(Documented.class);
emailAnnotation.addAnnotation(Retention.class).setEnumValue(RUNTIME);
emailAnnotation.addAnnotation(Target.class).setEnumValue(METHOD, FIELD, PARAMETER, TYPE);
emailAnnotation.addAnnotation(Constraint.class).setLiteralValue("validatedBy", "{}");
emailAnnotation.addAnnotationElement("String message() default \"wrong email address\"");
emailAnnotation.addAnnotationElement("Class<?>[] groups() default {}");
emailAnnotation.addAnnotationElement("Class<? extends Payload>[] payload() default {}");
// I was expecting to have a method like that so I could add annotation inside another one
// emailAnnotation.addAnnotationElement(emailAnnotation);
System.out.println(emailAnnotation);
}
}
{code}
> Add nested annotation to a constraint annotation
> ------------------------------------------------
>
> Key: FORGE-1671
> URL: https://issues.jboss.org/browse/FORGE-1671
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.2.0.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> At the moment a constraint annotation does not contain a {{List}} of constraints. So, at the moment, the command {{constraint-new-annotation}} generates the following code :
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "Invalid value";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> {code}
> It should add a nested annotation {{List}} of type array of constraint
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "Invalid value";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
> See class : {{NewAnnotationCommand}}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years