How to serve static page with restful services in TomEE plus 1.6?

2013-11-03 Thread Yanbo Ye
Hello everyone,

I’m developing a html5 application with a restful service generated using
Netbeans.
After modifying some configuration xml files like removing jersey
serverlethttp://stackoverflow.com/questions/10583563/how-can-i-integrate-jersey-with-tomee-openejb,
changing xmlns to “
http://java.sun.com/xml/ns/persistence“ and configuring jta-data-source in
persistence.xml. The service finally worked. But I cannot access my web
files in the web root directory. Anyone knows why?

Here is my source files:

web.xml

?xml version=1.0 encoding=UTF-8?web-app version=3.0
xmlns=http://java.sun.com/xml/ns/javaee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd;
session-config
session-timeout
30
/session-timeout
/session-config
filter
filter-namecross-origin/filter-name
filter-classorg.apache.catalina.filters.CorsFilter/filter-class
/filter
filter-mapping
filter-namecross-origin/filter-name
url-pattern/api/*/url-pattern
/filter-mapping
/web-app

persistence.xml

?xml version=1.0 encoding=UTF-8?persistence version=2.1
xmlns=http://java.sun.com/xml/ns/persistence;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd;
  persistence-unit name=TongYiMenHuRestServicePU transaction-type=JTA
providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
   jta-data-sourcetongyimenhu/jta-data-source!--
non-jta-data-sourcetongyimenhu-nonjta/non-jta-data-source--
classcom.tongyimenhu.entities.Type/class
exclude-unlisted-classesfalse/exclude-unlisted-classes
  /persistence-unit
/persistence

context.xml

?xml version=1.0 encoding=UTF-8?
Context antiJARLocking=true path=/tymh/

Type.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */package com.tongyimenhu.entities;
import java.io.Serializable;import javax.persistence.Basic;import
javax.persistence.Column;import javax.persistence.Entity;import
javax.persistence.GeneratedValue;import
javax.persistence.GenerationType;import javax.persistence.Id;import
javax.persistence.NamedQueries;import
javax.persistence.NamedQuery;import javax.persistence.Table;import
javax.validation.constraints.NotNull;import
javax.validation.constraints.Size;import
javax.xml.bind.annotation.XmlRootElement;
/**
 *
 * @author yeyanbo
 */@Entity@Table(name = type)@XmlRootElement@NamedQueries({
@NamedQuery(name = Type.findAll, query = SELECT t FROM Type t),
@NamedQuery(name = Type.findByTypeId, query = SELECT t FROM
Type t WHERE t.typeId = :typeId),
@NamedQuery(name = Type.findByTypeName, query = SELECT t FROM
Type t WHERE t.typeName = :typeName),
@NamedQuery(name = Type.findByTypeAudit, query = SELECT t FROM
Type t WHERE t.typeAudit = :typeAudit),
@NamedQuery(name = Type.findByTypeDescrib, query = SELECT t
FROM Type t WHERE t.typeDescrib = :typeDescrib)})public class Type
implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = type_id)
private Integer typeId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 35)
@Column(name = type_name)
private String typeName;
@Column(name = type_audit)
private Integer typeAudit;
@Size(max = 50)
@Column(name = type_describ)
private String typeDescrib;

public Type() {
}

public Type(Integer typeId) {
this.typeId = typeId;
}

public Type(Integer typeId, String typeName) {
this.typeId = typeId;
this.typeName = typeName;
}

public Integer getTypeId() {
return typeId;
}

public void setTypeId(Integer typeId) {
this.typeId = typeId;
}

public String getTypeName() {
return typeName;
}

public void setTypeName(String typeName) {
this.typeName = typeName;
}

public Integer getTypeAudit() {
return typeAudit;
}

public void setTypeAudit(Integer typeAudit) {
this.typeAudit = typeAudit;
}

public String getTypeDescrib() {
return typeDescrib;
}

public void setTypeDescrib(String typeDescrib) {
this.typeDescrib = typeDescrib;
}

@Override
public int hashCode() {
int hash = 0;
hash += (typeId != null ? typeId.hashCode() : 0);
return hash;
}

@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id
fields are not set
if (!(object instanceof Type)) {
return false;
}
Type other = (Type) object;
if ((this.typeId == null  other.typeId != null) ||
(this.typeId != null  

Re: How to serve static page with restful services in TomEE plus 1.6?

2013-11-03 Thread Romain Manni-Bucau
Hi

Does
https://issues.apache.org/jira/i#browse/TOMEE-728?issueKey=TOMEE-728amp;serverRenderedViewIssue=truehelp?
Le 3 nov. 2013 13:17, Yanbo Ye yeyanbo...@gmail.com a écrit :